public void OnBarcodeScanned(BarcodeCapture barcodeCapture, BarcodeCaptureSession session, IFrameData frameData) { if (!session.NewlyRecognizedBarcodes.Any()) { return; } Barcode barcode = session.NewlyRecognizedBarcodes[0]; // Stop recognizing barcodes for as long as we are displaying the result. There won't be any new results until // the capture mode is enabled again. Note that disabling the capture mode does not stop the camera, the camera // continues to stream frames until it is turned off. barcodeCapture.Enabled = false; // If you are not disabling barcode capture here and want to continue scanning, consider // setting the codeDuplicateFilter when creating the barcode capture settings to around 500 // or even -1 if you do not want codes to be scanned more than once. // Get the human readable name of the symbology and assemble the result to be shown. SymbologyDescription description = new SymbologyDescription(barcode.Symbology); string result = "Scanned: " + barcode.Data + " (" + description.ReadableName + ")"; if (MessageService == null) { MessageService = DependencyService.Get <IMessageService>(); } MessageService.ShowAsync(result, () => barcodeCapture.Enabled = true); }
public void OnBarcodeScanned(BarcodeCapture barcodeCapture, BarcodeCaptureSession session, IFrameData frameData) { var barcode = session?.NewlyRecognizedBarcodes.FirstOrDefault(); if (barcode == null || string.IsNullOrEmpty(barcode.Data)) { return; } // Stop recognizing barcodes for as long as we are displaying the result. There won't be any new // results until the capture mode is enabled again. Note that disabling the capture mode does // not stop the camera, the camera continues to stream frames until it is turned off. this.barcodeCapture.Enabled = false; // If you are not disabling barcode capture here and want to continue scanning, consider // setting the codeDuplicateFilter when creating the barcode capture settings to around 500 // or even -1 if you do not want codes to be scanned more than once. // Get the human readable name of the symbology and assemble the result to be shown. string symbology = SymbologyDescription.Create(barcode.Symbology).ReadableName; string result = string.Format("Scanned {0} ({1})", barcode.Data, symbology); this.ShowResult(result); // Dispose the frame when you have finished processing it. If the frame is not properly disposed, // different issues could arise, e.g. a frozen, non-responsive, or "severely stuttering" video feed. frameData.Dispose(); }
public void OnBarcodeScanned(BarcodeCapture barcodeCapture, BarcodeCaptureSession session, IFrameData frameData) { if (!SettingsManager.Instance.ContinuousModeEnabled) { // Stop recognizing barcodes for as long as we are // displaying the result. There won't be any new results until // the capture mode is enabled again. // Note that disabling the capture mode does not stop // the camera, the camera continues to stream frames // until it is turned off. this.BarcodeCapture.Enabled = false; } this.ShowResult(session.NewlyRecognizedBarcodes, () => { if (!SettingsManager.Instance.ContinuousModeEnabled) { // Enable recognizing barcodes when the result // is not shown anymore. this.BarcodeCapture.Enabled = true; } }); frameData.Dispose(); }
public void OnBarcodeScanned(BarcodeCapture barcodeCapture, BarcodeCaptureSession session, IFrameData frameData) { if (session.NewlyRecognizedBarcodes.Any()) { if (!this.ContinuousScanningEnabled) { this.PauseScanning(); } Barcode barcode = session.NewlyRecognizedBarcodes[0]; this.listener?.ShowDialog(barcode); } }
public void OnBarcodeScanned(BarcodeCapture barcodeCapture, BarcodeCaptureSession session, IFrameData frameData) { if (session.NewlyRecognizedBarcodes.Any()) { if (!this.ContinuousScanningEnabled) { this.PauseScanning(); } Barcode barcode = session.NewlyRecognizedBarcodes[0]; using SymbologyDescription description = SymbologyDescription.Create(barcode.Symbology); this.listener?.ShowDialog(description.ReadableName, barcode.Data, barcode.SymbolCount); } }
public void OnBarcodeScanned(BarcodeCapture barcodeCapture, BarcodeCaptureSession session, IFrameData frameData) { if (session.NewlyRecognizedBarcodes.Count == 0) { return; } var barcode = session.NewlyRecognizedBarcodes[0]; // If the code scanned doesn't start with "09:", we will just ignore it and continue // scanning. if (barcode.Data?.StartsWith("09:") == false) { // We temporarily change the brush, used to highlight recognized barcodes, to a // transparent brush. this.overlay.Brush = Brush.TransparentBrush; return; } // If the code is recognized, we want to make sure to use a brush to highlight // the code. this.overlay.Brush = this.highlightingBrush; // We also want to emit a feedback (vibration and, if enabled, sound). this.feedback.Emit(); // Stop recognizing barcodes for as long as we are displaying the result. There won't be any new // results until the capture mode is enabled again. Note that disabling the capture mode does // not stop the camera, the camera continues to stream frames until it is turned off. this.barcodeCapture.Enabled = false; // If you are not disabling barcode capture here and want to continue scanning, consider // setting the codeDuplicateFilter when creating the barcode capture settings to around 500 // or even -1 if you do not want codes to be scanned more than once. // Get the human readable name of the symbology and assemble the result to be shown. string symbology = SymbologyDescription.Create(barcode.Symbology).ReadableName; string result = string.Format("Scanned {0} ({1})", barcode.Data, symbology); this.ShowResult(result); // Dispose the frame when you have finished processing it. If the frame is not properly disposed, // different issues could arise, e.g. a frozen, non-responsive, or "severely stuttering" video feed. frameData.Dispose(); }
public void OnBarcodeScanned(BarcodeCapture barcodeCapture, BarcodeCaptureSession session, IFrameData frameData) { if (!session.NewlyRecognizedBarcodes.Any()) { return; } Barcode barcode = session.NewlyRecognizedBarcodes[0]; // If the code scanned doesn't start with "09:", we will just ignore it and continue // scanning. if (barcode.Data?.StartsWith("09:") == false) { this.RejectedCode?.Invoke(this, EventArgs.Empty); return; } this.AcceptedCode?.Invoke(this, EventArgs.Empty); // We also want to emit a feedback (vibration and, if enabled, sound). this.Feedback.Emit(); // Stop recognizing barcodes for as long as we are displaying the result. There won't be any new results until // the capture mode is enabled again. Note that disabling the capture mode does not stop the camera, the camera // continues to stream frames until it is turned off. barcodeCapture.Enabled = false; // If you are not disabling barcode capture here and want to continue scanning, consider // setting the codeDuplicateFilter when creating the barcode capture settings to around 500 // or even -1 if you do not want codes to be scanned more than once. // Get the human readable name of the symbology and assemble the result to be shown. SymbologyDescription description = new SymbologyDescription(barcode.Symbology); string result = "Scanned: " + barcode.Data + " (" + description.ReadableName + ")"; if (MessageService == null) { MessageService = DependencyService.Get <IMessageService>(); } MessageService.ShowAsync(result, () => barcodeCapture.Enabled = true); }
public void OnBarcodeScanned(BarcodeCapture barcodeCapture, BarcodeCaptureSession session, IFrameData data) { if (session.NewlyRecognizedBarcodes.Count == 0) { return; } var barcode = session.NewlyRecognizedBarcodes[0]; // If the code scanned doesn't start with "09:", we will just ignore it and continue // scanning. if (barcode.Data?.StartsWith("09:") == false) { // We temporarily change the brush, used to highlight recognized barcodes, to a // transparent brush. overlay.Brush = Brush.TransparentBrush; return; } // If the code is recognized, we want to make sure to use a brush to highlight the code. overlay.Brush = this.highlightingBrush; // We also want to emit a feedback (vibration and, if enabled, sound). feedback.Emit(); // Stop recognizing barcodes for as long as we are displaying the result. There won't be any // new results until the capture mode is enabled again. Note that disabling the capture mode // does not stop the camera, the camera continues to stream frames until it is turned off. barcodeCapture.Enabled = false; // If you are not disabling barcode capture here and want to continue scanning, consider // setting the codeDuplicateFilter when creating the barcode capture settings to around 500 // or even -1 if you do not want codes to be scanned more than once. // Get the human readable name of the symbology and assemble the result to be shown. using (var description = SymbologyDescription.Create(barcode.Symbology)) { var result = "Scanned: " + barcode.Data + " (" + description.ReadableName + ")"; RunOnUiThread(() => ShowResult(result)); } }
public void OnBarcodeScanned(BarcodeCapture barcodeCapture, BarcodeCaptureSession session, IFrameData frameData) { if (!session.NewlyRecognizedBarcodes.Any()) { return; } Barcode barcode = session.NewlyRecognizedBarcodes[0]; // Stop recognizing barcodes for as long as we are displaying the result. There won't be any new results until // the capture mode is enabled again. Note that disabling the capture mode does not stop the camera, the camera // continues to stream frames until it is turned off. barcodeCapture.Enabled = false; // If you are not disabling barcode capture here and want to continue scanning, consider // setting the codeDuplicateFilter when creating the barcode capture settings to around 500 // or even -1 if you do not want codes to be scanned more than once. // Get the human readable name of the symbology and assemble the result to be shown. string symbology = SymbologyDescription.Create(barcode.Symbology).ReadableName; string result = "Scanned: " + barcode.Data + " (" + symbology + ")"; RunOnUiThread(() => ShowResults(result)); }
public void OnSessionUpdated(BarcodeCapture barcodeCapture, BarcodeCaptureSession session, IFrameData frameData) { }
public void OnSessionUpdated(BarcodeCapture barcodeCapture, BarcodeCaptureSession session, IFrameData frameData) { // Dispose the frame when you have finished processing it. If the frame is not properly disposed, // different issues could arise, e.g. a frozen, non-responsive, or "severely stuttering" video feed. frameData.Dispose(); }