public MainForm() { InitializeComponent(); filterString = txtFilter.Text; msgHandler = new ShowMessageHandler(ShowMsg); pbHandler = new ShowProgressHandler(UpdatePb); }
void ShowProgress(object sender, ShowProgressArgs e) { // Make sure we're on the UI thread if (_pi.InvokeRequired == false) { _pi.Text = e.Pi; _piProgress.Maximum = e.TotalDigits; _piProgress.Value = e.DigitsSoFar; // Check for Cancel e.Cancel = (_state == CalcState.Canceled); // Check for completion if (e.Cancel || (e.DigitsSoFar == e.TotalDigits)) { _state = CalcState.Pending; _calcButton.Text = "Calc"; _calcButton.Enabled = true; } } else { // Get ready to show progress asynchronously ShowProgressHandler showProgress = new ShowProgressHandler(ShowProgress); // Show progress Invoke(showProgress, new object[] { sender, e }); } }
public void DisplayProgress(int Val) { if (this.DBT_Progress.InvokeRequired) { ShowProgressHandler sph = new ShowProgressHandler(ShowProgress); sph.Invoke(Val); } else { ShowProgress(Val); } }
public void ShowProgress(int CurrCount, int TabCount) { if (this.PB_Generate.InvokeRequired) { if (ShowProgressMethod == null) { ShowProgressMethod = new ShowProgressHandler(SetPro); } ShowProgressMethod.Invoke(CurrCount, TabCount); } else { SetPro(CurrCount, TabCount); } }
private void StartProcess() { if (pbStatus.InvokeRequired) { var del = new ShowProgressHandler(StartProcess); this.BeginInvoke(del); } else { this.Refresh(); this.pbStatus.Maximum = _Max; for (int i = 0; i <= _Max; i++) { Thread.Sleep(10); this.lblOutput.Text = i.ToString(); this.pbStatus.Value = i; } } }
public MainForm() { InitializeComponent(); msgHandler = new ShowMessageHandler(ShowMsg); pbHandler = new ShowProgressHandler(UpdatePb); }