How to Capture Smart Card Added and Card Removed Events In Windows Store Apps

I’ve modified the sample smart card app (C# version) and upload the code here 

For more info on smart card and minidriver info, check

image image

1. Capture and Display Card ID

Adding a new property to the code and modify the user interface



2. Respond to user actions – when the card is inserted into the reader or the card is removed from the reader

a) Move most code from ListSmartCard_Click to a private method


b) Add one line code to use current window or page Dispatcher. This line fix the error that would occur, “The application called an interface that was marshaled to a different thread.”

await rootPage.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async () => {


c) Add two lines of code to listen to two events: Reader_CardAdded and Reader_CardRemoved

reader.CardAdded += Reader_CardAdded; // should fire when the card is inserted or touches the reader
reader.CardRemoved += Reader_CardRemoved; // should fire when the card is removed or moves out of range from the reader


That’s all.