private static void CloseAllMainWindowsForApp(FwApp app)
{
if (app == null)
return;
foreach (Form mainWnd in app.MainWindows.OfType<Form>())
{
if (mainWnd.IsDisposed)
continue; // This can happen in renaming.
// This is typically used if an exception happens to gracefully close any
// open main windows so we need to ignore any errors because we have no
// idea what state the application is in.
Form wnd = mainWnd;
mainWnd.Invoke((Action) (() => ExceptionHelper.LogAndIgnoreErrors(wnd.Close)));
}
}
#endregion