Ejemplo n.º 1
0
 public Runner(ProjectorBase projector, TimeSpan?runForDuration = null)
 {
     Projector      = projector;
     RunForDuration = runForDuration ?? TimeSpan.FromMinutes(1);
     _startedAt     = new InterlockedDateTime(DateTime.MaxValue);
     _timeoutCalc   = new TimeoutCalculator(TimeSpan.Zero);
     _runnerTimer   = CreateTimer(_timeoutCalc);
 }
Ejemplo n.º 2
0
        private System.Timers.Timer CreateTimer(TimeoutCalculator timeoutCalc)
        {
            var timeout = timeoutCalc.CalculateNext();
            var result  = new System.Timers.Timer(timeout)
            {
                AutoReset = false
            };

            result.Elapsed += OnTimerElapsed;
            return(result);
        }