protected override void UpdateContent() { AllItems.Clear(); IList <Item> all_items = FindAllItems(mSearchField, mSearchValue); foreach (Item item in all_items) { AllItems.Add(item); } SoldItems.Clear(); IList <Item> sold_items = FindSoldItems(mSearchField, mSearchValue); foreach (Item item in sold_items) { SoldItems.Add(item); } BoughtItems.Clear(); IList <Item> bought_items = FindBoughtItems(mSearchField, mSearchValue); foreach (Item item in bought_items) { BoughtItems.Add(item); } InventoriedItems.Clear(); IList <Item> inventoried_items = FindInventoriedItems(mSearchField, mSearchValue); foreach (Item item in inventoried_items) { InventoriedItems.Add(item); } }
public ItemsWindow(List <Item> items) { InitializeComponent(); DataContext = this; MyCustomMessageQueue = new SnackbarMessageQueue(TimeSpan.FromMilliseconds(1000)); itemsSource = new ObservableCollection <Item>(items); Items = new ObservableCollection <Item>(items); for (int i = 0; i < 9; i++) { BoughtItems.Add(emptyItem); } }
private void RemoveBoughtItem(object sender, MouseEventArgs e) { Image itemImage = (Image)sender; Item itemToRemove = (Item)itemImage.DataContext; if (itemToRemove != emptyItem) { BoughtItems.Remove(itemToRemove); BoughtItems.Add(emptyItem); boughtItemCount--; calculateRemainingPrice(); } }