コード例 #1
0
 public void Detach()
 {
     khook.KeyboardEvent -= OnKeyboardEvent;
     khook.UninstallHook();
     khook.Dispose();
     khook = null;
 }
コード例 #2
0
        /// <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;
        }
コード例 #3
0
        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();
        }
コード例 #4
0
        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;
            }
        }