protected void DoWorkSequential() { ReportStart(); foreach (IExWork work in _workList) { WorkSpawner.SetIsMuted(work.ID, true); hookWorkEvent(work); work.Start(false); unhookWorkEvent(work); WorkSpawner.SetIsMuted(work.ID, false); completedWork++; ReportProgress(_workList.Count * 100, completedWork * 100, ""); } ReportCompleted(); }
protected void DoWorkParallel() { foreach (IExWork work in _workList) { WorkSpawner.SetIsMuted(work.ID, true); hookWorkEvent(work); work.WorkFinished += (WorkFinishedEventHandler) delegate(object sender, WorkFinishedEventArgs e) { unhookWorkEvent(work); WorkSpawner.SetIsMuted(work.ID, false); completedWork++; if (completedWork == _workList.Count) { ReportCompleted(); } }; work.Start(true); unhookWorkEvent(work); } }