public void AddItem(Item item, bool main = true) { if (main) { MainItems.Add(item); } else { InfoItems.Add(item); } }
private void GenerateData() { MainItems.Add(new ItemVm("My Lego", new BitmapImage(new Uri("Images/lego1.jpg", UriKind.Relative)), "5-10")); MainItems.Add(new ItemVm("My Playmobil", new BitmapImage(new Uri("Images/playmobil1.jpg", UriKind.Relative)), "6+")); MainItems[0].AddItem(new ItemVm("Helicopter", new BitmapImage(new Uri("Images/lego1.jpg", UriKind.Relative)), "5-10")); MainItems[0].AddItem(new ItemVm("Machine", new BitmapImage(new Uri("Images/lego2.jpg", UriKind.Relative)), "1-3")); MainItems[0].AddItem(new ItemVm("New Machine", new BitmapImage(new Uri("Images/lego3.jpg", UriKind.Relative)), "3-7")); MainItems[0].AddItem(new ItemVm("Digger", new BitmapImage(new Uri("Images/lego4.jpg", UriKind.Relative)), "10+")); MainItems[1].AddItem(new ItemVm("House", new BitmapImage(new Uri("Images/playmobil1.jpg", UriKind.Relative)), "6+")); MainItems[1].AddItem(new ItemVm("Package", new BitmapImage(new Uri("Images/playmobil2.jpg", UriKind.Relative)), "2-7")); MainItems[1].AddItem(new ItemVm("Warriors", new BitmapImage(new Uri("Images/playmobil3.jpg", UriKind.Relative)), "3-6")); }
public Inventory(BasePlayer player) { var playerInv = player?.inventory?.containerBelt?.itemList; if (playerInv != null) { foreach (Item item in playerInv) { if (item == null) { continue; } BeltItems.Add(new SavedItem(item)); } } playerInv = player?.inventory?.containerMain?.itemList; if (playerInv != null) { foreach (Item item in playerInv) { if (item == null) { continue; } MainItems.Add(new SavedItem(item)); } } playerInv = player?.inventory?.containerWear?.itemList; if (playerInv != null) { foreach (Item item in playerInv) { if (item == null) { continue; } WearItems.Add(new SavedItem(item)); } } }