示例#1
0
 private void Grid_Loaded(object sender, RoutedEventArgs e)
 {
     try
     {
         cbPorts.ItemsSource   = ComPort.GetAllNamesPort();
         cbPorts.SelectedIndex = 0;
         currentPort           = new ComPort(cbPorts.SelectedValue.ToString());
     }
     catch (Exception)
     {
         MessageBox.Show("Отсутствуют доступные COM порты");
     }
 }
示例#2
0
 private void cbPorts_DropDownOpened(object sender, EventArgs e)
 {
     cbPorts.ItemsSource = ComPort.GetAllNamesPort();
 }