tags:

views:

15

answers:

1

i'm developing an application (wpf) that have 3 widow. in the main window user can open other window. when user wants to open window1 i'm create an instance of window1 and showing up that

var win1 = new Window1();
win1.Owner = this;
win1.Show();

now when user wants to close app, i want to iterate through each open window and check if that window isn't busy (or if is busy wait to complete operation) close that window and then close application. my question is how to iterating through open windows? maybe using this:

foreach (var window in Application.Current.Windows)
{
    window.
}

but how i can detect window is Window1 or Window2?

+1  A: 

You can do

if(window is Window1)
{
   //window is of type 'Window1'!
}

Inside the 'foreach' loop.

dacris