Exemple #1
0
        public MapCommandDialog(PadTieForm main, Controller cc, RunCommandAction editing) :
            this(main, cc)
        {
            this.editing      = editing;
            cmd.Text          = editing.Command;
            args.Text         = editing.Arguments;
            onRelease.Checked = editing.RunOnRelease;
            workDir.Text      = editing.WorkingDirectory;
            if (editing.WindowStyle == ProcessWindowStyle.Normal)
            {
                startAs.SelectedIndex = 0;
            }
            else if (editing.WindowStyle == ProcessWindowStyle.Maximized)
            {
                startAs.SelectedIndex = 1;
            }
            else if (editing.WindowStyle == ProcessWindowStyle.Minimized)
            {
                startAs.SelectedIndex = 2;
            }
            else if (editing.WindowStyle == ProcessWindowStyle.Hidden)
            {
                startAs.SelectedIndex = 3;
            }
            showError.Checked = editing.ErrorDialog;

            slotCapture.SetInput(editing.SlotDescription);
        }
Exemple #2
0
        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();
        }