wxr
2020-06-15 b8e94316e41eba72d927d5ca7d931b26139ee8ff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using System;
using Shared;
using ZXing.Mobile;
 
namespace HDL_ON
{
    public class Scan
    {
        public Scan()
        {
        }
        public static void OpenScan(Action<string> action)
        {
 
            var scanner = new MobileBarcodeScanner(BaseViewController.Instance) { };
            // ZXing  
            scanner.UseCustomOverlay = false;
            // 底部两个按钮文字  
            scanner.FlashButtonText = "";//"识别";
            scanner.CancelButtonText = Language.CurrentLanguage == "Chinese" ? "取消" : "Cancel";
 
            // 方框上,下方文字提示  
            //scanner.TopText = Language.CurrentLanguage == "Chinese" ? "请将条形码对准方框内" : "Please align the bar code in the scan box";
            scanner.BottomText = "";
 
            // 延时三秒自动扫秒  
            var opt = new MobileBarcodeScanningOptions();
            opt.DelayBetweenContinuousScans = 3000;
            scanner.ScanContinuously(opt, (obj) => {
                scanner.Cancel();
                if (action != null)
                {
                    action(obj.Text);
                }
            });
        }
    }
}