private void MainWindow_FormClosing(object Sender, FormClosingEventArgs EventArgs) { if (!bAllowClose && Settings.bKeepInTray) { Hide(); EventArgs.Cancel = true; } else { for (int Idx = 0; Idx < TabControl.GetTabCount(); Idx++) { IMainWindowTabPanel TabPanel = (IMainWindowTabPanel)TabControl.GetTabData(Idx); if (!TabPanel.CanClose()) { EventArgs.Cancel = true; return; } } StopScheduleTimer(); } Settings.bWindowVisible = Visible; Settings.WindowState = WindowState; if (WindowState == FormWindowState.Normal) { Settings.WindowBounds = new Rectangle(Location, Size); } else { Settings.WindowBounds = RestoreBounds; } Settings.Save(); }
private void MainWindow_FormClosing(object Sender, FormClosingEventArgs EventArgs) { if (!bAllowClose && Settings.bKeepInTray) { Hide(); EventArgs.Cancel = true; } else { for (int Idx = 0; Idx < TabControl.GetTabCount(); Idx++) { IMainWindowTabPanel TabPanel = (IMainWindowTabPanel)TabControl.GetTabData(Idx); if (!TabPanel.CanClose()) { EventArgs.Cancel = true; return; } } ActivationListener.OnActivate -= OnActivationListenerAsyncCallback; ActivationListener.Stop(); UpdateMonitor.OnUpdateAvailable -= OnUpdateAvailable; UpdateMonitor.Close(); // prevent race condition StopScheduleTimer(); Rectangle SaveBounds = (WindowState == FormWindowState.Normal)? Bounds : RestoreBounds; Settings.WindowRectangle = SaveBounds; Settings.bWindowVisible = Visible; Settings.Save(); } }
private void MainWindow_FormClosing(object Sender, FormClosingEventArgs EventArgs) { if (!bAllowClose && Settings.bKeepInTray) { Hide(); EventArgs.Cancel = true; } else { for (int Idx = 0; Idx < TabControl.GetTabCount(); Idx++) { IMainWindowTabPanel TabPanel = (IMainWindowTabPanel)TabControl.GetTabData(Idx); if (!TabPanel.CanClose()) { EventArgs.Cancel = true; return; } } StopScheduleTimer(); Settings.bWindowVisible = Visible; Settings.Save(); } }
bool TabControl_OnTabClosing(object TabData) { IMainWindowTabPanel TabPanel = (IMainWindowTabPanel)TabData; return(TabPanel.CanClose()); }