private void btStartService_Click(object sender, EventArgs e) { if (cbxJoystick.CheckedIndices.Count < 1) { RTB.Text += "ERROR: No Joystick selected - cannot start"; return; } btStartService.Enabled = false; cbxJoystick.Enabled = false; // prepare context m_switchPanelSupport.LedChanged = false; m_switchPanelSupport.JoystickNo = 0; m_switchPanelSupport.ConfigFile = txConfigFile.Text; var jsx = cbxJoystick.CheckedItems[0]; string[] js = (jsx as string).Split(new char[] { '#' }); if (js.Length > 1) { m_switchPanelSupport.JoystickNo = int.Parse(js[1]); } RTB.Text = $"Starting Service\n"; // START BGW_Hid.RunWorkerAsync(m_switchPanelSupport); btStopService.Enabled = true; }
private void PFPanel_FormClosing(object sender, FormClosingEventArgs e) { if (m_cancelPending) { return; // had a call before - so just die now } // don't record minimized, maximized forms if (this.WindowState == FormWindowState.Normal) { AppSettings.Instance.FormLocation = this.Location; } AppSettings.Instance.UseKeyboard = cbxKBon.Checked; string s = ""; foreach (var cl in cbxJoystick.CheckedItems) { s += cl.ToString( ) + " "; } AppSettings.Instance.JoystickUsed = s; AppSettings.Instance.ReportEvents = cbxReport.Checked; AppSettings.Instance.Save( ); if (BGW_Hid.IsBusy) { BGW_Hid.CancelAsync( ); m_cancelPending = true; e.Cancel = true; // will close if we finished the worker } }
private void btStopService_Click(object sender, EventArgs e) { btStopService.Enabled = false; BGW_Hid.CancelAsync( ); }