private void Form1_FormClosed(object sender, FormClosedEventArgs e) { if (joystickHelper != null) { joystickHelper.StopCapture(); } Environment.Exit(0); }
private void Form1_Load(object sender, EventArgs e) { JoystickHelper helper = new JoystickHelper(); List <JoystickDescriptor> joysticks = helper.DetectDevices(); foreach (JoystickDescriptor jd in joysticks) { gamepadsComboBox.Items.Add(jd); } if (joysticks.Count > 0) { gamepadsComboBox.SelectedIndex = 0; } else { MessageBox.Show("Cannot find any gamepads"); loadConfigButton.Enabled = false; saveConfigButton.Enabled = false; } helper.StopCapture(); buttonNames = new string[] { "A", "B", "X", "Y", "LShoulder", "RShoulder", "Select", "Start", "LTrigger", "RTrigger" }; buttonTextBoxes = new TextBox[] { ATextbox, BTextbox, XTextbox, YTextbox, LSTextbox, RSTextbox, SelectTextbox, StartTextbox, LTTextbox, RTTextbox }; tryToAutomaticallyLoadConfigFile(); string appDataFolderPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); string oriProfileFolder = appDataFolderPath + "\\" + "Ori and the Blind Forest DE"; saveFileDialog1.InitialDirectory = oriProfileFolder; }