private void JoystickCombo_SelectedIndexChanged(object sender, EventArgs e) { if (joystick != null) { joystick.Stop(); } joystick = new MyJoystick(joystickList[JoystickCombo.SelectedIndex].InstanceGuid); joystick.JoystickEvent += Joystick_JoystickEvent; }
private void ThrottleCombo_SelectedIndexChanged(object sender, EventArgs e) { if (throttle != null) { throttle.Stop(); } throttle = new MyJoystick(joystickList[ThrottleCombo.SelectedIndex].InstanceGuid); throttle.JoystickEvent += Throttle_JoystickEvent; }
public MainForm() { InitializeComponent(); wifiBridge = WifiBridge.getInstance(); joystickList = MyJoystick.GetJoysticks(); List <String> joystickStirngs = new List <String>(); FormClosing += MainForm_FormClosing; timer = new System.Timers.Timer(60); timer.Elapsed += Timer_Elapsed; timer.AutoReset = true; timer.Start(); foreach (var j in joystickList) { joystickStirngs.Add(j.InstanceName); JoystickCombo.Items.Add(j.InstanceName); ThrottleCombo.Items.Add(j.InstanceName); } }