Beispiel #1
0
 public HotkeyModel GetRegistedHotkey(string hotkeyName)
 {
     if (RegistedHotKey.ContainsKey(hotkeyName))
     {
         return(RegistedHotKey[hotkeyName]);
     }
     return(null);
 }
Beispiel #2
0
 public void UnregistAllHotkey()
 {
     foreach (var obj in RegistedHotKey)
     {
         HotkeyRegister.UnRegist(obj.Key);
     }
     RegistedHotKey.Clear();
     RegistedHotkeyAction.Clear();
 }
Beispiel #3
0
 public void UnregistHotkey(string hotkeyName)
 {
     if (RegistedHotKey.ContainsKey(hotkeyName))
     {
         RegistedHotKey.Remove(hotkeyName);
         HotkeyRegister.UnRegist(hotkeyName);
     }
     if (RegistedHotkeyAction.ContainsKey(hotkeyName))
     {
         RegistedHotkeyAction.Remove(hotkeyName);
     }
 }
Beispiel #4
0
        public void RegistHotkey(string hotkeyName, HotkeyModel keyModel)
        {
            RegistedHotKey[hotkeyName] = keyModel;

            try
            {
                HotkeyRegister.Regist(hotkeyName, keyModel, () =>
                {
                    InvokeHotkeyAction(hotkeyName);
                });
            }
            catch (NHotkey.HotkeyAlreadyRegisteredException)
            {
                RegistedHotKey.Remove(hotkeyName);
                throw new Exception("Register failed");
            }
        }