示例#1
0
 protected virtual void Dispose(bool disposing)
 {
     if (!IsDisposed)
     {
         _globalKeyboardHook.Dispose();
         _winEvent.Dispose();
         IsDisposed = true;
     }
 }
 private void saveHotkeys()
 {
     settings.EnableHotkeys = checkBoxEnableHotkeys.Checked;
     settings.HandleHotkeys = checkBoxHandleHotkeys.Checked;
     foreach (GadgetHotkey hotkey in hotkeys)
     {
         hotkey.Save();
     }
     keyboardHook.Dispose();
 }
示例#3
0
 private void saveHotkeys()
 {
     settings.HotkeysEnable = cbxHotkeysEnable.Checked;
     settings.HotkeysHandle = cbxHotkeysHandle.Checked;
     foreach (GadgetHotkey hotkey in hotkeys)
     {
         hotkey.Save();
     }
     keyboardHook.Dispose();
 }
示例#4
0
 public new void Dispose()
 {
     //Dispose of the keyboard hook
     _globalKeyboardHook.Dispose();
     //Stop the screen grab timer.
     _pixelCheck.Stop();
     _pixelCheck.Dispose();
     //Normal Dispose.
     Dispose(true);
     GC.SuppressFinalize(this);
 }
示例#5
0
 private void NotesForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     tmMetronom.Stop();
     tmSoundPlayer.Stop();
     timerAutoStep.Stop();
     if (_globalKeyboardHook != null)
     {
         _globalKeyboardHook.KeyboardPressed -= _globalKeyboardHook_KeyboardP;
         _globalKeyboardHook?.Dispose();
     }
 }
示例#6
0
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                hook.Dispose();
                hook = null;

                _keyboardHookOnKeyDown = null;
                _keyboardhookOnKeyUp   = null;
            }

            base.Dispose(disposing);
        }
示例#7
0
        public void MultiHook()
        {
            IntPtr wParam = new IntPtr(32);
            IntPtr lParam = new IntPtr(0);

            this.isEventFired = false;
            GlobalKeyboardHook ghk = new GlobalKeyboardHook();

            using (GlobalKeyboardHook tbc = new GlobalKeyboardHook())
            {
                tbc.KeyboardPressed += testMethod;
                Assert.NotNull(tbc);
            }
            Assert.NotNull(ghk);
            ghk.Dispose();
        }
 public void Dispose()
 {
     _globalKeyboardHook?.Dispose();
 }
示例#9
0
 private void Form1_FormClosing(object sender, FormClosingEventArgs e) => _globalKeyboardHook?.Dispose();