Пример #1
0
        private void exitToolStripMenuItem_Click(object sender, EventArgs e)
        {
            _hotkey.Press -= OnHotkeyPress;
            _hotkey.Dispose();

            Application.Exit();
        }
Пример #2
0
 public void UnloadHotKey(Hotkey currentHotkey)
 {
     try { currentHotkey.Dispose(); }
     catch (Exception)
     {
         // ignored
     }
     GlobalHotkeyService.Instance.UnregisterHotKey(currentHotkey);
 }
Пример #3
0
 private void Register()
 {
     if (hotkey != null)
     {
         hotkey.Dispose();
     }
     hotkey = new Hotkey(ModifierKey, Key, window);
     hotkey.HotkeyPressed += (k) => action(window);
 }
Пример #4
0
        public void Dispose()
        {
            if (null != _hotKey)
            {
                _hotKey.Dispose();
                _hotKey = null;
            }

            if (null != _notify)
            {
                _notify.Visible = false;
                _notify.Dispose();
                _notify = null;
            }
        }
Пример #5
0
        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();
        }
Пример #6
0
        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();
            }
        }
Пример #7
0
        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();
 }
Пример #9
0
 void MainWindow_Closed(object sender, EventArgs e)
 {
     globalHotkey.Dispose();
     MouseHook.stop();
 }
Пример #10
0
 protected override void OnExit(ExitEventArgs e)
 {
     _notify.Dispose();
     _hotkey.Dispose();
     base.OnExit(e);
 }
Пример #11
0
 protected override void OnExit(ExitEventArgs e)
 {
     hotkey1.Dispose();
     base.OnExit(e);
 }