private void MBarcodeReader_BarcodeDataReady(object sender, BarcodeDataArgs e) { mUIContext.Post(_ => { UpdateBarcodeInfo(e.Data, _parentMenuItem); }, null); }
// Event handler for the BarcodeDataReady event. private async void MBarcodeReader_BarcodeDataReady(object sender, BarcodeDataArgs e) { // Update the barcode information in the UI thread. mUIContext.Post(_ => { UpdateBarcodeInfo(e.Data, e.SymbologyName, e.TimeStamp); } , null); if (mContinuousScan) { mTotalContinuousScanCount++; // Measure and display the performance. mUIContext.Post(_ => { mCountValueLabel.Text = mTotalContinuousScanCount.ToString(); } , null); } //endif (mContinuousScan) else if (mSoftOneShotScanStarted) { // Turn off the software trigger. await mSelectedReader.SoftwareTriggerAsync(false); mSoftOneShotScanStarted = false; } }
private void MBarcodeReader_BarcodeDataReady(object sender, BarcodeDataArgs e) { try { Debug.WriteLine("SCAN EVENT"); //e.Data.ToString() es la data que leyo el escaner Device.BeginInvokeOnMainThread(() => { //Vamos a poner la data que se escaneo en el campo de boleta //entCedula.Text = e.Data.ToString(); Debug.WriteLine("Data: " + e.Data.ToString()); method2Call(e.Data.ToString()); //Invocamos el evento de escaneo completado. //EntCedula_Completed(entCedula, new EventArgs()); }); } catch (Exception ex) { Debug.WriteLine("Error en el metodo MBarcode_BarcodeDataReady"); Analytics.TrackEvent("Error al escanear: " + ex.Message + "\n Escaner: " + Preferences.Get("LECTOR", "N/A")); throw; } }
/// <summary> /// WPF and Xamarin allow for event handlers to use async void /// It's possible that in the long run, it might just be better to wrap the await CloseReaderAsync(); /// in a Task.Run(async()=>await CloseReaderAsync()); and remove the async? /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private async void _barcodeReader_BarcodeDataReady(object sender, BarcodeDataArgs e) { _barcodeReader.BarcodeDataReady -= _barcodeReader_BarcodeDataReady; await CloseReaderAsync(); OnScanComplete.Invoke(this, e); }
/// <summary> /// Event that receives the data read by the scanner /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void MBarcodeReader_BarcodeDataReady(object sender, BarcodeDataArgs e) { myLog.doLog("MBarcodeReader_BarcodeDataReady: >" + e.Data + "<"); myLog.doLog("MBarcodeReader_BarcodeDataReady: " + myLog.strToHexString(e.Data)); ScanCount++; //Changed Check there is a registered scan event myLog.doLog("MBarcodeReader_BarcodeDataReady: calling Scan_Result_Event..."); onBarcodeRead(new BarcodeReadEventArgs(e.Data, e.TimeStamp, e.SymbologyType, e.SymbologyName)); }
/// <summary> /// Event that receives the data read by the scanner /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private static void MBarcodeReader_BarcodeDataReady(object sender, BarcodeDataArgs e) { Log("MBarcodeReader_BarcodeDataReady: >" + e.Data + "<"); ScanCount++; //Changed Check there is a registered scan event if (Scan_Result_Event != null) { Log("MBarcodeReader_BarcodeDataReady: calling Scan_Result_Event..."); ToggleScanner(false); // Make sure the software trigger is set to false on a scan as it won't reset itself Scan_Result_Event(printData(e.Data)); //Changed Call the registered scan event System.Diagnostics.Debug.WriteLine(printData(e.Data)); } }
private async void MBarcodeReader_BarcodeDataReady(object sender, BarcodeDataArgs e) { mUIContext.Post(_ => { UpdateBarcodeInfo(e.Data, e.SymbologyName, e.TimeStamp); }, null); if (mContinuousScan) { mTotalContinuousScanCount++; } else if (mSoftOneShotScanStarted) { await mSelectedReader.SoftwareTriggerAsync(false); mSoftOneShotScanStarted = false; } }
private async void MBarcodeReader_BarcodeDataReady(object sender, BarcodeDataArgs e) { this.RunOnUiThread(() => { //Changed Invoke UI Thread if (!string.IsNullOrEmpty(e.Data)) { UpdateDetailItemWithScannedValue(e.Data); } }); if (mSoftOneShotScanStarted) { // Turn off the software trigger. await mSelectedReader.SoftwareTriggerAsync(false); mSoftOneShotScanStarted = false; } }