private void HearbeatOnElapsed(object sender, ElapsedEventArgs elapsedEventArgs) { lock (lockObject) { if (timerCollection.GetRunningTimerId().HasValue) { noTimerRunning.Stop(); noTimerRunning.Reset(); eventsSent = 0; } else { if (!noTimerRunning.IsRunning) { noTimerRunning.Start(); } if (noTimerRunning.ElapsedMilliseconds >= appSettings.AlertTimeMilliseconds) { eventsSent++; noTimerRunning.Reset(); var handler = NoActivityEvent; if (handler != null) { handler(this, eventsSent * appSettings.AlertTimeMilliseconds); } } } } }
private void HearbeatOnElapsed(object sender, ElapsedEventArgs elapsedEventArgs) { lock (lockObject) { if (timerCollection.GetRunningTimerId().HasValue || TemporaryStopActivityCheck) { if (noTimerRunning.IsRunning) { noTimerRunning.Stop(); NoActivityEvent?.Invoke(this, 0); } noTimerRunning.Reset(); eventsSent = 0; } else { if (!noTimerRunning.IsRunning) { noTimerRunning.Start(); } if (noTimerRunning.ElapsedMilliseconds >= appSettings.AlertTimeMilliseconds) { eventsSent++; noTimerRunning.Reset(); NoActivityEvent?.Invoke(this, eventsSent * appSettings.AlertTimeMilliseconds); } } } }