public SlideWeekIntervalViewModel(SKDSlideWeekInterval slideWeekInterval) { SlideWeekInterval = slideWeekInterval; AddCommand = new RelayCommand(OnAdd, CanAdd); RemoveCommand = new RelayCommand(OnRemove, CanRemove); WeeklyIntervals = new ObservableCollection<SlideWeekIntervalPartViewModel>(); foreach (var weeklyIntervalUID in slideWeekInterval.WeeklyIntervalUIDs) { var weeklyInterval = SKDManager.SKDConfiguration.WeeklyIntervals.FirstOrDefault(x => x.UID == weeklyIntervalUID); if (weeklyInterval != null) { var slideWeekIntervalPartViewModel = new SlideWeekIntervalPartViewModel(this, weeklyInterval); WeeklyIntervals.Add(slideWeekIntervalPartViewModel); } } }
public SlideWeekIntervalDetailsViewModel(SKDSlideWeekInterval slideWeekInterval = null) { if (slideWeekInterval == null) { Title = "Новый скользящий понедельный график"; slideWeekInterval = new SKDSlideWeekInterval() { Name = "Скользящий понедельный график" }; } else { Title = "Редактирование скользящего понедельного графика"; } SlideWeekInterval = slideWeekInterval; Name = SlideWeekInterval.Name; Description = SlideWeekInterval.Description; StartDate = SlideWeekInterval.StartDate; }