Ejemplo n.º 1
0
 private void OpenPortIfAvailable()
 {
     if (_watcher.ComPorts.Any(p => p == "COM7"))
     {
         if (sp != null)
         {
             sp.Dispose();
         }
         sp = new SerialPort("COM7");
         sp.DataReceived += (oo, ee) =>
         {
             string indata = sp.ReadExisting();
             var    id     = indata.Trim(new char[] { '\r', '\n' });
             CardConnected?.Invoke(this, id);
             CardDisconnected?.Invoke(this, id);
         };
         sp.Open();
     }
 }
 private void _reader_CardDisconnected(object sender, CardConnectedEventArgs e)
 {
     CardDisconnected?.Invoke(this, e.CardId);
 }
 private void Rfid_CardDisconnected(object sender, string e)
 {
     CardDisconnected?.Invoke(sender, e);
 }