Beispiel #1
0
 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);
         }
     }
 }
Beispiel #2
0
        internal void ScheduleRun()
        {
            if (Tick != null)
            {
                var calls = Tick.GetInvocationList();

                foreach (var call in calls)
                {
                    ScheduleTick(call);
                }
            }
        }
Beispiel #3
0
        public void Dispose()
        {
            if (Tick == null)
            {
                return;
            }

            foreach (Delegate d in Tick?.GetInvocationList())
            {
                Tick -= (EventHandler <EventArgs>)d;
            }
        }
Beispiel #4
0
 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();
            }
        }