private void exitToolStripMenuItem_Click(object sender, EventArgs e) { _hotkey.Press -= OnHotkeyPress; _hotkey.Dispose(); Application.Exit(); }
public void UnloadHotKey(Hotkey currentHotkey) { try { currentHotkey.Dispose(); } catch (Exception) { // ignored } GlobalHotkeyService.Instance.UnregisterHotKey(currentHotkey); }
private void Register() { if (hotkey != null) { hotkey.Dispose(); } hotkey = new Hotkey(ModifierKey, Key, window); hotkey.HotkeyPressed += (k) => action(window); }
public void Dispose() { if (null != _hotKey) { _hotKey.Dispose(); _hotKey = null; } if (null != _notify) { _notify.Visible = false; _notify.Dispose(); _notify = null; } }
private void Window_Closing(object sender, CancelEventArgs e) { Ready = false; DataContext = null; if (Model != null) { Model.Dispose(); Model = null; } ClearAppBar(); Devices.RemoveHook(this); ShowDesktop.RemoveHook(); Hotkey.Dispose(); }
private void LogWindow_FormClosing(object sender, FormClosingEventArgs e) { if (e.CloseReason == CloseReason.UserClosing && !_exiting) { //behave like Windows Messenger and other systray-based programs, hijack exit for close and explain e.Cancel = true; LogWindowCloseWithWarning(); } else { if (UIUtils.DismissableWarning("Exiting Application", "You are exiting the Nano TimeTracker application - to later track time later you will need to start it again. If you just want to hide the window, then cancel here and choose \"Close\" instead.", "HideExitWarning")) { if (_taskInProgress) { if (!UIUtils.DismissableWarning("Exiting - Task In Progress", "You are exiting Nano TimeTracker, but you still have a task in progress. The next time you start the application, you will be asked to confirm when that task completed.", "HideExitTaskInProgressWarning")) { //user cancelled on the exit task in progress warning e.Cancel = true; } } } else { //user cancelled on the exit warning e.Cancel = true; } } // assuming we didn't actually exit, reset exiting flag for next time if (e.Cancel) { _exiting = false; } else { TaskHotKey.Dispose(); } }
private void Window_Closing(object sender, CancelEventArgs e) { Ready = false; DataContext = null; if (Model != null) { Model.Dispose(); Model = null; } if (OS.SupportVirtualDesktop) { VirtualDesktop.CurrentChanged -= VirtualDesktop_CurrentChanged; } ClearAppBar(); Devices.RemoveHook(this); ShowDesktop.RemoveHook(); Hotkey.Dispose(); }
public void Dispose() { _hotkey.Dispose(); }
void MainWindow_Closed(object sender, EventArgs e) { globalHotkey.Dispose(); MouseHook.stop(); }
protected override void OnExit(ExitEventArgs e) { _notify.Dispose(); _hotkey.Dispose(); base.OnExit(e); }
protected override void OnExit(ExitEventArgs e) { hotkey1.Dispose(); base.OnExit(e); }