public override void StartScanning(ZxingScanningOptions options, Action <ZxingBarcodeResult> onFinished) { viewController = new ZxingCameraViewController(options, this); viewController.BarCodeEvent += (BarCodeEventArgs e) => { viewController.DismissViewController(); ZxingBarcodeResult result = null; if (e.BarcodeResult != null) { result = ZxingBarcodeResult.FromZxingResult(e.BarcodeResult); } if (onFinished != null) { onFinished(result); } }; viewController.Canceled += (sender, e) => { viewController.DismissViewController(); if (onFinished != null) { onFinished(null); } }; appController.PresentViewController(viewController, true, () => { }); }
private void DisplayResult(com.google.zxing.Result result) { _reader.Stop(); successScan = true; if (result != null) { LastScanResult = ZxingBarcodeResult.FromZxingResult(result); } else { LastScanResult = null; } Finish(); }
public override void StartScanning(ZxingScanningOptions options, Action <ZxingBarcodeResult> onFinishedScanning) { var scanIntent = new Intent(this.Context, typeof(ZxingActivity)); ZxingActivity.UseCustomView = this.UseCustomOverlay; ZxingActivity.CustomOverlayView = this.CustomOverlay; ZxingActivity.ScanningOptions = options; ZxingActivity.TopText = TopText; ZxingActivity.BottomText = BottomText; ZxingActivity.OnCanceled += () => { onFinishedScanning(null); }; ZxingActivity.OnScanCompleted += (com.google.zxing.Result result) => { onFinishedScanning(ZxingBarcodeResult.FromZxingResult(result)); }; this.Context.StartActivity(scanIntent); }