Exemplo n.º 1
0
 public static SerialPort Query(IWin32Window owner)
 {
     using (var dlg = new SerialPortSelector())
     {
         if (dlg.ShowDialog(owner) == DialogResult.OK)
         {
             var name = (string)dlg.lbPorts.SelectedItem;
             if (name == null)
             {
                 return(null);
             }
             return(new SerialPort(name, 115200));
         }
         return(null);
     }
 }
Exemplo n.º 2
0
 private void mnuReadAgain_Click(object sender, EventArgs e)
 {
     ReadPortAsync(SerialPortSelector.Query(this));
 }
Exemplo n.º 3
0
        protected override void OnShown(EventArgs e)
        {
            base.OnShown(e);

            ReadPortAsync(SerialPortSelector.Query(this));
        }