public void TryStartWatchingScreen() { if (_lastMkEventEnd == null) { _lastMkEventEnd = InternalTimeService.GetCurrentDateTime(); } }
public static WorkTime CreateStartedManually() { var workTime = new WorkTime(_id--, UserTestUtils.CreateTestUser(), null, InternalTimeService.GetCurrentDateTime().AddMinutes(10)); workTime.StartManually(); workTime.MarkPendingEventsAsHandled(); return(workTime); }
public void TryAddWatchingScreen() { if (_lastMkEventEnd.HasValue) { var diff = InternalTimeService.GetCurrentDateTime() - _lastMkEventEnd.Value; if (diff.TotalMilliseconds > _config.WatchingScreenThreshold) { Debug.WriteLine("Adding user watching screen diff: " + diff.TotalMilliseconds); WorkTime?.AddUserWatchingScreen(_lastMkEventEnd.Value, (long)diff.TotalMilliseconds, _lastActiveWinExecutable); } _lastMkEventEnd = null; } }
public void SetResored_when_interrupted_generates_event() { var workTime = WorkTimeTestUtils.CreateManual(_user); workTime.StartManually(); workTime.MarkPendingEventsAsHandled(); workTime.SetInterrupted(); workTime.PendingEvents.Last().Should().BeOfType <WorkTimeInterrupted>(); InternalTimeService.GetCurrentDateTime = () => DateTime.UtcNow.AddMilliseconds(2000); workTime.SetRestored(); workTime.PendingEvents.Last().Should().BeOfType <WorkTimeRestored>(); var restoredEv = workTime.PendingEvents.Last() as WorkTimeRestored; restoredEv.TotalTimeMs.Should().BeInRange(2000, 2100); //not throwing workTime.AddRecognitionFailure(InternalTimeService.GetCurrentDateTime(), true, false); }
public void SetStart() { _lastMkEventEnd = InternalTimeService.GetCurrentDateTime(); _lastActiveWinExecutable = UnknownExecutableName; }
public void StartRecognitionFailure() => _recognitionFailureStart = InternalTimeService.GetCurrentDateTime();
public static WorkTime CreateManual(User user) { Debug.WriteLine(_id); return(new WorkTime(Interlocked.Decrement(ref _id), user, null, InternalTimeService.GetCurrentDateTime().AddMinutes(10))); }