Example #1
0
 private void UpdatePorts(bool scan = true)
 {
     _ports = SerialPort.GetPortNames();
     if (comports.Items.Count == _ports.Length)
     {
         return;
     }
     if (_ports.Length > comports.Items.Count && !scan)
     {
         scan = true;
     }
     comports.DataSource = _ports;
     if (comports.Items.Count > 0 && scan)
     {
         DeviceControl.SetNORWayPort();
         if (comports.SelectedIndex < comports.Items.Count)
         {
             comports.SelectedIndex = 0;
         }
     }
     else if (scan)
     {
         comports.Text = "";
     }
 }
Example #2
0
 private void UpdatePorts()
 {
     _ports = SerialPort.GetPortNames();
     if (comports.Items.Count == _ports.Length)
     {
         return;
     }
     comports.DataSource = _ports;
     if (_ports.Length > comports.Items.Count)
     {
         DeviceControl.SetNORWayPort();
     }
 }