public void Fill(TrainingPlan plan) { var groups = new Dictionary <string, InGroup <TrainingPlanEntryViewModel> >(); _entries = new ObservableCollection <InGroup <TrainingPlanEntryViewModel> >(); foreach (var day in plan.Days) { var group = new InGroup <TrainingPlanEntryViewModel>(day.Name); group.Tag = day; groups[day.Name] = group; _entries.Add(group); foreach (var entry in day.Entries) { groups[day.Name].Add(new TrainingPlanEntryViewModel(entry)); } } LongList.ItemsSource = _entries; }
private void btnUseInToday_Click(object sender, RoutedEventArgs e) { buttonPressed = true; var button = (RoundButton)sender; InGroup <TrainingPlanEntryViewModel> group = (InGroup <TrainingPlanEntryViewModel>)button.Tag; TrainingPlanDay planDay = (TrainingPlanDay)group.Tag; var workoutPlan = planDay.TrainingPlan; if (!workoutPlan.IsFavorite && !workoutPlan.IsMine) { BAMessageBox.ShowInfo(ApplicationStrings.WorkoutPlanViewControl_ErrMustAddPlanToFavorites); return; } if (BAMessageBox.Ask(ApplicationStrings.WorkoutPlanViewControl_btnUseInToday_QUsePlanInCalendar) == MessageBoxResult.Cancel) { return; } fillStrengthTrainingEntryWithPlan(planDay); }