private void FireScannedEvent(string driverName) { // Use this to post events to the calling client on the progress // of the scanning effort. if (OnInfFileScanned != null && !_tokenSource.IsCancellationRequested) { DriverStoreScanningEventArgs args = new DriverStoreScanningEventArgs(); args.Driver = driverName; args.Total = _totalDirectories; args.Complete = _totalDirectoriesScanned; OnInfFileScanned(this, args); } }
private void Instance_OnInfFileScanned(object sender, DriverStoreScanningEventArgs e) { if (this.InvokeRequired) { try { this.Invoke(new MethodInvoker(() => Instance_OnInfFileScanned(sender, e))); } catch (ObjectDisposedException ex) { // Log that this error occurred but continue on. TraceFactory.Logger.Error(ex.Message); } } else { if (e.Total > 0) { loading_ProgressBar.Value = (int)Math.Floor(((double)e.Complete / (double)e.Total) * 100.0); loading_ProgressBar.Refresh(); driver_Label.Text = e.Driver; } } }