private void conn() { if (SelectedDevice != null) { IsConnected = SelectedDevice.OpenDevice(); ConnectedText = IsConnected == true ? "Connected" : "Disconnected"; } else { MessageBox.Show("Please choose device first"); } }