| | |
| | | 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 |
| | | { |
| | |
| | | |
| | | public static byte[] BytesFromText(string text, int width = 300, int height = 300) |
| | | { |
| | | if (text == "") return null; |
| | | |
| | | var barcodeWriter = new ZXing.Mobile.BarcodeWriter |
| | | { |
| | | Format = ZXing.BarcodeFormat.QR_CODE, |