Example #1
0
        private static string GetEventText(MonitorEvent ev)
        {
            var sb = new StringBuilder();

            sb.Append($"{ev.GetType().Name} - reader: {ev.ReaderName}");
            switch (ev)
            {
            case CardStatusChanged changed:
                sb.AppendLine($", previous state: {changed.PreviousState}, new state: {changed.NewState}");
                break;

            case CardRemoved removed:
                sb.AppendLine($", state: {removed.State}");
                break;

            case CardInserted inserted:
                sb.AppendLine($", state: {inserted.State}, ATR: {BitConverter.ToString(inserted.Atr)}");
                break;

            case MonitorInitialized initialized:
                sb.AppendLine($", state: {initialized.State}, ATR: {BitConverter.ToString(initialized.Atr)}");
                break;

            case MonitorCardInfoEvent infoEvent:
                sb.AppendLine($", state: {infoEvent.State}, ATR: {BitConverter.ToString(infoEvent.Atr)}");
                break;
            }

            return(sb.ToString());
        }
Example #2
0
 private void OnNext(MonitorEvent ev)
 {
     if (ev.GetType().ToString().Contains("CardInserted"))
     {
         String id = GetCardNumber();
         SendToActiveWindow(id);
     }
 }
Example #3
0
 private static void OnNext(MonitorEvent ev)
 {
     Console.WriteLine($"Event type {ev.GetType()}, reader: {ev.ReaderName}");
 }