public void UnregisterByKey(DDHotkey hotkey)
 {
     if (_hotkeytypelookup.ContainsKey(hotkey))
     {
         this.UnregisterByType(_hotkeytypelookup[hotkey]);
     }
 }
        public void Register(DDHotkeyType type, DDHotkey hotkey)
        {
            this.UnregisterByType(type);
            this.UnregisterByKey(hotkey);

            _hotkeys.Add(type, hotkey);
            _hotkeytypelookup.Add(hotkey, type);
            _hotkeymanager.Register(hotkey.Key, hotkey.Modifier);
        }
        private void _hotkeymanager_KeyPressed(object sender, KeyPressedEventArgs e)
        {
            var kp = new DDHotkey(e.HotKey);

            if (_hotkeytypelookup.ContainsKey(kp))
            {
                switch (_hotkeytypelookup[kp])
                {
                case DDHotkeyType.DialSelectionFromActiveWindow:
                    var numbers = _phonenumbergrabber.TryGrabPhonenumbersFromSelection(Properties.Settings.Default.GrabMinLength);
                    if (numbers.Length > 0)
                    {
                        DialRequest(this, new DialRequestEventArgs(numbers));
                    }
                    break;
                }
            }
        }