示例#1
0
文件: Program.cs 项目: 3141592/vs
 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);
         }
     }
 }
示例#2
0
文件: BaseScript.cs 项目: zDasi/fivem
        internal void ScheduleRun()
        {
            if (Tick != null)
            {
                var calls = Tick.GetInvocationList();

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

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