Пример #1
0
        public MainViewModel(ModelHelpers modelHelpers)
        {
            ModelHelpers = modelHelpers;
            TimerDates   = new ObservableCollection <TimerDateModel>();

            var backgroundRefresh = new Timer(TimeSpan.FromHours(1).TotalMilliseconds);

            backgroundRefresh.Elapsed += (sender, args) => RefreshModel();
            backgroundRefresh.Start();

            modelHelpers.Gallifrey.VersionControl.UpdateStateChange += (sender, args) => NewVersionPresent();
            modelHelpers.Gallifrey.BackendModifiedTimers            += (sender, args) => BackendModification();
            modelHelpers.Gallifrey.SettingsChanged         += (sender, args) => SettingsChanged();
            modelHelpers.Gallifrey.JiraConnection.LoggedIn += (sender, args) => UserLoggedIn();
            modelHelpers.Gallifrey.JiraTimerCollection.GeneralTimerModification += (sender, args) => GeneralTimerModification();
            modelHelpers.Gallifrey.DailyTrackingEvent += (sender, args) => DailyEvent();
            modelHelpers.RefreshModelEvent            += (sender, args) => RefreshModel();
            modelHelpers.SelectRunningTimerEvent      += (sender, args) => SelectRunningTimer();
            modelHelpers.SelectTimerEvent             += (sender, timerId) => SetSelectedTimer(timerId);

            targetBarValues = new TargetBarValues(modelHelpers.Gallifrey);
        }