System.Windows.MessageBox doesn't wait for user input before going poof!

后端 未结 7 1506
轻奢々
轻奢々 2021-01-08 00:56

...and it makes no sense why. T-T

In my Application_Startup event handler I have code that looks kinda like this:

private void Applicati         


        
7条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-08 01:29

    You need to tell WPF not to shutdown when the first window does. Look at this: http://msdn.microsoft.com/en-us/library/system.windows.application.shutdownmode.aspx. You want to set your application to shutdown explicitly (instead of after the first window closes):

    
    
    

    Your other choose is to set your MainWindow as the StartupUri (instead of your splash screen) and then load your splash screen in the MainWindow's loaded event. Then you would do whatever loading or time intensive stuff you need to do, hide your splash screen, and re-show your main Window.

提交回复
热议问题