private void StartTimer() { if (_timer != null) return; _timer = new Timer(unused => UpdateIsStoreOnline(), null, TimeSpan.FromSeconds(5)); _timer.Start(); }
public ActivityMonitorComponent() { _connectionState = new DisconnectedState(this); _localServerWatcher = LocalServerWatcher.Instance; _textFilterTimer = new Timer(OnTextFilterTimerElapsed, null, 1000); _studyCountWatcher = new StudyCountWatcher(OnStudyCountChanged); _workItemManager = new WorkItemUpdateManager(_workItems.Items, Include, OnFailureCountChanged); _workItemActionModel = new WorkItemActionModel(_workItems.Items, this); }
/// <summary> /// Initializes a new instance of <see cref="DelayedEventPublisher"/>. /// </summary> /// <param name="realEventHandler">The event handler which will be called when the timeout has elapsed.</param> /// <param name="timeoutMilliseconds">The timeout period, in milliseconds, for triggering the real event handler. The default is 350 ms.</param> /// <param name="trigger">Specifies when the real event handler is called after a period of inactivity, or periodically after the last event was raised. The default is to trigger on inactivity.</param> internal DelayedEventPublisherBase(EventHandler realEventHandler, int timeoutMilliseconds = DefaultTimeout, DelayedEventPublisherTriggerMode trigger = DefaultTrigger) { Platform.CheckForNullReference(realEventHandler, "realEventHandler"); Platform.CheckPositive(timeoutMilliseconds, "timeoutMilliseconds"); _realEventHandler = realEventHandler; _timeoutMilliseconds = Math.Max(10, timeoutMilliseconds); _trigger = trigger; _timer = new Timer(OnTimer) {IntervalMilliseconds = 10}; }
/// <summary> /// Constructor. /// </summary> /// <param name="trueEventHandler">The 'true' event handler; calls to which are delayed until /// <paramref name="timeoutMilliseconds"/> has elapsed with no calls to <see cref="Publish(object, EventArgs)"/>.</param> /// <param name="timeoutMilliseconds">The time after which, if <see cref="Publish(object, EventArgs)"/> has not been called, /// to publish the delayed event via <paramref name="trueEventHandler"/>.</param> public DelayedEventPublisher(EventHandler trueEventHandler, int timeoutMilliseconds) { Platform.CheckForNullReference(trueEventHandler, "trueEventHandler"); Platform.CheckPositive(timeoutMilliseconds, "timeoutMilliseconds"); _trueEventHandler = trueEventHandler; _timeoutMilliseconds = Math.Max(10, timeoutMilliseconds); _timer = new Timer(OnTimer); _timer.IntervalMilliseconds = 10; }
public override void Stop() { base.Stop(); _timer.Stop(); _timer.Dispose(); _timer = null; _synchronizationContext = null; lock (_waitLock) { Monitor.Pulse(_waitLock); } _refreshProcessInfoThread.Join(); }
public override void Start() { base.Start(); OnTimer(null); _timer = new Timer(OnTimer, null, 2000); _timer.Start(); _synchronizationContext = SynchronizationContext.Current; _refreshProcessInfoThread = new Thread(PollProcessInfo); _refreshProcessInfoThread.Start(); }
private void StopTimer() { if (_timer == null) return; _timer.Stop(); _timer.Dispose(); _timer = null; }
public StudyCountWatcher(System.Action onChanged) { _throttleTimer = new Timer(OnTimerElapsed, null, TimeSpan.FromSeconds(5)); _onChanged = onChanged; }
/// <summary> /// Disposes the <see cref="DelayedEventPublisher"/>. /// </summary> protected virtual void Dispose(bool disposing) { if (disposing && _timer != null) { _timer.Dispose(); _timer = null; } }
private LocalServerWatcher() { _refreshTimer = new Timer(OnTimerElapsed, null, TimeSpan.FromSeconds(20)); _refreshTimer.Start(); }