private void btnSave_Click(object sender, EventArgs e) { /*TODO needs ammending*/ ucClient test = (ucClient)tabInstance[tbctrlMain.SelectedIndex - 1]; bgWork.WorkerReportsProgress = true; bgWork.DoWork += test.saveState; bgWork.RunWorkerCompleted += workerCompleted; bgWork.RunWorkerAsync(); }
public void ProgressChanged(object sender, ProgressChangedEventArgs e) { this.pbWork.Value = e.ProgressPercentage; pbWork.Control.Invoke(new MethodInvoker(delegate(){pbWork.Value = e.ProgressPercentage;})); } private void workerCompleted(object sender, RunWorkerCompletedEventArgs e) { MessageBox.Show("done"); }
public void saveState(object sender, DoWorkEventArgs e) { BackgroundWorker saveWork = sender as BackgroundWorker; int totalSteps = 5; for (int i = 1; i <= totalSteps; i++) { saveWork.ReportProgress(i * 100 / totalSteps); } // blClient client = new blClient(); // client.createClient(Forename,Surname, Road, Area, City, County,Postcode, Telephone, Email); }