Наследование: CountedInstance
Пример #1
0
 public void OnTimerCB(TimedEvent evt)
 {
     if (Globals.Contains(evt.Name + "Callback"))
     {
         Invoke(evt.Name + "Callback", evt);
     }
 }
Пример #2
0
        /// <summary>
        /// Creates a parallel timer.
        /// </summary>
        /// <returns>The parallel timer.</returns>
        /// <param name="name">Name.</param>
        /// <param name="timeoutDelay">Timeout delay.</param>
        /// <param name="args">Arguments.</param>
        public TimedEvent CreateParallelTimer(string name, int timeoutDelay, Dictionary <string, object> args)
        {
            TimedEvent timedEvent = new TimedEvent(name, (double)timeoutDelay);

            timedEvent.Args    = args;
            timedEvent.OnFire += new TimedEvent.TimedEventFireDelegate(OnTimerCB);
            ParallelTimers.Add(timedEvent);
            return(timedEvent);
        }
Пример #3
0
        /// <summary>
        /// Kills the timer.
        /// </summary>
        /// <param name="name">Name.</param>
        public void KillTimer(string name)
        {
            TimedEvent timer = GetTimer(name);

            if (timer == null)
            {
                return;
            }

            timer.Kill();
            Timers.Remove(name);
        }
Пример #4
0
        /// <summary>
        /// Creates a timer.
        /// </summary>
        /// <returns>The timer.</returns>
        /// <param name="name">Name.</param>
        /// <param name="timeoutDelay">Timeout delay.</param>
        public TimedEvent CreateTimer(string name, int timeoutDelay)
        {
            TimedEvent timedEvent = GetTimer(name);

            if (timedEvent == null)
            {
                timedEvent         = new TimedEvent(name, (double)timeoutDelay);
                timedEvent.OnFire += new TimedEvent.TimedEventFireDelegate(OnTimerCB);
                Timers.Add(name, timedEvent);
            }
            return(timedEvent);
        }
Пример #5
0
        /// <summary>
        /// Creates a timer.
        /// </summary>
        /// <returns>The timer.</returns>
        /// <param name="name">Name.</param>
        /// <param name="timeoutDelay">Timeout delay.</param>
        /// <param name="args">Arguments.</param>
        public TimedEvent CreateTimer(string name, int timeoutDelay, Dictionary <string, object> args)
        {
            TimedEvent timedEvent = GetTimer(name);

            if (timedEvent == null)
            {
                timedEvent         = new TimedEvent(name, (double)timeoutDelay);
                timedEvent.Args    = args;
                timedEvent.OnFire += new TimedEvent.TimedEventFireDelegate(OnTimerCB);
                Timers.Add(name, timedEvent);
            }
            return(timedEvent);
        }