private bool OnClicked(StockItem item) { this.cartStack.Children.Clear(); this.cartStack.Orientation = Orientation.Vertical; StockItem titem = null; foreach (StockItem citem in this.cartItems) { if (citem.id == item.id) { titem = citem; break; } } if (titem != null) { if (titem.quant == 0) { titem.label.Visibility = Visibility.Visible; } titem.quant += 1; titem.SetLabelContent(); this.SetViewCart(); this.updateCost(); return(true); } titem = new StockItem(item.name, item.id, 1, item.costp, item.sellp); titem.label.FontSize = 16; titem.label.Background = new SolidColorBrush(Color.FromRgb(51, 51, 55)); titem.label.Foreground = Brushes.White; titem.label.Height = 50; titem.label.Width = ScrollVI.Width - 10; titem.onClicked = this.OnRemoveFromCart; titem.SetLabelContent(); this.cartItems.Add(titem); this.SetViewCart(); this.updateCost(); return(true); }
private bool OnClicked(StockItem item) { return(true); }