SmartCardReader 不会触发 CardAdded 方法?
Posted
技术标签:
【中文标题】SmartCardReader 不会触发 CardAdded 方法?【英文标题】:SmartCardReader won't fire CardAdded method? 【发布时间】:2016-08-24 06:58:27 【问题描述】:我正在尝试让 Microsoft 手机在轻按 NFC 标签时触发并触发事件。但是,当标签被点击时,该方法不会触发。 cardReader_CardAdded 应该在标签被点击时触发,但它什么也不做。 代码如下:
public MainPage()
this.InitializeComponent();
smartCard();
public async void smartCard()
string selector = SmartCardReader.GetDeviceSelector();
DeviceInformationCollection devices = await DeviceInformation.FindAllAsync(selector);
foreach (DeviceInformation device in devices)
SmartCardReader reader = await SmartCardReader.FromIdAsync(device.Id);
reader.CardAdded += cardReader_CardAdded;
reader.CardRemoved += cardReader_CardRemoved;
private void cardReader_CardRemoved(SmartCardReader sender, CardRemovedEventArgs args)
private async void cardReader_CardAdded(SmartCardReader sender, CardAddedEventArgs args)
await HandleCard(args.SmartCard);
private async Task HandleCard(SmartCard card)
SmartCardProvisioning provisioning = await SmartCardProvisioning.FromSmartCardAsync(card);
SmartCardStatus status;
do
status = await provisioning.SmartCard.GetStatusAsync();
while (status == SmartCardStatus.Shared);
【问题讨论】:
【参考方案1】:回答:我忘记在 Package.appxmanifest 中的 Capabilities 下启用 Proximity
【讨论】:
以上是关于SmartCardReader 不会触发 CardAdded 方法?的主要内容,如果未能解决你的问题,请参考以下文章
每次开机都有smartcard reader,怎么能给去除?
Material-UI List 作为 Card 的子项,在主展开时触发所有 onClick