private void Tick(object sender, EventArgs args) { var now = UnixTime.Now(); if (now - _lastTime > _data.UpdateInterval * 60) { _onTick?.Invoke(); _lastTime = now; } }
private void Tick(object sender, EventArgs args) { long now = UnixTime.Now(); if (now - lastTime > Data.UpdateInterval * 60) { onTick?.Invoke(); lastTime = now; } }
public Heart(ApplicationData data, Action onTick) { _data = data; _onTick = onTick; _lastTime = UnixTime.Now(); _timer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(1) }; _timer.Tick += Tick; _timer.Start(); }
public Heart(ApplicationData Data, Action onTick) { this.Data = Data; this.onTick = onTick; lastTime = UnixTime.Now(); timer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(1) }; timer.Tick += Tick; timer.Start(); }