Exemple #1
0
 private void Form1_Closed(object sender, EventArgs e)
 {
     if (_mySerialPort != null)
     {
         _mySerialPort.Dispose();
         _mySerialPort = null;
     }
 }
Exemple #2
0
 private void btn_Stop_Click(object sender, EventArgs e)
 {
     if (_mySerialPort != null)
     {
         _mySerialPort.Dispose();
         _mySerialPort = null;
     }
 }
Exemple #3
0
 private void btn_Start_Click(object sender, EventArgs e)
 {
     _mySerialPort = new MySerialPort("COM9:");
     _mySerialPort.eventOnMessage      += new MySerialPort.delegateOnMessage(_mySerialPort_eventOnMessage);
     _mySerialPort.eventOnConnectEvent += new MySerialPort.delegateOnConnect(_mySerialPort_eventOnConnectEvent);
 }