Пример #1
0
 public BGWorker(ExecutorFunc worker, CBForm reporter)
 {
     this.worker   = worker;
     this.reporter = reporter;
     WorkerSupportsCancellation = true;
     WorkerReportsProgress      = true;
     DoWork          += Exec;
     ProgressChanged += Report;
 }
Пример #2
0
 /// <summary>
 /// Executes worker with popup progress bar form.
 /// Rethrows all exceptions. Throws Hybmesh.EUserInterrupt on cancellation request.
 /// </summary>
 static public void Exec(ExecutorFunc worker)
 {
     using (var dialog = new CBForm(worker)){
         dialog.ShowDialog();
         if (dialog.ExecError != null)
         {
             throw dialog.ExecError;
         }
     }
 }