private async void BLECmb_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (BLECmb.SelectedItem != null) { var bleDevice = (DeviceModel)BLECmb.SelectedItem; await BLEDeviceHandler.ConnectDevice(bleDevice.Id); } }
private void OutRadio_Checked(object sender, RoutedEventArgs e) { if (_outputDevice != null) { _outputDevice.Dispose(); } var radioButton = (RadioButton)sender; SerialOSRSettingsGrid.Visibility = Visibility.Hidden; if (radioButton == OutputAddressRdo) { SettingsHandler.OutputDevice = OSRRemoteOutputMode.Address; if (SettingsHandler.UseUDP) { _outputDevice = OutputUdpAddresshandler; } else { _outputDevice = OutputTcpAddresshandler; } InitOutputNetworkAddress(); } else if (radioButton == OutputSerialRdo) { SettingsHandler.OutputDevice = OSRRemoteOutputMode.Serial; SerialOSRSettingsGrid.Visibility = Visibility.Visible; _outputDevice = OutputSerialDeviceHandler; var selectedValue = OutPutSerialCmb.SelectedValue as string; if (!string.IsNullOrEmpty(selectedValue) && !OutputSerialDeviceHandler.IsRunning) { OutputSerialDeviceHandler.Init(new DeviceInitModel() { Address = selectedValue, Mode = OSRRemoteDeviceMode.Out }); } } else if (radioButton == BLERdo) { SettingsHandler.OutputDevice = OSRRemoteOutputMode.BLE; if (!BLEDeviceHandler.IsRunning) { BLEDeviceHandler.Init(null); } SerialOSRSettingsGrid.Visibility = Visibility.Visible; _outputDevice = BLEDeviceHandler; if (SettingsHandler.ShowBLEMessage) { Log.Dialog("Experimental!!", "BLE only works with the Romeo BLE mini (possible other Bluno devices)\nMay experience issues"); SettingsHandler.ShowBLEMessage = false; } } if (_inputDevice != null) { StartBtn.IsEnabled = _inputDevice.IsConnected && _outputDevice.IsConnected; } }