public TimeInfoViewModel( [NotNull] ILog logger, [NotNull] IActivityProcessor activityProcessor, [NotNull] IReportSerializer reportSerializer, [NotNull] IStatusChangeEventRepository statusChangeEventRepository) { _statusChangeEventRepository = statusChangeEventRepository ?? throw new ArgumentNullException(nameof(statusChangeEventRepository)); activityProcessor = activityProcessor ?? throw new ArgumentNullException(nameof(activityProcessor)); ToggleCommand = new CorrelationCommand <ActivityReportItemViewModel>(Toggle); _report = activityProcessor.GenerateReport(DateTime.Now); _timer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(1) }; _timer.Start(); _report = activityProcessor.GenerateReport(DateTime.Now); ActivityReportItems.Clear(); foreach (var viewModelItem in _report.Items.Select(item => new ActivityReportItemViewModel(item))) { ActivityReportItems.Add(viewModelItem); } SetCurrentTimeInfo(); _timer.Tick += Timer_Tick; }
public ActivityProcessor([NotNull] IStatusChangeEventRepository statusChangeEventRepository) { _statusChangeEventRepository = statusChangeEventRepository ?? throw new ArgumentNullException(nameof(statusChangeEventRepository)); SystemEvents.SessionSwitch += SystemEvents_SessionSwitch; }