Exemple #1
0
 //Your new instance-independent doWork-Method - static here
 private static void TheWorkThatHasToBeDone(object sender, DoWorkEventArgs e)
 {
     BackgroundWorker worker = sender as BackgroundWorker;
     ReadAllArguments arguments = e.Argument as ReadAllArguments;
     //You call the instance-Method here for your specific instance you want the work to be done for
     arguments.ListForm.bw_DoWork(worker, arguments);
 }
Exemple #2
0
 //Your old bw_DoWork-Method with nicer arguments - you should change the method name...
 private void bw_DoWork(BackgroundWorker worker, ReadAllArguments arguments)
     {
         DoUIWorkHandler DoReadClick;
         DoUIWorkHandler DoWriteClick;
 
         int CurrentControlCount = 1;
         string StatusText = "";
         int ProgressValue = 0;
 
         // *******************Perform a time consuming operation and report progress. 
         try
         {
             ...
         }