private void _OnBarcodeFound(object sender, BarcodeFoundEventArgs e) { // e.cancel = (e.Count == 3); // Cancel after 3 barcodes are found txtRslt.Text = txtRslt.Text + "_OnBarcodeFound -> "; string s = txtRslt.Text; AddBarcode(ref s, e.Count, e.Barcode); txtRslt.Text = s; System.Windows.Forms.Application.DoEvents(); }
private void _OnBarcodeFoundThread(object sender, BarcodeFoundEventArgs e) { lock (_lockObject) { string s = txtRslt.Text + "_OnBarcodeFound on Managed Thread " + System.Threading.Thread.CurrentThread.ManagedThreadId + " -> "; AddBarcode(ref s, e.Count, e.Barcode); SetControlPropertyThreadSafe(txtRslt, "Text", s); // txtRslt.Text = s; System.Windows.Forms.Application.DoEvents(); } }
private static void Reader_BarcodeFound(object sender, BarcodeFoundEventArgs e) { Console.WriteLine("Found barcode with type '{0}' and value '{1}'", e.Barcode.Type, e.Barcode.Value); if (e.Count == 5) { // Cancel after 5 barcodes found e.Cancel = true; Console.WriteLine("Cancelled."); } }
protected virtual void BarcodeFound(BarcodeFoundEventArgs e) { BarcodeFoundEvent?.Invoke(this, e); }
private void _OnBarcodeFoundThread(object sender, BarcodeFoundEventArgs e) { lock (_lockObject) { string s = txtRslt.Text + "_OnBarcodeFound on Managed Thread " + System.Threading.Thread.CurrentThread.ManagedThreadId + " -> "; AddBarcode(ref s, e.Count, e.Barcode); SetControlPropertyThreadSafe (txtRslt, "Text", s); // txtRslt.Text = s; System.Windows.Forms.Application.DoEvents(); } }