public void Detach() { khook.KeyboardEvent -= OnKeyboardEvent; khook.UninstallHook(); khook.Dispose(); khook = null; }
/// <summary> /// Attaches the input provider to listen for the given settings. /// </summary> /// <param name="settings">The settings provided by <see cref="IInputProvider.EndRecord()"/>.</param> public void Attach(IntPtr window, string settings) { if (!String.IsNullOrEmpty (settings)) Parse (settings); khook = new KeyboardHook(); khook.InstallHook(); khook.KeyboardEvent += OnKeyboardEvent; }
public MainForm() { InitializeComponent(); AllowTransparency = true; presenter = new MainFormPresenter(this, new JediSettings()); mouseHook = new MouseHook(); mouseHook.MouseEvent += MouseHookMouseEvent; keyboardHook = new KeyboardHook(); keyboardHook.KeyboardEvent += KeyboardHookKeyboardEvent; mgr.ShortcutActivated += mgr_OnShortcutActivated; keyboardHook.InstallHook(); }
private void MainFormFormClosing(object sender, FormClosingEventArgs e) { Settings.Default["Opacity"] = Opacity; Settings.Default.Save(); Settings.Default.Upgrade(); if (mouseHook != null) { mouseHook.Dispose(); mouseHook = null; } if (keyboardHook != null) { keyboardHook.Dispose(); keyboardHook = null; } }