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; } }