Example #1
0
 void Invoke(HotKeyInfo info)
 {
     if (_registry.TryGetValue(info, out info))
     {
         foreach (var handler in info.Handlers)
         {
             handler.Invoke(info);
         }
     }
 }
Example #2
0
        public bool Add(HotKeyInfo info, HotKeyHandler handler)
        {
            if (!_registry.TryGetValue(info, out var existing))
            {
                info.Id = Kernel32.GlobalAddAtom(info.ToString());

                _registry.Add(info);
                _newInfo.Enqueue(info);
                Application.Exit();
            }
            else
            {
                info = existing;
            }

            return(info.Handlers.Add(handler));
        }
Example #3
0
 public void Invoke(HotKeyInfo info)
 {
     Handler(info);
 }
Example #4
0
 public bool Remove(HotKeyInfo info, HotKeyHandler handler)
 {
     return(_registry.TryGetValue(info, out info) ? info.Handlers.Remove(handler) : false);
 }