Integrating Login Prompt in Application

Sep 16, 2008 at 6:19 PM
I have an WPF application that is being migrated from CAB to Composite WPF.
Within this application is an Authentication Service, that creates a Window prompting for user credentials.
In the CAB version of this application, the Shell window launches fine after credentials have been entered and the
Authentication window closed.  This version of the application has a regular Static Main() entries marked with
STAThread.

In the Composite WPF version, I am using a Boostrapper class that inherits from UnityBootsrapper to start the application
as suggested in the literature.  I am overriding the ConfigureContainer() method and adding my own services,
after calling base.ConfigureContainer.  Here, I als instantiate the Authentication Service and call its
Authenticate method.

The login window prompts for credentials but my Shell does not show, after credentials have been entered and
the login window is closed.  I have been able to narrow the problem down to my Authentication Service's login prompt.
If I do not display this prompt, the Shell shows fune.

Any ideas and explanation on what I am observing here would help.  Attached is the code in my Bootstrapper class.

 protected override void ConfigureContainer()
        {           

            base.ConfigureContainer();           
          
            try
            {                                                                      
                Container.RegisterInstance<IEMSLicenseProvider>(new OCC600LicenseProvider());               
                Container.RegisterType<IEntityTranslatorService, EntityTranslatorService>(new ContainerControlledLifetimeManager());
                Container.RegisterInstance<IUtilityService>(new UtilityService());
                Container.RegisterType<IUserSelectorService, UserSelectorService>();
                Container.RegisterType<IStatusBarService, StatusBarService>(new ContainerControlledLifetimeManager());
                Container.RegisterInstance<ICommandService>(new CommandService());
                Container.RegisterInstance<IOCC600WebService>(new OCC600WebServiceClient());
                Container.RegisterType<IEMSQueryEngine, VMSQueryEngine>(new ContainerControlledLifetimeManager());
                Container.RegisterType<IEMSMessageForwarder, OCCMessageFowarder>(new ContainerControlledLifetimeManager());
                Container.RegisterType<IEMSSharedDataService, OCCSharedDataService>(new ContainerControlledLifetimeManager());
                Container.RegisterType<IEMSRoleProvider, OCCRoleManagementService>(new ContainerControlledLifetimeManager());
                Container.RegisterType<IEMSMembershipProvider, OCCMembershipProvider>(new ContainerControlledLifetimeManager());
                Container.RegisterType<IEMSAuthourizationProvider, OCCAuthorizationProvider>(new ContainerControlledLifetimeManager());
                Container.RegisterInstance<IEMSProfileProvider>(new OCCProfileProvider(Container));

                App.CloseSplashScreen();

                IEMSAuthenticationProvider authenticator = new OCCAuthenticationProvider(Container);
                Container.RegisterInstance<IEMSAuthenticationProvider>(authenticator);
                authenticator.Authenticate();                                                                                                                                                                                                                                                                                                                                                                                        
            }
           
            finally
            {
              
            }
        }
Sep 17, 2008 at 2:53 PM
Issue resolved;

Set

Application.Current.ShutdownMode = ShutdownMode.OnExplicitShutdown

in App.Xaml.cs constructor  and

Application.Current.ShutdownMode = ShutdownMode.OnMainWindowClose;

in Authentication service after user has been authenticated.




Sep 17, 2008 at 2:54 PM
Solution obtained from here:

http://www.codeplex.com/CompositeWPF/Thread/View.aspx?ThreadId=29570