/// <summary> /// Called when an attached view's Loaded event fires. /// </summary> /// <param name="view"/> protected override void OnViewLoaded(object view) { base.OnViewLoaded(view); if (_window != null) { _window.StateChanged -= OnWindowStateChanged; } _window = Window.GetWindow((DependencyObject)view); if (_window != null) { _window.StateChanged += OnWindowStateChanged; _dispatcher = _window.Dispatcher; } Settings.Default.PropertyChanged -= OnSettingsPropertyChanged; Settings.Default.PropertyChanged += OnSettingsPropertyChanged; _activityTracker.UpdateUserActivityLog(); RefreshData(); _activityTracker.ActivityLogUpdated -= OnActivityLogUpdated; _activityTracker.ActivityLogUpdated += OnActivityLogUpdated; _notificationManager.UnknownActivityRecordUpdated -= OnActivityLogUpdated; _notificationManager.UnknownActivityRecordUpdated += OnActivityLogUpdated; }
/// <summary> /// Called when an attached view's Loaded event fires. /// </summary> /// <param name="view"/> protected override void OnViewLoaded(object view) { base.OnViewLoaded(view); _activityTracker.UpdateUserActivityLog(); _states.Clear(); foreach (var state in _activityRecordsRepository.GetActivityLog(DateTime.Now)) { _states.Add(state); } }
public void CheckUnknownActivityRecords() { Task.Run( () => { _userActivityTracker.UpdateUserActivityLog(); IEnumerable <ActivityRecord> unknownActivityRecords = _activityRecordsRepository.GetUnknownActivityRecords(); foreach (var record in unknownActivityRecords) { _unknownActivityNotificationViewModel.AddRecord(record); } if (_unknownActivityNotificationViewModel.ActivityRecords.Any()) { ShowUnknownActivitiesNotification(); } }); }