| | |
| | | public void OpenScan(Action<string> action) |
| | | { |
| | | resultAction = action; |
| | | //string cancel = "取消"; |
| | | //string flashText = ""; |
| | | //string titleText = "二维码扫描"; |
| | | //if (Language.CurrentLanguage != "Chinese") |
| | | //{ |
| | | // cancel = "Cancel"; |
| | | // flashText = ""; |
| | | // titleText = "Scan"; |
| | | //} |
| | | |
| | | ((BaseActivity)Shared.Application.Activity).SetCamera(async (obj) => |
| | | { |
| | |
| | | |
| | | HDL_ON_Android.ScanActivity.InitDdd(this); |
| | | |
| | | //MobileBarcodeScanner.Initialize(Shared.Application.Activity.Application); |
| | | //var mZXingCustomScanView = new ZXingCustomScanView(Shared.Application.Activity.Application); |
| | | //mZXingCustomScanView.cancelTextView.Text = cancel; |
| | | //mZXingCustomScanView.flashTextView.Text = flashText; |
| | | //mZXingCustomScanView.titleTextView.Text = titleText; |
| | | //mZXingCustomScanView.SetMinimumWidth( 1800); |
| | | //var bOn = false; |
| | | //scanner = new ZXing.Mobile.MobileBarcodeScanner() |
| | | //{ |
| | | // UseCustomOverlay = true, |
| | | // CustomOverlay = mZXingCustomScanView |
| | | //}; |
| | | ////scanner.CustomOverlay.width |
| | | //mZXingCustomScanView.OnCancel += () => |
| | | //{ |
| | | |
| | | // scanner?.Cancel(); |
| | | //}; |
| | | |
| | | //mZXingCustomScanView.OnTorch += () => |
| | | //{ |
| | | // bOn = !bOn; |
| | | // scanner?.Torch(bOn); |
| | | //}; |
| | | } |
| | | |
| | | //var result = await scanner.Scan(); |
| | | //if (result != null) |
| | | // action?.Invoke(result.Text); |
| | | //else |
| | | // action?.Invoke(null); |
| | | } |
| | | else |
| | | { |
| | |
| | | return stream.ToArray(); |
| | | } |
| | | } |
| | | |
| | | //public static void OpenScan1(Action<string> action) |
| | | //{ |
| | | // (Shared.Application.Activity as BaseActivity).SetCamera((obj) => { |
| | | // if (obj) |
| | | // { |
| | | // var scanner = new MobileBarcodeScanner { }; |
| | | // // 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, (obj2) => { |
| | | // scanner.Cancel(); |
| | | // action?.Invoke(obj2.Text); |
| | | // }); |
| | | // } |
| | | // else |
| | | // { |
| | | // action?.Invoke(""); |
| | | // } |
| | | // }); |
| | | //} |
| | | |
| | | |
| | | //static void initFromCameraParameters(Android.Graphics.Camera camera) |
| | | //{ |
| | | // //camera.SetLocation |
| | | //} |
| | | |
| | | public void onResult(string result) |
| | | { |