示例#1
0
 private void InputPopup_KeyDown(object sender, KeyEventArgs e)
 {
     if (InputMode == "Keyboard")
     {
         timer1.Stop();
         Inputs.InputDictionary[InputLabel.Text.ToString()] = new KeyValuePair <string, string>("Keyboard", e.KeyCode.ToString());
         InputConfig InputConfigureForm = (InputConfig)Application.OpenForms["InputConfig"];
         //int InputIndex = 0;
         //switch (InputLabel.Text.ToString())
         //{
         //    case "B":
         //        InputIndex = 0;
         //        break;
         //    case "A":
         //        InputIndex = 1;
         //        break;
         //    case "Select":
         //        InputIndex = 2;
         //        break;
         //    case "Start":
         //        InputIndex = 3;
         //        break;
         //    case "Up":
         //        InputIndex = 4;
         //        break;
         //    case "Down":
         //        InputIndex = 5;
         //        break;
         //    case "Left":
         //        InputIndex = 6;
         //        break;
         //    case "Right":
         //        InputIndex = ;
         //        break;
         //}
         if (Inputs.InputKeyBoardDictionary.ContainsKey(e.KeyCode.ToString()))
         {
             Inputs.InputKeyBoardDictionary[e.KeyCode.ToString()] = InputLabel.Text.ToString();
         }
         else
         {
             Inputs.InputKeyBoardDictionary.Add(e.KeyCode.ToString(), InputLabel.Text.ToString());
         }
         InputConfigureForm.LoadMappedInputs();
         InputConfigureForm.Show();
         this.Close();
     }
 }
示例#2
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            if (controller.IsConnected == true)
            {
                var CurrentGamepadFlags         = controller.GetState();
                GamepadButtonFlags Gamepadflags = new GamepadButtonFlags();
                if (CurrentGamepadFlags.Gamepad.Buttons != Gamepadflags)
                {
                    string ButtonPressed = CurrentGamepadFlags.Gamepad.Buttons.ToString().Split(',')[0];
                    timer1.Stop();
                    Inputs.InputDictionary[InputLabel.Text.ToString()] = new KeyValuePair <string, string>(controller.GetType().Name, ButtonPressed);

                    Configuration ControllerConfiguration = ConfigurationManager.OpenExeConfiguration(Application.ExecutablePath);
                    ControllerConfiguration.AppSettings.Settings.Remove(InputLabel.Text.ToString());
                    ControllerConfiguration.AppSettings.Settings.Add(InputLabel.Text.ToString(), controller.GetType().Name + "," + ButtonPressed);
                    ControllerConfiguration.Save(ConfigurationSaveMode.Minimal);

                    InputConfig InputConfigureForm = (InputConfig)Application.OpenForms["InputConfig"];
                    InputConfigureForm.LoadMappedInputs();
                    InputConfigureForm.Show();
                    this.Close();
                }
            }
        }
示例#3
0
        private void InputConfigurationToolStripMenuItem_Click(object sender, EventArgs e)
        {
            InputConfig InputConfigurationForm = new InputConfig();

            InputConfigurationForm.ShowDialog();
        }