public void Manager_LoadDataSourceProgress(Manager sender, string status, int percentage, CancelEventArgs e) { if (toolStrip1.InvokeRequired) { LoadDataSourceProgressEventHandler d = new LoadDataSourceProgressEventHandler(Manager_LoadDataSourceProgress); Invoke(d, new object[] { sender, status, percentage, e }); } else { if (toolStrip1.IsDisposed) { e.Cancel = true; return; } if (status.Length > 0) { toolStripStatusLabel1.Text = status; toolStripStatusLabel1.Visible = true; } else { toolStripStatusLabel1.Visible = false; } switch (percentage) { case 100: toolStripProgressBar1.Visible = false; break; default: toolStripProgressBar1.Visible = true; toolStripProgressBar1.Minimum = 0; toolStripProgressBar1.Maximum = 100; toolStripProgressBar1.Value = percentage; break; } toolStrip1.Refresh(); } }
public void Manager_LoadDataSourceProgress (Manager sender, string status, int percentage, CancelEventArgs e) { if (toolStrip1.InvokeRequired) { LoadDataSourceProgressEventHandler d = new LoadDataSourceProgressEventHandler(Manager_LoadDataSourceProgress); Invoke(d, new object[] { sender, status, percentage, e }); } else { if (toolStrip1.IsDisposed) { e.Cancel = true; return; } if (status.Length > 0) { toolStripStatusLabel1.Text = status; toolStripStatusLabel1.Visible = true; } else toolStripStatusLabel1.Visible = false; switch (percentage) { case 100: toolStripProgressBar1.Visible = false; break; default: toolStripProgressBar1.Visible = true; toolStripProgressBar1.Minimum = 0; toolStripProgressBar1.Maximum = 100; toolStripProgressBar1.Value = percentage; break; } toolStrip1.Refresh(); } }