private void button1_Click(object sender, EventArgs e) { if (FormHelp.testSerialPort((string)listBox1.SelectedItem)) { button1.BackColor = Color.Green; GotWorkingPort = true; Port = (string)listBox1.SelectedItem; } else { button1.BackColor = Color.Red; GotWorkingPort = false; } }
private bool testSerialPort(string port) { return(FormHelp.testSerialPort(port)); }