public PlayerModel(BuilderContext context) { Context = context; EditItem = new Command(async(par) => { if (par is InventoryViewModel ivm) { if (ivm.Item != null) { await ShopNavigation.PushAsync(new ItemPage(new ItemViewModel(this, ivm.Item))); } else { await ShopNavigation.PushAsync(InfoPage.Show(ivm.Boon)); } } }); ShowItemInfo = new Command(async(par) => { if (par is InventoryViewModel ivm) { if (ivm.Item is Possession p) { await ShopNavigation.PushAsync(InfoPage.Show(new DisplayPossession(ivm.Item, Context.Player))); } else { await ShopNavigation.PushAsync(InfoPage.Show(ivm.Boon)); } } }); DeleteItem = new Command((par) => { if (par is InventoryViewModel ivm) { if (ivm.Item is Possession p) { Context.MakeHistory(""); Context.Player.RemovePossessionAndItems(p); Save(); } else if (ivm.Boon is Feature f) { Context.MakeHistory(""); Context.Player.RemoveBoon(f); Save(); } FirePlayerChanged(); } }); RefreshItems = new Command(() => { ItemsBusy = true; UpdateItems(); OnPropertyChanged("Carried"); ItemsBusy = false; }); UpdateItems(); OnOpenShop = new Command(async(par) => { if (par is ShopViewModel svm) { await ShopNavigation.PushAsync(new ShopSubPage(svm)); } }); UpdateShops(); UpdateInventoryChoices(); }