Example #1
0
        void ConnectButton_Click(object sender, RoutedEventArgs e)
        {
            string portName = (string)((ComboBoxItem)PortComboBox.SelectedItem).Content;

            _driver = new RS485MasterDriver();
            _driver.Open(portName, 9600);

            TransDriver.Set(_driver);

            // UartTest();
        }
Example #2
0
 private void UpdatePorts()
 {
     PortComboBox.Items.Clear();
     string[] portNames = RS485MasterDriver.GetList();
     foreach (string str in portNames)
     {
         ComboBoxItem item = new ComboBoxItem();
         item.Content = str;
         PortComboBox.Items.Add(item);
     }
     if (PortComboBox.Items.Count > 0)
     {
         PortComboBox.SelectedIndex = 0;
     }
 }