LogViewer.Utilities.DelayedActions.DelayedAction.StartDelayTimer C# (CSharp) Method

StartDelayTimer() public method

Start a count down with the given delay, and fire the given action when it reaches zero. But if this method is called again before the timeout it resets the timeout and starts again.
public StartDelayTimer ( System.Action action, System.TimeSpan delay ) : void
action System.Action The action to perform when the delay is reached
delay System.TimeSpan The timeout before calling the action
return void
            public void StartDelayTimer(Action action, TimeSpan delay)
            {
                startTime = Environment.TickCount;

                // stop any previous timer and start over.
                StopDelayTimer();

                this.delayedAction = action;

                this.delayTimer = new System.Threading.Timer(OnDelayTimerTick, null, (int)delay.TotalMilliseconds, System.Threading.Timeout.Infinite);
            }