public void Add(OrderItem orderItem) { OrderItemCell orderItemCell = new OrderItemCell(orderItem, this); orderItemCell.OnAction += this.OrderItemCell_OnAction; this.pendingItemStackPanel.Children.Add(orderItemCell); this.Update(); this.scrollViewer.ScrollToEnd(); }
private void FinalizeOrder() { foreach (OrderItemCell orderItemCell in this.pendingItemStackPanel.Children) { OrderItemCell orderItemCellCopy = new OrderItemCell(orderItemCell.orderItem, this); orderItemCellCopy.OnAction += this.OrderItemCell_OnAction; this.finalizedItemStackPanel.Children.Add(orderItemCellCopy); orderItemCellCopy.orderItem.isFinalized = true; orderItemCellCopy.update(); //orderItemCell.IsEnabled = !orderItemCell.orderItem.isFinalized; } this.pendingItemStackPanel.Children.Clear(); this.Update(); }
private void OrderItemCell_OnAction(OrderItemCell sender, OrderItemCell.ActionType action) { switch (action) { case OrderItemCell.ActionType.Edit: MessageBox.Show("TODO: Bring up options menu again"); break; case OrderItemCell.ActionType.Delete: if (!sender.orderItem.isFinalized) { this.Remove(sender); } break; case OrderItemCell.ActionType.RequestServer: MessageBox.Show("Server is on the way!"); break; } }
public void Remove(OrderItemCell orderItemCell) { this.pendingItemStackPanel.Children.Remove(orderItemCell); this.Update(); }