private void BarcodeDetected(object sender, BarcodeDetectedEventArgs e) { barCodeBorder.Child = e.GetBarcodeBorderUIVideoUniformFill(barCodeBorder.ActualWidth, barCodeBorder.ActualHeight); DisplayResult(e.Result); if (_resetTextAction != null) { _resetTextAction.Start(); } }
private void BarcodeDetected(object sender, BarcodeDetectedEventArgs e) { _device.AutoDetectBarcode = false; barCodeBorder.Child = e.GetBarcodeBorderUIVideoUniformFill(barCodeBorder.ActualWidth, barCodeBorder.ActualHeight); DisplayResult(e.Result); _device.Dispose(); _device = null; NavigationService.GoBack(); }
private void OnBookReturn(object sender, BarcodeDetectedEventArgs e) { var book = LibraryDataIO.Instance.FindBook(e.DecodedText); ReturnBook.Instance.HideScanner(); if (LibraryManager.ValidateReturning(ActiveUser, book)) { ui.Speaker.TellUser(StringConstants.aiWorking); LibraryManager.ReturnBook(ActiveUser, book); ui.Speaker.TellUser(StringConstants.aiReturnedBook); } else { ui.Speaker.TellUser(StringConstants.aiReturnFailed); } }
private void OnBookDetected(object sender, BarcodeDetectedEventArgs e) { var book = LibraryDataIO.Instance.FindBook(e.DecodedText); TakeBook.Instance.HideScanner(); if (LibraryManager.ValidateIssuing(ActiveUser, book)) { ui.Speaker.TellUser(StringConstants.aiWorking); LibraryManager.IssueBookToReader(ActiveUser, book); ui.Speaker.TellUser(StringConstants.aiIssued); } else { ui.Speaker.TellUser(StringConstants.aiIssuingFailed); } }
/// <summary> /// Occurs when a barcode has been detected. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BarcodeReaderOnDetectionOccurred(object sender, BarcodeDetectedEventArgs e) { InvokeVotingScreen(() => { if (e == null) { return; } DisconnectCamera(); _barcodelist.Add(e.DetectedBarcode); var element = _barcodelist.Last(); path = element.Content; try { _barcodelist.Clear(); List <StringValue> lst = new List <StringValue>(); UTF8Encoding utf8 = new UTF8Encoding(); using (StreamReader sr = new StreamReader(path)) { string line; while ((line = sr.ReadLine()) != null) { var temp = utf8.GetString(utf8.GetBytes(line)); lst.Add(new StringValue(temp)); } } this.Hide(); Voting_Screen.getInstance().list = lst; Voting_Screen.getInstance().Sourcelist(); Voting_Screen.getInstance().ShowDialog(); this.Dispose(); } catch (Exception ex) { MessageBox.Show(@"Forkert QR kode. Prøv igen eller kontakt en administrator.", @"Der opstod en fejl!"); } }); }
private async void BarcodeTimer_Tick(object sender, EventArgs e) { ThrowIfDisposed(); if (!_inited) { return; } if (!_previewSize.HasValue) { return; } int width = (int)_previewSize.Value.Width; int height = (int)_previewSize.Value.Height; // for barcode if (AutoDetectBarcode) { if (_barcodeDecoding == true) { return; } _barcodeDecoding = true; try { var result = await DetectBarcodeAsync(width, height); if (result != null) { // raise BarcodeDetected BarcodeDetectedEventArgs args = new BarcodeDetectedEventArgs(result); args.HostImageSize = new Size(width, height); if (args.IsQRCode && result.ResultMetadata.ContainsKey(ResultMetadataType.QRCODE_DIMENSION)) { int dimension = (int)result.ResultMetadata[ResultMetadataType.QRCODE_DIMENSION]; Debug.Assert(result.ResultPoints.Length >= 3); if (result.ResultPoints.Length >= 3) { var p1 = new Point(result.ResultPoints[0].X, result.ResultPoints[0].Y); var p2 = new Point(result.ResultPoints[1].X, result.ResultPoints[1].Y); var p3 = new Point(result.ResultPoints[2].X, result.ResultPoints[2].Y); args.BarcodePosition = new BarcodePosition(p1, p2, p3, dimension, width, height); } } if (BarcodeDetected != null) { BarcodeDetected(this, args); } } } catch (ObjectDisposedException) { throw new CardCaptureDeviceDisposedException(); } catch { } finally { _barcodeDecoding = false; } } ThrowIfDisposed(); }