Example #1
0
 private void HotkeysActivate()
 {
     if (KeePassLib.Native.NativeLib.IsUnix())
     {
         return;
     }
     PTHotKeyManager.HotKeyPressed += HotKeyPressed;
     if (Config.AATHotkey != Keys.None)
     {
         Config.AATHotkeyID = PTHotKeyManager.RegisterHotKey(Config.AATHotkey);
         if (Config.AATHotkeyID == 0)
         {
             Tools.ShowError(string.Format(PluginTranslate.ErrorHotKeyAAT, Config.AATHotkey.ToString()));
         }
     }
     if ((Config.PWOnlyHotkey != Keys.None) && !Config.KPAutoTypePWPossible)
     {
         Config.PWOnlyHotkeyID = PTHotKeyManager.RegisterHotKey(Config.PWOnlyHotkey);
         if (Config.PWOnlyHotkeyID == 0)
         {
             Tools.ShowError(string.Format(PluginTranslate.ErrorHotKeyPWOnly, Config.PWOnlyHotkey.ToString()));
         }
     }
     if (Config.UsernameOnlyHotkey != Keys.None)
     {
         Config.UsernameOnlyHotkeyID = PTHotKeyManager.RegisterHotKey(Config.UsernameOnlyHotkey);
         if (Config.UsernameOnlyHotkeyID == 0)
         {
             Tools.ShowError(string.Format(PluginTranslate.ErrorHotKeyUsernameOnly, Config.UsernameOnlyHotkey.ToString()));
         }
     }
 }
 private static void SetHotkey(Keys value)
 {
     PTHotKeyManager.UnregisterHotKey(HotkeyID);
     Program.Config.CustomConfig.SetString(Config_Hotkey, value.ToString());
     if (value != Keys.None)
     {
         HotkeyID = PTHotKeyManager.RegisterHotKey(value);
     }
 }