tags:

views:

133

answers:

2

I have a flag if set I would like a connection Dialog window to showup 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

A: 

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

Hopes that helps.

David Brunelle
I thought of the same thing. But the window (from a library. not my own) I'm using just has a show method which works like ShowDialog(). In my project I have a menu that launches the same window and when it does, it blocks as I expect it to. More specifically I am using this http://blogs.msdn.com/b/vsdata/archive/2010/02/02/data-connection-dialog-source-code-is-released-on-code-gallery.aspx.
Rick
In that case, maybe app.xaml doesn't exactly work like I though it would. I fancy it might load at the same time, instead of before. When does your splash screen show ? Is it in your app.xaml to?
David Brunelle
splash screen shows first. Then the connection dialog shows on top. The splash screen is simply a png file with it's buildaction set to SplashScreen.
Rick
A: 

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.

Alex Paven