开发者

WPF show dialog at startup

开发者 https://www.devze.com 2023-01-13 05:45 出处:网络
I have a flag if set I would like a connection Dialog window to showu开发者_开发技巧p on startup.In App.xaml.cs in the Application_Startup event handler I have the code to show the window.What is happ

I have a flag if set I would like a connection Dialog window to showu开发者_开发技巧p on startup. In App.xaml.cs in the Application_Startup event handler I have the code to show the window. What is happening is the splash screen shows (a png set to splash screen), the dialog pops up for a second then closes and the main WPF window displays. I would like the process to wait until the user closes the dialog window. Oh and the dialog window is not WPF it's a Windows.Form.

The form is this http://blogs.msdn.com/b/vsdata/archive/2010/02/02/data-connection-dialog-source-code-is-released-on-code-gallery.aspx

Any ideas?

Thanks

Rick


Do you use Show() or ShowDialog for your window ? Show() will not stop the code from running while ShowDialog() should.

Hopes that helps.


If the other window is a WinForms window (by the way, this is pertinent information I noticed in a comment) it won't behave correctly, because the whole message pump system of WinForms isn't present when the window is shown; in WPF it has been replaced by the Dispatcher. I'm afraid I don't know a solution off-hand, but searching for WPF-WinForms integration should give some answers.

0

精彩评论

暂无评论...
验证码 换一张
取 消