private void AddWeek(object parameter)
 {
     var week = _weekService.NewWeek(GetMaxStartDate());
     var viewModel = new WeekViewModel(_weekService, _hourCodeProvider, week);
     Weeks.Insert(0,viewModel);
     CurrentWeek = viewModel;
 }
        private void AddWeek(object parameter)
        {
            var week      = _weekService.NewWeek(GetMaxStartDate());
            var viewModel = new WeekViewModel(_weekService, _hourCodeProvider, week);

            Weeks.Insert(0, viewModel);
            CurrentWeek = viewModel;
        }
 public HourUsageViewModel(IHourCodeProvider hourCodeProvider, WeekViewModel weekViewModel, HourUsage usage)
 {
     _hourCodeProvider  = hourCodeProvider;
     Usage              = usage;
     _weekViewModel     = weekViewModel;
     RemoveCommand      = new DelegateCommand(Remove);
     AddHourCodeCommand = new DelegateCommand(AddHourCode);
     HourCode           = new HourCodeViewModel(_hourCodeProvider, usage.HourCode);
 }
        private void RemoveWeek(object obj)
        {
            if (CurrentWeek == null)
            {
                return;
            }
            var currentWeek = CurrentWeek;

            Weeks.Remove(currentWeek);
            CurrentWeek = Weeks.FirstOrDefault();
            _weekService.Remove(currentWeek.Week);
        }
 public WeeksViewModel(IWeekService weekService, IHourCodeProvider hourCodeProvider)
 {
     _weekService      = weekService;
     _hourCodeProvider = hourCodeProvider;
     AddWeekCommand    = new DelegateCommand(AddWeek);
     RemoveWeekCommand = new DelegateCommand(RemoveWeek);
     Weeks             = new ObservableCollection <WeekViewModel>();
     foreach (var week in _weekService.GetRecentWeeks())
     {
         Weeks.Add(new WeekViewModel(_weekService, _hourCodeProvider, week));
     }
     CurrentWeek = Weeks.FirstOrDefault();
 }