private OneShotTimer(Action callback, long msTime) { _callback = callback; dynamic timer = new Threading.Timer(TimerProc); timer.Change(msTime, Threading.Timeout.Infinite); }
/// <summary> /// Initializes a new instance of the <see cref="SensorServiceBase<TValueInterface, TEventArgs>"/> class. /// </summary> protected SensorServiceBase() { _timer = new Threading.Timer(OnTimerTick, null, _defaultInterval, _defaultInterval); ExpectedValues = new Queue <SensorTestData <TValueInterface> >(); IsSupported = true; }
/// <summary> /// Initializes a new instance of the <see cref="LocationService"/> class. /// </summary> public LocationService() { var interval = TimeSpan.FromSeconds(1); _timer = new Threading.Timer(OnTimerTick, null, interval, interval); ExpectedLocations = new Queue <LocationTestData>(); }
public IHyperTimer StopIn(TimeSpan dueTime) { if (dueTime < TimeSpan.Zero) { throw new ArgumentOutOfRangeException("dueTime"); } _stopScheduler = new Threading.Timer(state => Stop(), null, dueTime, Timeout.InfiniteTimeSpan); return(this); }
/// <summary> /// <para>Disposes of the resources (other than memory) used by /// the <see cref='System.Timers.Timer'/>.</para> /// </summary> public void Close() { _initializing = false; _delayedEnable = false; _enabled = false; if (_timer != null) { _timer.Dispose(); _timer = null; } }
public IHyperTimer StopAt(DateTime stopTime) { DateTime now = DateTimeHelper.PreciseCurrentLocalTime; if (stopTime <= now) { throw new ArgumentOutOfRangeException("stopTime"); } _stopScheduler = new Threading.Timer(state => Stop(), null, stopTime - now, Timeout.InfiniteTimeSpan); return(this); }
public IHyperTimer StopAt(DateTime stopTime) { DateTime now = DateTimeHelper.PreciseCurrentLocalTime; if (stopTime <= now) { throw new ArgumentOutOfRangeException("stopTime"); } _stopScheduler = new Threading.Timer(state => Stop(), null, stopTime - now, Timeout.InfiniteTimeSpan); return this; }
public IHyperTimer StopIn(TimeSpan dueTime) { if (dueTime < TimeSpan.Zero) { throw new ArgumentOutOfRangeException("dueTime"); } _stopScheduler = new Threading.Timer(state => Stop(), null, dueTime, Timeout.InfiniteTimeSpan); return this; }