using System; using ZXing.Mobile; using Shared; namespace com.hdl.on { public class Scan { public Scan () { } public static void OpenScan (Action 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); } }); } } }