Why does Application exit using this code?

Topics: Prism v2 - WPF 3.5
Oct 26, 2009 at 7:29 PM

Hi,

Using the Prism libraries I have this code in the App.OnStartup:

        protected override void OnStartup(StartupEventArgs e)
        {

            base.OnStartup(e);
            LoginWindow l = new LoginWindow();
            Nullable<bool> dialogResult = l.ShowDialog();


            BootStrapper bootStrapper = new BootStrapper();
            bootStrapper.Run();

        }

Without the LoginWindow code in place the bootStrapper (derived from UnityBootStrapper) runs as expected and displays the shell. With the LoginWindow code inserted the bootstrapper code still executes but on completion the whole application exits. Why?


Oct 27, 2009 at 9:46 PM

Hi,

I've created a post about this, that provides two sample applications to better understand what happens with your application.

I hope that this answer helps you. Your feedback is really appreciated.

Fernando Antivero
http://blogs.southworks.net/fantivero

Oct 28, 2009 at 10:29 AM

Hi,

Thank you for the explanation! I guess I should have been looking to normal WPF behaviour rather than Prism for the cause of the problem!

In practice I may or may not want the application to exit after the Dialog closes but now that I understand what's going on that shouldn't be a problem.

Thank you again for the assistance, Best,

Viv