/// <summary> /// Raise a workstatus event /// </summary> /// <param name="message"></param> /// <param name="index"></param> /// <param name="percentage"></param> protected void RaiseWorkStatus(string message, int index, decimal percentage) { // make a local copy for thread-safe WorkStatusEventHandler t = workStatusEvent; if (t == null) { return; } var exlist = new AggregatedException(); foreach (WorkStatusEventHandler ev in t.GetInvocationList()) { try { ev(this, new WorkStatusEventArgs(message, ThreadName, AbsoluteIndex(index), percentage, WorkerThreadType.Slave)); } catch (Exception ex) { exlist.Add(ex); } } if (exlist.Count > 0) { throw exlist; } }
private void InitializeMTContainers() { for (int i = 0; i < this.mtObjects.Count; i++) { this.mtObjects[i].ContinueOnError = this.continueOnError; this.mtObjects[i].workStatusEvent += new WorkStatusEventHandler(RaiseSlaveWorkerStatus); this.mtObjects[i].RaiseStatusInterval = RaiseStatusInterval; this.mtObjects[i].EnableStatistics = true; this.mtObjects[i].CheckForDefaultValues = CheckForDefaultValues; } }