private void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e) { ProgressReporter.ProgInfo info = (ProgressReporter.ProgInfo)e.UserState; this.ctlTitleBar1.SubText = info.Text; if (info.Percent >= 0) { this.progressBar1.Style = ProgressBarStyle.Continuous; this.progressBar1.Maximum = 100; this.progressBar1.Value = info.Percent; } else { this.progressBar1.Style = ProgressBarStyle.Marquee; } this.label1.Text = StringHelper.TimeAsString(this._operationTimer.Elapsed); if (info.CText != null) { this.label2.Text = info.CText; this.label2.Visible = true; } else { this.label2.Visible = false; } }
/// <summary> /// Updates the progress bar /// </summary> void IProgressReceiver.ReportProgressDetails(ProgressReporter.ProgInfo info) { this.toolStripStatusLabel2.Text = info.Text; if (info.Percent >= 0) { this.toolStripProgressBar1.Maximum = 100; this.toolStripProgressBar1.Style = ProgressBarStyle.Continuous; this.toolStripProgressBar1.Value = info.Percent; } else { this.toolStripProgressBar1.Style = ProgressBarStyle.Marquee; } this._statusMain.Refresh(); if (this._lastProgressFlash.ElapsedMilliseconds > 1000) { this._lastProgressFlash.Restart(); this._statusMain.BackColor = this._statusMain.BackColor == Color.Red ? Color.Orange : Color.Red; } }
void IProgressReceiver.ReportProgressDetails(ProgressReporter.ProgInfo info) { this._form.backgroundWorker1.ReportProgress(0, info); }