public MainWindowViewModel() { exerciseService = new ExerciseService("ExercisesDbConnection"); Sections = mapperDTOToPresent.Map <ObservableCollection <CheckedListExerciseItem> >(exerciseService.GetAll()); timer = new DispatcherTimer(); timer.Interval = TimeSpan.FromSeconds(1); timer.Tick += new EventHandler(timer_Tick); }
private void UpdateInfo() { exerciseService = new ExerciseService("ExercisesDbConnection"); Sections = mapperDTOToPresent.Map <ObservableCollection <CheckedListExerciseItem> >(exerciseService.GetAll()); timeLeft = selectedInterval; OnPropertyChanged("TimeLeft"); if (_shouldStartLoop) { _isTimerStarted = true; StopTimerCommand.RaiseCanExecuteChanged(); StartTimerCommand.RaiseCanExecuteChanged(); timer.Start(); } }