private void exitMenuItem_Click(object sender, EventArgs e) { if (_iomh != null) { _iomh.StopMonitor(); } Application.Exit(); }
private void frmMain_FormClosing(object sender, FormClosingEventArgs e) { if (e.CloseReason == CloseReason.WindowsShutDown || e.CloseReason == CloseReason.TaskManagerClosing) { closedFromMenu = true; } if (closedFromMenu == false) { WindowState = FormWindowState.Minimized; ShowInTaskbar = false; e.Cancel = true; } else { if (iomh != null) { iomh.StopMonitor(); } } }