Exemplo n.º 1
0
        private void finalMeasure(object sender, FormClosedEventArgs e)
        {
            if (ops != null)
            {
                if (rb != null) //if record macro is open
                {
                    if (!rb.saved && rb.macros.Count > 0)
                    {
                        if (MessageBox.Show(Properties.Resources.SaveRecordedMacro, "DS4Windows", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
                        {
                            rb.btnSave_Click(this, null);
                        }
                    }
                }
                if (lBMacroOn.Visible)
                {
                    string extras = null;
                    if (IsUsingExtras())
                    {
                        extras = GetExtras();
                    }

                    KeyValuePair <object, string> tag = new KeyValuePair <object, string>(macrostag.ToArray(), extras);
                    ops.ChangeButtonText(button, rBShiftModifer.Checked, tag, cBScanCode.Checked, false, lBMacroOn.Visible, macrorepeat, cBShiftButton.SelectedIndex);
                }
                else if (!newaction)
                {
                    string extras = null;
                    if (IsUsingExtras())
                    {
                        extras = GetExtras();
                    }

                    int    value;
                    object tt       = Global.GetDS4Action(device, button.Name, rBShiftModifer.Checked);
                    bool   tagisint = tt != null &&
                                      int.TryParse(tt.ToString(), out value);
                    bool scanavail  = tagisint;
                    bool toggleavil = tagisint;
                    KeyValuePair <object, string> tag;
                    if (tt is X360Controls)
                    {
                        tag = new KeyValuePair <object, string>(getX360ControlsByName((X360Controls)tt, Global.outDevTypeTemp[device]), extras);
                    }
                    else
                    {
                        tag = new KeyValuePair <object, string>(tt, extras);
                    }
                    ops.ChangeButtonText(button, rBShiftModifer.Checked, tag, (scanavail ? cBScanCode.Checked : false), (toggleavil ? cBToggle.Checked : false), lBMacroOn.Visible, macrorepeat, cBShiftButton.SelectedIndex);
                }
                //ops.Toggle_Bn((scanavail ? cBScanCode.Checked : false), (toggleavil ? cBToggle.Checked : false), lBMacroOn.Visible, macrorepeat);
                ops.UpdateLists();
            }
            else if (sA != null)
            {
                if (button.Tag != null)
                {
                    int key;
                    if (int.TryParse(button.Tag.ToString(), out key))
                    {
                        button.Text = ((Keys)key).ToString() +
                                      (cBScanCode.Checked ? " (SC)" : "") +
                                      (cBToggle.Checked ? " (Toggle)" : "");
                    }
                }
                //button.Font = new Font(button.Font, (cBScanCode.Checked ? FontStyle.Bold : FontStyle.Regular) | (cBToggle.Checked ? FontStyle.Italic : FontStyle.Regular));
            }
        }