ZXing.Net.Mobile扫描不会触发 [英] ZXing.Net.Mobile scan doesn't trigger

查看:67
本文介绍了ZXing.Net.Mobile扫描不会触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在尝试将组件实现到我构建的Android应用程序中与Xamarins mono一起用于Andriod.

I'm currently trying to implement this compontent into my android application built with Xamarins mono for andriod.

我遇到了一个问题,我无法从 scanner.Scan(); 方法返回任何结果,扫描仪启动,什么也没发生?

I'm having this issue that I can't get any result returned back from the scanner.Scan(); method, the scanner starts and nothing happens?!

因此,我尝试从 github 下载示例项目,并且在尝试扫描时使用示例代码提供的条形码存在相同的问题.它不会开火.以下是负责启动扫描仪并处理结果的一些代码:

So I've tried downloading the sample projects from github and when I try scanning barcodes using the sample code provided there it's the same problem. It will not fire. Here is some of the code responsible for starting the scanner and handeling the result:

public async void ScanArticleNumber()
        {
            //Tell our scanner to use the default overlay
            scanner.UseCustomOverlay = false;

            //We can customize the top and bottom text of the default overlay
            scanner.TopText = "Hold the camera up to the barcode\nAbout 6 inches away";
            scanner.BottomText = "Wait for the barcode to automatically scan!";

            //Start scanning
            var result = await scanner.Scan();

            HandleScanResult(result);
        }

void HandleScanResult(ZXing.Result result)
        {
            string msg = "";

            if (result != null && !string.IsNullOrEmpty(result.Text))
                msg = "Found Barcode: " + result.Text;
            else
                msg = "Scanning Canceled!";

            Activity.RunOnUiThread(() =>
            {
                Toast.MakeText(Activity.BaseContext, msg, ToastLength.Short).Show();
            });
        }

即使我用相机拍摄大量条形码,代码也永远不会到达HandleScanResult方法.

The code never reaches the HandleScanResult method even tho I'm shooting loads of barcodes with the camera.

有什么想法吗?

推荐答案

问题通过从

Problem was solved by downloadning the latest version of ZXing.Net.Mobile from Github and then running that sample project and taking the following dlls from the bin folder:

  • ZXing.Net.Mobile.dll
  • zxing.monoandroid.dll
  • Xamarin.Android.Support.v4.dll

我用这些替换了我当前的ddls,它起作用了!这可能是因为我最初是从 xamarin组件下载dll的,可能不是最新的.

I replaced my current ddls with these and it worked! This is probably because I from first downloaded the dlls from xamarin components, the files was probably not up to date.

希望这会有所帮助.

这篇关于ZXing.Net.Mobile扫描不会触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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