/// <summary>
        /// Call the card detected delegate for each changed reader
        /// </summary>
        /// <param name="state">State class containing the smartcard reader name</param>
        private void FireCardPresentEvent(SmartcardInterop.ScardReaderState state)
        {
            if (this.DebounceState(state.reader, CardEvent.Insert))
            {
                return;
            }

            var cardname = this.FindCardWithAtr(state.atr);
            var scard    = new Smartcard(state.reader, cardname);
            var args     = new SmartcardEventArgs(scard, state.reader);

            this.logger.DebugFormat("Firing card insert event for reader {0}, card {1}", state.reader, cardname);
            this.OnCardInserted?.Invoke(this, args);
        }
Example #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SmartcardEventArgs"/> class.
 /// </summary>
 /// <param name="scard">Smartcard associated with the event</param>
 /// <param name="reader">Smartcard reader that triggered the event</param>
 /// <inheritdoc cref="EventArgs()"/>
 public SmartcardEventArgs(Smartcard scard, string reader)
 {
     this.SmartCard  = scard;
     this.ReaderName = reader;
 }