private DisplayOneDayViewModel FillDay(WeekDto week, DateTime date) { if (week == null) { throw new ArgumentNullException(nameof(week)); } var days = (from d in week.Days where d.Date.DayOfWeek == date.DayOfWeek select d).ToList(); var vm = new DisplayOneDayViewModel(this.Service, date, days); vm.Load(); return vm; }
public async void LoadWeek() { using (WaitingCursor.While) { this.Status.Loading(); var week = await Task.Run(() => this.Service.GetWeek(this.SelectedDate)); var monday = this.SelectedDate.GetMonday(); if (week != null) { this.DisplayFullWeek(week); Monday = this.FillDay(week, monday); Tuesday = this.FillDay(week, monday.AddDays(1)); Wednesday = this.FillDay(week, monday.AddDays(2)); Thursday = this.FillDay(week, monday.AddDays(3)); Friday = this.FillDay(week, monday.AddDays(4)); this.Status.Ready(); } else { this.Status.Warn(Messages.Msg_NoWeekToDisplay); return; } } }