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; }