// Конструктор модели представления public GroupListViewModel(StudentHostelContext context) : base(context) { GetData(); if (GroupList == null) { CurrentGroup = null; } else if (GroupList.Count == 0) { CurrentGroup = null; } else { CurrentGroup = GroupList.First(); } // Инициализация команд AddCommand = new Command(Add, () => { return(!(IsAdding || IsEditing) && context != null); }); EditCommand = new Command(Edit, () => { return(!(IsAdding || IsEditing) && context != null); }); SaveCommand = new Command(SaveChanges, () => { return((IsAdding || IsEditing) && context != null); }); DeleteCommand = new Command(Delete, () => { return(!(IsAdding || IsEditing) && context != null); }); CancelCommand = new Command(DiscardChanges, () => { return((IsAdding || IsEditing) && context != null); }); }