public void SetModel(Model model) { this.model = model; Items = model.GetItems(); model.ItemsChanged += Model_ItemsChanged; CreateItem = new Mvvm1125.MvvmCommand( () => PageContainer.ChangePageTo(PageType.CreateItem), () => true); EditRecipe = new Mvvm1125.MvvmCommand( () => PageContainer.ChangePageTo(PageType.EditRecipe), () => true); }
public void SetModel(Model model) { this.model = model; Items = model.GetItems(); BackToList = new Mvvm1125.MvvmCommand( () => PageContainer.ChangePageTo(PageType.ListItems), () => true); CreateItem = new Mvvm1125.MvvmCommand( () => { if (model.TryJoin(FirstItem, SecondItem)) { Message = "Вы создали новый предмет!"; } else { Message = "Невозможно!"; } NotifyPropertyChanged("Message"); }, () => FirstItem != null & SecondItem != null); BaseItems = new List <BaseItem>(); BaseItems.Add(new BaseItem { Name = "Корень имбиря", CreateBaseItem = new Mvvm1125.MvvmCommand( () => model.AddItem(new Item { Name = "Корень имбиря" }), () => true) }); BaseItems.Add(new BaseItem { Name = "Хлеб", CreateBaseItem = new Mvvm1125.MvvmCommand( () => model.AddItem(new Item { Name = "Хлеб" }), () => true) }); BaseItems.Add(new BaseItem { Name = "Шерсть", CreateBaseItem = new Mvvm1125.MvvmCommand( () => model.AddItem(new Item { Name = "Шерсть" }), () => true) }); model.ItemsChanged += Model_ItemsChanged; }
private void PageContainer_CurrentPageChanged(object sender, PageType e) { CurrentPage = PageContainer.GetPageByType(e); NotifyPropertyChanged("CurrentPage"); }