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, () => { }); }
public static ZxingBarcodeResult FromZxingResult(com.google.zxing.Result result) { var r = new ZxingBarcodeResult(); r.Value = result.Text; r.Metadata = result.ResultMetadata; r.Points = result.ResultPoints; //r.Raw = new sbyte[](result.ResultPoints.Length); //result.RawBytes.CopyTo(r.Raw, 0); switch (result.BarcodeFormat.Name) { case "QR_CODE": r.Format = ZxingBarcodeFormat.QrCode; break; case "DATAMATRIX": r.Format = ZxingBarcodeFormat.DataMatrix; break; case "UPC_E": r.Format = ZxingBarcodeFormat.UpcE; break; case "UPC_A": r.Format = ZxingBarcodeFormat.UpcA; break; case "EAN_8": r.Format = ZxingBarcodeFormat.Ean8; break; case "EAN_13": r.Format = ZxingBarcodeFormat.Ean13; break; case "CODE_128": r.Format = ZxingBarcodeFormat.Code128; break; case "CODE_39": r.Format = ZxingBarcodeFormat.Code39; break; case "ITF": r.Format = ZxingBarcodeFormat.Itf; break; case "PDF417": r.Format = ZxingBarcodeFormat.Pdf417; break; } return(r); }
void HandleScanResult (ZxingBarcodeResult result) { string msg = ""; if (result != null && !string.IsNullOrEmpty(result.Value)) msg = "Found Barcode: " + result.Value; else msg = "Scanning Canceled!"; Toast.MakeText(this, msg, ToastLength.Short).Show(); }
void HandleScanResult(ZxingBarcodeResult result) { string msg = ""; if (result != null && !string.IsNullOrEmpty(result.Value)) msg = "Found Barcode: " + result.Value; else msg = "Scanning Canceled!"; var av = new UIAlertView("Barcode Result", msg, null, "OK", null); av.Show(); }
public static ZxingBarcodeResult FromZxingResult (com.google.zxing.Result result) { var r = new ZxingBarcodeResult (); r.Value = result.Text; r.Metadata = result.ResultMetadata; r.Points = result.ResultPoints; //r.Raw = new sbyte[](result.ResultPoints.Length); //result.RawBytes.CopyTo(r.Raw, 0); switch (result.BarcodeFormat.Name) { case "QR_CODE": r.Format = ZxingBarcodeFormat.QrCode; break; case "DATAMATRIX": r.Format = ZxingBarcodeFormat.DataMatrix; break; case "UPC_E": r.Format = ZxingBarcodeFormat.UpcE; break; case "UPC_A": r.Format = ZxingBarcodeFormat.UpcA; break; case "EAN_8": r.Format = ZxingBarcodeFormat.Ean8; break; case "EAN_13": r.Format = ZxingBarcodeFormat.Ean13; break; case "CODE_128": r.Format = ZxingBarcodeFormat.Code128; break; case "CODE_39": r.Format = ZxingBarcodeFormat.Code39; break; case "ITF": r.Format = ZxingBarcodeFormat.Itf; break; case "PDF417": r.Format = ZxingBarcodeFormat.Pdf417; break; } return r; }
void HandleScanResult(ZxingBarcodeResult result) { string msg = ""; if (result != null && !string.IsNullOrEmpty(result.Value)) msg = "Found Barcode: " + result.Value; else msg = "Scanning Canceled!"; MessageBox.Show(msg); //Go back to the main page NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative)); //Don't allow to navigate back to the scanner with the back button NavigationService.RemoveBackEntry(); }
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); }