示例#1
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));
        }
示例#2
0
 public bool Remove(HotKeyInfo info, HotKeyHandler handler)
 {
     return(_registry.TryGetValue(info, out info) ? info.Handlers.Remove(handler) : false);
 }