/// <summary> /// Populate Drop Down with Serial Port names. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SerialPort_DropDownOpened(object sender, EventArgs e) { SerialPort.Items.Clear(); foreach (var item in SiKInterface.GetSerialPorts()) { SerialPort.Items.Add(item); } }
public MainWindow() { InitializeComponent(); Height = SMALLWNDHEIGHT; RssiFig.Visibility = Visibility.Collapsed; SerialPort.DropDownOpened += SerialPort_DropDownOpened; foreach (var item in SiKInterface.GetSerialPorts()) { SerialPort.Items.Add(item); } foreach (var item in Helpers.SerialRates) { SerialSpeed.Items.Add(item); } SerialSpeed.SelectedItem = 57600; foreach (var item in SiKLink.Constants.SiKSerialRates) { SiKSerialSpeed.Items.Add(item); } foreach (var item in Helpers.MavVersions) { MavlinkFrame.Items.Add(item); } foreach (var item in SiKLink.Constants.AirPower) { AirPower.Items.Add(item); } foreach (var item in Enumerable.Range(1, 100)) { DutyCycle.Items.Add(item); } foreach (var item in Enumerable.Range(0, 255)) { LbtRssi.Items.Add(item); } foreach (var item in Enumerable.Range(33, 99)) { MaxWnd.Items.Add(item); } DataContext = _sikInterface.SiKConfig; }
private void PopulateSerialPortCombo() { var ports = SiKInterface.GetSerialPorts(); ports.Add("<refresh>"); _portNameCombo.RemoveAll(); foreach (var pname in ports) { _portNameCombo.PrependText(pname); } }