コード例 #1
0
 public void ConnectToCOMPort(string port)
 {
     Disconnect();
     _comPort = new COMPort(port);
     _comPort.MessageReceived += COMMessageReceived;
     _comPort.StartListening();
     COMConnected(port);
 }
コード例 #2
0
 public void Disconnect()
 {
     if (_comPort == null)
     {
         return;
     }
     var name = _comPort.PortName;
     _comPort.Dispose();
     _comPort = null;
     COMDisconnected(name);
 }