void Current_KeyEventLowLevel(KeyCombination keyCombination) { checkBoxKeyboardControl.Checked = false; checkBoxKeyboardShift.Checked = false; checkBoxKeyboardAlt.Checked = false; checkBoxKeyboardLWin.Checked = false; checkBoxKeyboardRWin.Checked = false; foreach (KeysWithExtended key in keyCombination.Modifiers) { if (key.IsControlKey) { checkBoxKeyboardControl.Checked = true; } if (key.IsShiftKey) { checkBoxKeyboardShift.Checked = true; } if (key.IsAltKey) { checkBoxKeyboardAlt.Checked = true; } if (key.IsLWinKey) { checkBoxKeyboardLWin.Checked = true; } if (key.IsRWinKey) { checkBoxKeyboardRWin.Checked = true; } } comboBoxKeyboardKey.Text = NiceKeyName.GetName(keyCombination.KeyWithExtended.Keys); checkBoxKeyboardExtended.Checked = keyCombination.KeyWithExtended.Extended; }
private void ActionPropertiesDialog_Load(object sender, EventArgs e) { if (Action != null) { // Launch Application textBoxLaunchApplication.Text = Action.LaunchApplication.Command; if (Action.LaunchApplication.WaitForInputIdle) { radioButtonLaunchApplicationWaitForInputIdle.Checked = true; } else if (Action.LaunchApplication.WaitForExit) { radioButtonLaunchApplicationWaitForExit.Checked = true; } else { radioButtonLaunchApplicationDoNotWait.Checked = true; } // Keyboard checkBoxKeyboardControl.Checked = Action.Keyboard.Control; checkBoxKeyboardShift.Checked = Action.Keyboard.Shift; checkBoxKeyboardAlt.Checked = Action.Keyboard.Alt; checkBoxKeyboardLWin.Checked = Action.Keyboard.LWin; checkBoxKeyboardRWin.Checked = Action.Keyboard.RWin; comboBoxKeyboardKey.Text = NiceKeyName.GetName(Action.Keyboard.VirtualKey); checkBoxKeyboardExtended.Checked = Action.Keyboard.Extended; numericUpDown1.Value = Action.Keyboard.RepeatCount; // Window Message textBoxProcessName.Text = Action.WindowMessage.ProcessName; textBoxWindowName.Text = Action.WindowMessage.WindowName; textBoxWindowClass.Text = Action.WindowMessage.WindowClass; if (Action.WindowMessage.NotFoundAction == SettingsKeyboardKeyActionType.WindowMessage) { comboBoxNotFound.Text = "do nothing"; } else { comboBoxNotFound.Text = Action.WindowMessage.NotFoundAction.ToString(); } textBoxMessageID.Text = Action.WindowMessage.Message.ToString(); textBoxWParam.Text = Action.WindowMessage.WParam.ToString(); textBoxLParam.Text = Action.WindowMessage.LParam.ToString(); // Active tab foreach (TabPage page in tabControl1.TabPages) { if ((SettingsKeyboardKeyActionType)page.Tag == Action.ActionType) { tabControl1.SelectedTab = page; } } } else { tabControl1.Enabled = false; } }
public override string ToString() { if (this.Extended) { return("^" + NiceKeyName.GetName(this.Keys)); } else { return(NiceKeyName.GetName(this.Keys)); } }
public static KeysWithExtended Parse(string s) { KeysWithExtended result = new KeysWithExtended(0); if (s.StartsWith("^")) { s = s.Substring(1); result.Extended = true; } result.Keys = NiceKeyName.GetKey(s); return(result); }
private void buttonOK_Click(object sender, EventArgs e) { if (Action != null) { // Launch Application Action.LaunchApplication.Command = textBoxLaunchApplication.Text; Action.LaunchApplication.WaitForInputIdle = radioButtonLaunchApplicationWaitForInputIdle.Checked; Action.LaunchApplication.WaitForExit = radioButtonLaunchApplicationWaitForExit.Checked; // Keyboard Action.Keyboard.Control = checkBoxKeyboardControl.Checked; Action.Keyboard.Shift = checkBoxKeyboardShift.Checked; Action.Keyboard.Alt = checkBoxKeyboardAlt.Checked; Action.Keyboard.LWin = checkBoxKeyboardLWin.Checked; Action.Keyboard.RWin = checkBoxKeyboardRWin.Checked; Keys key = NiceKeyName.GetKey(comboBoxKeyboardKey.Text); Action.Keyboard.VirtualKey = key; Action.Keyboard.Extended = checkBoxKeyboardExtended.Checked; Action.Keyboard.RepeatCount = (int)numericUpDown1.Value; // Window Message Action.WindowMessage.ProcessName = textBoxProcessName.Text; Action.WindowMessage.WindowName = textBoxWindowName.Text; Action.WindowMessage.WindowClass = textBoxWindowClass.Text; if (comboBoxNotFound.Text == "do nothing") { Action.WindowMessage.NotFoundAction = SettingsKeyboardKeyActionType.WindowMessage; } else { Action.WindowMessage.NotFoundAction = (SettingsKeyboardKeyActionType)Enum.Parse(typeof(SettingsKeyboardKeyActionType), comboBoxNotFound.Text); } Action.WindowMessage.Message = parseUIntOrHex(textBoxMessageID.Text); Action.WindowMessage.WParam = parseUIntOrHex(textBoxWParam.Text); Action.WindowMessage.LParam = parseUIntOrHex(textBoxLParam.Text); // Active ActionType Action.ActionType = (SettingsKeyboardKeyActionType)tabControl1.SelectedTab.Tag; } }