I am developing an application (wpf) that has 3 windows. in the main window, the user can open another window. when the user wants to open window1, I create an instance of window1 and show that
var win1 = new Window1(); win1.Owner = this; win1.Show();
Now that the user wants to close the application, I want to iterate through each open window and check if this window is closed (or if it is busy to complete the operation) to close this window and close the application. my question is how to iterate through open windows? possibly using this:
foreach (var window in Application.Current.Windows) { window. }
but how can I detect window Window1 or Window2?
source share