/// <summary>
 /// Registers the hotkey.
 /// </summary>
 /// <param name="hotkeyDescriptor">The hotkey registration.</param>
 /// <param name="callback">The callback.</param>
 public void RegisterHotkey(HotkeyDescriptor hotkeyDescriptor, Action callback)
 {
     var hotkey = GetHotKey(hotkeyDescriptor.Modifiers, hotkeyDescriptor.Key);
     if (null == hotkey)
     {
         hotkey = new HotKey(hotkeyDescriptor.Modifiers, hotkeyDescriptor.Key, HotkeyId);
         registeredHotkeys.Add(hotkey.Id, hotkey);
         HookHotkey(hotkey, hotkey.Id);
     }
     hotkey.RegisterCallback(callback);
 }
        /// <summary>
        /// Registers the hotkey.
        /// </summary>
        /// <param name="hotkeyDescriptor">The hotkey registration.</param>
        /// <param name="callback">The callback.</param>
        public void RegisterHotkey(HotkeyDescriptor hotkeyDescriptor, Action callback)
        {
            var hotkey = GetHotKey(hotkeyDescriptor.Modifiers, hotkeyDescriptor.Key);

            if (null == hotkey)
            {
                hotkey = new HotKey(hotkeyDescriptor.Modifiers, hotkeyDescriptor.Key, HotkeyId);
                registeredHotkeys.Add(hotkey.Id, hotkey);
                HookHotkey(hotkey, hotkey.Id);
            }
            hotkey.RegisterCallback(callback);
        }
 /// <summary>
 /// Res the register hotkey.
 /// </summary>
 /// <param name="oldDescriptor">The old descriptor.</param>
 /// <param name="newDescriptor">The new descriptor.</param>
 /// <param name="callback">The callback.</param>
 public void ReRegisterHotkey(HotkeyDescriptor oldDescriptor,
                              HotkeyDescriptor newDescriptor,
                              Action callback)
 {
     if (null != oldDescriptor)
     {
         UnregisterHotkey(oldDescriptor, callback);
     }
     if (null != newDescriptor)
     {
         RegisterHotkey(newDescriptor, callback);
     }
 }
        /// <summary>
        /// Unregisters the hotkey.
        /// </summary>
        /// <param name="hotkeyDescriptor">The hotkey registration.</param>
        /// <param name="callback">The callback.</param>
        public void UnregisterHotkey(HotkeyDescriptor hotkeyDescriptor, Action callback)
        {
            var hotkey = GetHotKey(hotkeyDescriptor.Modifiers, hotkeyDescriptor.Key);

            if (null == hotkey)
            {
                return;
            }
            hotkey.UnRegisterCallback(callback);
            if (!hotkey.IsEmpty)
            {
                return;
            }
            UnregisterHotKey(source.Handle, hotkey.Id);
            registeredHotkeys.Remove(hotkey.Id);
        }
 /// <summary>
 /// Res the register hotkey.
 /// </summary>
 /// <param name="oldDescriptor">The old descriptor.</param>
 /// <param name="newDescriptor">The new descriptor.</param>
 /// <param name="callback">The callback.</param>
 public void ReRegisterHotkey(HotkeyDescriptor oldDescriptor,
                              HotkeyDescriptor newDescriptor,
                              Action callback)
 {
     if (null != oldDescriptor)
         UnregisterHotkey(oldDescriptor, callback);
     if (null != newDescriptor)
         RegisterHotkey(newDescriptor, callback);
 }
 /// <summary>
 /// Unregisters the hotkey.
 /// </summary>
 /// <param name="hotkeyDescriptor">The hotkey registration.</param>
 /// <param name="callback">The callback.</param>
 public void UnregisterHotkey(HotkeyDescriptor hotkeyDescriptor, Action callback)
 {
     var hotkey = GetHotKey(hotkeyDescriptor.Modifiers, hotkeyDescriptor.Key);
     if (null == hotkey) return;
     hotkey.UnRegisterCallback(callback);
     if (!hotkey.IsEmpty) return;
     UnregisterHotKey(source.Handle, hotkey.Id);
     registeredHotkeys.Remove(hotkey.Id);
 }