private void OnScannerWarning(ScannerWarningEventArgs e) { if (this.ScannerWarning != null) { this.ScannerWarning(this, e); } //if (e.Cancel) // throw new ScanCancelledException(); }
/// <summary> /// Called if a non-critical error occurs while scanning. /// Throws a ScanCancelledException if an eventhandler sets e.CancelScanning to true. /// This methods blocks until the called eventhandler returns. /// </summary> protected void SendScannerWarning(string message, Exception ex) { SendOrPostCallback cb = delegate(object args) { OnScannerWarning((ScannerWarningEventArgs)args); }; ScannerWarningEventArgs e = new ScannerWarningEventArgs(message, ex); asyncOperation.SynchronizationContext.Send(cb, e); if (e.CancelScanning) { throw new ScanCancelledException(); } }
private void scanner_ScannerWarning(object sender, ScannerWarningEventArgs e) { Application.Invoke(delegate { UpdateLog(LogIcon.Warning, e.Message); }); }