private void okBtn_Click(object sender, EventArgs e) { if (slotCapture.Value == null) { MessageBox.Show("Please click Capture and press a button or axis direction on the gamepad."); return; } var input = slotCapture.Value; OpenFileAction action; if (editing == null) { action = new OpenFileAction(Controller.Core, cmd.Text, onRelease.Checked, showError.Checked); } else { action = editing; action.FileName = cmd.Text; action.OpenOnRelease = onRelease.Checked; action.ErrorDialog = showError.Checked; if (action.SlotDescription != input) { MapUtil.Map(MainForm, Controller.Virtual, action.SlotDescription, null); } } MapUtil.Map(MainForm, Controller.Virtual, input, action); DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); }
public void ClearAction(InputAction action) { if (action == null) { return; } MapUtil.Map(mainForm, controller.Virtual, action.SlotDescription, null); currentMappings_AfterSelect(currentMappings, null); }
private void okBtn_Click(object sender, EventArgs e) { if (slotCapture.Value == null) { MessageBox.Show("Please use the Capture button and press a button or analog direction first."); return; } var slot = slotCapture.Value; var key = Keys.None; List <Keys> mods = new List <Keys>(); if (ctrl.Checked) { mods.Add(Keys.Control); } if (shift.Checked) { mods.Add(Keys.Shift); } if (alt.Checked) { mods.Add(Keys.Menu); } if (meta.Checked) { mods.Add(Keys.LWin); } key = capturedKey; KeyAction action; if (editing != null) { action = editing; action.ChangeBinding(key, mods.ToArray()); if (slot != action.SlotDescription) { MapUtil.Map(MainForm, Controller.Virtual, action.SlotDescription, null); } } else { action = new KeyAction(key, mods.ToArray()); } action.Continuous = continuous.Checked; MapUtil.Map(MainForm, Controller.Virtual, slot, action); this.DialogResult = DialogResult.OK; this.Close(); }
private void okBtn_Click(object sender, EventArgs e) { MouseButtonAction.Buttons b = MouseButtonAction.Buttons.Left; if (mouseButton.Text == "Left") { b = MouseButtonAction.Buttons.Left; } else if (mouseButton.Text == "Middle") { b = MouseButtonAction.Buttons.Middle; } else if (mouseButton.Text == "Right") { b = MouseButtonAction.Buttons.Right; } else if (mouseButton.Text.StartsWith("Extra 1")) { b = MouseButtonAction.Buttons.Back; } else if (mouseButton.Text.StartsWith("Extra 2")) { b = MouseButtonAction.Buttons.Forward; } if (slotCapture.Value == null) { MessageBox.Show("Please click Capture and press a button or axis direction on the gamepad."); return; } var input = slotCapture.Value; InputAction action; if (editing != null) { editing.Button = b; if (input != editing.SlotDescription) { MapUtil.Map(MainForm, Controller.Virtual, editing.SlotDescription, null); } action = editing; } else { action = new MouseButtonAction(Controller.Core, b); } MapUtil.Map(MainForm, Controller.Virtual, input, action); DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); }
private void okBtn_Click(object sender, EventArgs e) { int x, y; try { x = int.Parse(motionX.Text); y = int.Parse(motionY.Text); } catch (Exception) { MessageBox.Show("The X/Y coordinates must be positive or negative whole numbers."); return; } if (slotCapture.Value == null) { MessageBox.Show("Please click Capture and press a button or axis direction on the gamepad."); return; } var input = slotCapture.Value; MousePointerAction action; if (editing == null) { action = new MousePointerAction(Controller.Core, x, y); } else { action = editing; action.X = x; action.Y = y; if (action.SlotDescription != input) { MapUtil.Map(MainForm, Controller.Virtual, action.SlotDescription, null); } } action.Continuous = continuous.Checked; action.UseIntensity = useIntensity.Checked; MapUtil.Map(MainForm, Controller.Virtual, input, action); DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); }
private void okBtn_Click(object sender, EventArgs e) { if (slotCapture.Value == null) { MessageBox.Show("Please click Capture and press a button or axis direction on the gamepad."); return; } var input = slotCapture.Value; RunCommandAction action; if (editing == null) { action = new RunCommandAction(Controller.Core, cmd.Text, args.Text, onRelease.Checked); } else { action = editing; action.Command = cmd.Text; action.Arguments = args.Text; action.RunOnRelease = onRelease.Checked; if (action.SlotDescription != input) { MapUtil.Map(MainForm, Controller.Virtual, action.SlotDescription, null); } } action.WorkingDirectory = workDir.Text; action.ErrorDialog = showError.Checked; try { action.WindowStyle = (ProcessWindowStyle)Enum.Parse(typeof(ProcessWindowStyle), startAs.Text); } catch (Exception) { action.WindowStyle = ProcessWindowStyle.Normal; } MapUtil.Map(MainForm, Controller.Virtual, input, action); DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); }