Beispiel #1
0
        /// <summary>
        /// Adds a hotkey to the global Key watcher.
        /// </summary>
        /// <param name="hotkey">The hotkey to add.</param>
        /// <returns>
        /// True if successful or false if not. Ensure you inform the user if the hotkey fails to be
        /// registered. This is mostly due to a hotkey being already in use by another application.
        /// </returns>
        public bool Add(Hotkey hotkey)
        {
            if (hotkey.Modifiers == Keys.LWin || hotkey.Modifiers == Keys.RWin)
            {
                return(false);
            }

            return(Add(HotkeyRepresentation.AsString(hotkey)));
        }
Beispiel #2
0
 /// <summary>
 /// Removes any specific hotkey from the global Key watcher.
 /// </summary>
 /// <param name="hotkey">The hotkey to remove.</param>
 public void Remove(Hotkey hotkey)
 {
     _handle.RemoveKey(HotkeyRepresentation.AsString(hotkey));
 }