[UWP] BarcodeScanner启用/禁用问题 [英] [UWP]BarcodeScanner Enable/Disable problem

查看:104
本文介绍了[UWP] BarcodeScanner启用/禁用问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为带有条形码扫描仪的Windows 10移动设备开发应用程序。


除启用/禁用外,一切正常。

如果我调用DisableAsync(),扫描器实际上是禁用,这没关系。

然后,如果我调用EnableAsync(),扫描仪不启用

你知道这是什么问题吗?

如果禁用扫描仪,如何重新启用扫描仪?

我根据本文档为windows.devices.pointofservice.claimedbarcodescanner调用API

I am developing an application for a Windows 10 Mobile device with a barcode scanner.
Everything is working correctly except Enable/Disable.
If I call DisableAsync(), the scanner actually Disables, and this is OK.
Then if I call EnableAsync(), the scanner does not enable
Do you know what is the problem?
How can I re-enable the scanner if I disable it?
I am calling the API according to this documentation for windows.devices.pointofservice.claimedbarcodescanner

我找到了解决方法,但我担心它只是偶然的,我将来会遇到问题。

I did find a workaround but I am afraid it works just by chance, and I can get problems in the future.

如果我打电话:

DisableAsync() ;

DisableAsync();

EnableAsync();

EnableAsync();

DisableAsync();

DisableAsync();

EnableAsync();

EnableAsync();

然后它会启用扫描仪。

推荐答案

Hello
FilipeMad,

您的项目目标框架版本是什么?移动设备的系统版本是什么?

What's your project target framework version and what is your mobile device's system version?

要解决此问题,我认为我们需要检查两件事:

To troubleshoot this issue I think we need to check two things:

1。请检查这是否是特定于设备的问题。那么您是否可以切换新的
BarcodeScanner进行测试。

1. Please check whether this is device specific issue. So is it possible for you to switch a new BarcodeScanner to test.

2。如果是与代码相关的问题。我想你可以尝试调试上面工作的代码:

2. If it is a code related issue. I think you may try debug the above worked code:

DisableAsync();

EnableAsync();

DisableAsync();

EnableAsync();

请尝试插入断点并查看方法是否已执行。如果上述代码有效,请检查上述所有方法是否已执行。我想这可能是一个线程问题。

Please try insert breakpoints and see if the method has executed. If the above code works, please check that all the above method has executed. I'm thinking that maybe this is a thread problem.

祝你好运,

Barry

< span name ="x_x_subject">


这篇关于[UWP] BarcodeScanner启用/禁用问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆