internal void EnableTimer(TickWorker timer)
 {
     VerifyOwnThread();
     timer.Timestamp = GetTimestamp();
     timers.Add(timer);
     BumpTimer();
 }
        public TickWorker CreateTimer(Action method, TimeSpan interval, bool active)
        {
            VerifyOwnThread();
            if (method is null)
            {
                throw new ArgumentNullException(nameof(method));
            }
            var worker = new TickWorker(this, method, interval);

            // Add the worker to the list (if it's enabled)
            if (active)
            {
                worker.Enable();
            }
            return(worker);
        }
 internal void DisableTimer(TickWorker timer)
 {
     VerifyOwnThread();
     timers.Remove(timer);
 }