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(); } }
public void SimulateCardTap(string s) { CardConnected?.Invoke(this, s); }
private void _reader_CardConnected(object sender, CardConnectedEventArgs e) { CardConnected?.Invoke(this, e.CardId); }
private void Rfid_CardConnected(object sender, string e) { CardConnected?.Invoke(sender, e); }