Exemplo n.º 1
0
 static KeyInfo()
 {
     KeyInfo tempLocal1 = new KeyInfo
     {
         Modifier = ModifierKey.None,
         Key = SVNMonitor.Helpers.Key.None
     };
     none = tempLocal1;
 }
Exemplo n.º 2
0
 internal static bool IsKeyAvailable(KeyInfo keyInfo)
 {
     bool isAvailable = false;
     try
     {
         Keys realKey = EnumHelper.ParseEnum<Keys>(keyInfo.Key.ToString());
         int id = KeyHook.RegisterHotKey(keyInfo.Modifier, realKey);
         KeyHook.UnregisterHotKey(id);
         isAvailable = true;
     }
     catch (InvalidOperationException)
     {
     }
     catch (Exception ex)
     {
         Logger.Log.Error(string.Format("Error checking for available key: {0}", keyInfo), ex);
     }
     return isAvailable;
 }
Exemplo n.º 3
0
 private void SetKeyInfo(KeyInfo keyInfo)
 {
     checkAlt.Checked = keyInfo.Alt;
     checkControl.Checked = keyInfo.Control;
     checkShift.Checked = keyInfo.Shift;
     checkWin.Checked = keyInfo.Win;
     SetKeyDataSource();
     if (keyInfo.Key == Key.None)
     {
         comboKey.SelectedItem = Strings.KeyNone;
     }
     else
     {
         comboKey.SelectedItem = keyInfo.Key.ToString();
     }
 }
Exemplo n.º 4
0
 private bool IsValidKeyInfo(KeyInfo keyInfo, out KeyboardEditorRow assignedRow)
 {
     if (keyInfo.Equals(KeyInfo.None))
     {
         assignedRow = null;
         return true;
     }
     KeyboardEditorRow currentRow = SelectedRow;
     assignedRow = null;
     if (currentRow == null)
     {
         return false;
     }
     foreach (KeyboardEditorRow row in List.Where(r => r != currentRow))
     {
         if (row.KeyInfo.Equals(keyInfo))
         {
             assignedRow = row;
             return false;
         }
     }
     return true;
 }
Exemplo n.º 5
0
 private static void HandleKey(KeyInfo keyInfo)
 {
     MethodInvoker method = keyActions[keyInfo];
     method();
 }