void importer_ProgressChanged(object sender, ImportProgressEventArgs e) { Progress = e.Percent; Status = e.Total > 0 ? string.Format("{0}/{1} - {2}", e.Current, e.Total, e.Description) : e.Description; }
protected virtual void OnProgressChanged(ImportProgressEventArgs e) { if (ProgressChanged != null) ProgressChanged(this, e); }
void importer_Progress(object sender, ImportProgressEventArgs e) { if (closing) return; if (InvokeRequired) { try { //Make sure we only execute on main thread BeginInvoke(new MethodInvoker(delegate() { importer_Progress(sender, e); })); } catch (ObjectDisposedException) { } //form closed return; } if (closing) return; progressBar.Value = e.Percent; if (e.Total > 0) progressLabel.Text = string.Format("{0}/{1} - {2}", e.Current, e.Total, e.Description); else progressLabel.Text = e.Description; progressBar.Visible = true; progressLabel.Visible = true; }