private void CheckHandlers() { if (Tick != null) { Console.WriteLine("Handlers still subscribed:"); foreach (var handler in Tick.GetInvocationList()) { Console.WriteLine("{0}.{1}", handler.Method.DeclaringType, handler.Method.Name); } } }
internal void ScheduleRun() { if (Tick != null) { var calls = Tick.GetInvocationList(); foreach (var call in calls) { ScheduleTick(call); } } }
public void Dispose() { if (Tick == null) { return; } foreach (Delegate d in Tick?.GetInvocationList()) { Tick -= (EventHandler <EventArgs>)d; } }
public void RemoveAllListeners() { if (Tick != null) { foreach (PhyAction d in Tick.GetInvocationList()) { Tick -= d; } } if (Completed != null) { foreach (PhyAction d in Completed.GetInvocationList()) { Completed -= d; } } }
private void _tmr_Elapsed(object sender, ElapsedEventArgs e) { CountdownTime -= ReportProgressTime; if (CountdownTime <= 0) { _tmr.Stop(); CountdownTime = 0; } if (Tick != null) { var invocationList = Tick.GetInvocationList(); Parallel.For(0, invocationList.Length, (i) => { (invocationList[i] as EventHandler).Invoke(this, e); }); } if (CountdownTime == 0) { Stop(); } }