如何读取UWP中的QRCode Windows 10应用程序
答
.NET没有类来完成这个你。上述选项是您的应用程序中包含的良好类。 另一种选择是不使用类,而是使用网络上的API,如http://goqr.me/api/doc/read-qr-code/。您可以将图片的网址作为参数发送,然后获取信息。这在基于JavaScript的解决方案中非常有用,因为您不能使用.NET类。
请记住在帮助你的帖子上单击“标记为答案”,如果标记的帖子实际上没有回答你的问题,点击“取消标记为答案”。即使您不是线索的作者,您也可以通过投票来帮助其他人。这可以有益于其他社区成员阅读该主题。
答
你可以试试下面的选项:
条形码扫描仪样品在GitHub上:
https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/BarcodeScanner
您还可以使用ZXing.Net - 你可以从它的NuGet:
答
您可以使用免费的Zxing.Net.Mobile包。有样品你可以看看。
例如在这里,你可以从一个WriteableBitma
这样解析QRCodes:
private async void qrcode(WriteableBitmap bmp)
{
IBarcodeReader reader = new BarcodeReader();
// detect and decode the QRcode inside the writeablebitmap
var result = reader.Decode(bmp);
// do something with the result
if (result != null)
{
//show QRCode's content
txtDecoderType.Text = result.BarcodeFormat.ToString();
txtDecoderContent.Text = result.Text;
}
}