Beispiel #1
0
        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;
            }
        }
Beispiel #2
0
        private void RefreshCSerialPorts_Click(object sender, RoutedEventArgs e)
        {
            var refreshedPorts = OutputSerialDeviceHandler.GetPorts();

            SerialPorts.Clear();
            foreach (var port in refreshedPorts)
            {
                SerialPorts.Add(port);
            }
        }
Beispiel #3
0
 private void OutPutSerialCmb_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (OutPutSerialCmb.IsLoaded)
     {
         OutputSerialDeviceHandler.Dispose();
         OutputSerialDeviceHandler.Init(new DeviceInitModel()
         {
             Address = OutPutSerialCmb.SelectedValue as string, Mode = OSRRemoteDeviceMode.Out
         });
     }
 }