/* Serial port */ private void ButtonConnect_Click(object sender, RoutedEventArgs e) { if (ComboBoxCOM.SelectedIndex != -1) /* If serial port selected */ { manager.ConnectTo((string)ComboBoxCOM.SelectedItem); } else { MessageBox.Show("No serial port selected!", "Warning!", MessageBoxButton.OK, MessageBoxImage.Exclamation); } }