Example #1
1
        /// <summary>
        ///     Add a new timer and starts measuring time.
        /// </summary>
        /// <param name="duration">When the action must be started.</param>
        /// <param name="callbackAction">Action to invoke on time.</param>
        /// <param name="removeAfterCallback">Remove timer from list after execution of callback.</param>
        /// <returns>Timer instance.</returns>
        public Timer AddTimer(double duration, Action callbackAction, bool removeAfterCallback = false)
        {
            var timer = new Timer(duration, callbackAction, removeAfterCallback) {Running = true};
            timers.Add(timer);

            return timer;
        }
Example #2
0
 /// <summary>
 ///     Remove specified timer.
 /// </summary>
 /// <param name="timer">Timer to remove.</param>
 public void Remove(Timer timer)
 {
     timers.Remove(timer);
 }