public StatisticsViewModel(IMeditationDiaryRepository repository)
        {
            if (repository == null)
            {
                throw new ArgumentNullException(nameof(repository));
            }
            _repository = repository;

            UpdateDiaryAndStatistics();

            Messenger.Default.Register<UpdateDiaryMessage>(this, ReceiveUpdateDiaryMessage);
        }
        public DiaryViewModel(IMeditationDiaryRepository repository)
        {
            if (repository == null)
            {
                throw new ArgumentNullException(nameof(repository));
            }
            _repository = repository;

            // Initially update diary
            UpdateDiary();

            Messenger.Default.Register<UpdateDiaryMessage>(this, ReceiveUpdateDiaryMessage);

            DeleteMeditationEntryCommand = new RelayCommand<int>(DeleteMeditationEntry);
        }
Exemple #3
0
        public DiaryViewModel(IMeditationDiaryRepository repository)
        {
            if (repository == null)
            {
                throw new ArgumentNullException(nameof(repository));
            }
            _repository = repository;

            // Initially update diary
            UpdateDiary();

            Messenger.Default.Register <UpdateDiaryMessage>(this, ReceiveUpdateDiaryMessage);

            DeleteMeditationEntryCommand = new RelayCommand <int>(DeleteMeditationEntry);
        }
Exemple #4
0
        /// <summary>
        /// Initializes a new instance of the MainViewModel class.
        /// </summary>
        public TimerViewModel(IMeditationDiaryRepository repository, ISettings settings)
        {
            if (repository == null)
            {
                throw new ArgumentNullException(nameof(repository));
            }
            _repository = repository;

            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }
            _settings = settings;

            StartTimerCommand       = new RelayCommand(StartTimer);
            StopTimerCommand        = new RelayCommand(StopTimer);
            AddFiveMinutesCommand   = new RelayCommand(AddFiveMinutes);
            ResetInitialTimeCommand = new RelayCommand(ResetInitialTime);

            InitializeDispatcherTimer();

            CountdownTimerValue = InitialMeditationTime;
        }