Example #1
0
 public void Clear()
 {
     foreach (ushort id in this.HotKeyTable.Keys)
     {
         HotKeyManager.UnregisterHotKey(this.Owner.Handle, id);
         GlobalAtom.Delete(id);
     }
     this.HotKeyTable.Clear();
 }
Example #2
0
        public bool Register(ModifierKeys modifierKey, Keys key, HotKeyEventHandler hotKeyEventHandler)
        {
            ushort id = GlobalAtom.Add(this.GetHotKeyName(modifierKey, key));

            if (HotKeyManager.RegisterHotKey(this.Owner.Handle, id, (uint)modifierKey, (uint)key))
            {
                this.HotKeyTable.Add(id, hotKeyEventHandler);
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #3
0
        public bool Unregister(ModifierKeys modifierKey, Keys key)
        {
            ushort id = GlobalAtom.Find(this.GetHotKeyName(modifierKey, key));

            if (this.HotKeyTable.ContainsKey(id))
            {
                if (HotKeyManager.UnregisterHotKey(this.Owner.Handle, id))
                {
                    this.HotKeyTable.Remove(id);
                    GlobalAtom.Delete(id);
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }