Exemple #1
0
 private void butReadMem_Click(object sender, EventArgs e)
 {
     COM c = null;
     try
     {
         c = new COM(port, baud);
         c.ReadGPOVal(radioOn1, radioOff1, trackBar1, label1, 1, false);
         c.ReadGPOVal(radioOn2, radioOff2, trackBar2, label2, 2, false);
         c.ReadGPOVal(radioOn3, radioOff3, trackBar3, label3, 3, false);
         c.ReadGPOVal(radioOn4, radioOff4, trackBar4, label4, 4, false);
         c.ReadGPOVal(radioOn5, radioOff5, trackBar5, label5, 5, false);
     }
     catch (COMException ex)
     {
         ex.Show(this);
     }
     catch (Exception ex)
     {
         MessageBox.Show(this, "The COM port caused an error:\n" + ex.Message, "COM Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     finally { if (c != null) c.Close(); }
 }