Example #1
0
 /// <summary>
 /// 移除指定的热键.
 /// </summary>
 /// <param name="data"></param>
 /// <returns></returns>
 public bool Remove(HotKeyData data)
 {
     if (_HotMap.ContainsKey(data.ID))
     {
         _HotMap.Remove(data.ID);
         return(HotKeyUtil.UnregisterHotKey(data.Hand, data.ID));
     }
     return(false);
 }
Example #2
0
 /// <summary>
 /// 移除热键.
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public bool Remove(int id)
 {
     if (_HotMap.ContainsKey(id))
     {
         HotKeyData data = _HotMap[id];
         _HotMap.Remove(id);
         return(HotKeyUtil.UnregisterHotKey(data.Hand, data.ID));
     }
     return(false);
 }
Example #3
0
        /// <summary>
        /// 移除所有热键.
        /// </summary>
        /// <returns></returns>
        public bool RemoveAll()
        {
            bool result = true;

            foreach (var item in _HotMap.Values)
            {
                result &= HotKeyUtil.UnregisterHotKey(item.Hand, item.ID);
            }
            return(result);
        }
Example #4
0
 /// <summary>
 /// 向系统注册一个热键.
 /// </summary>
 /// <param name="data">热键的描述信息.</param>
 /// <returns></returns>
 public bool RegisterHotKey(HotKeyData data)
 {
     if (data == null)
     {
         throw new ArgumentNullException("data");
     }
     if (_HotMap.ContainsKey(data.ID))
     {
         _HotMap.Add(data.ID, data);
         return(HotKeyUtil.RegisterHotKey(data.Hand, data.ID, data.Modifiers, data.Key));
     }
     else
     {
         return(false);
     }
 }