private void ConfirmChanges_Click(object sender, RoutedEventArgs e) { AnItemControl anItem = selectedItems.First(); //Should be the only item currently in list selectedItems.Remove(anItem); anItem.ItemDescription.Text = ModDescription.Text; anItem.ItemPrice.Text = "$" + ModPrice.Text; //DEBUG: Needs error checking anItem.price = float.Parse(ModPrice.Text, CultureInfo.InvariantCulture.NumberFormat); anItem.ModButton.Background = new SolidColorBrush(Color.FromRgb(244, 152, 43)); ItemModifying.Visibility = Visibility.Hidden; if (ManageOrder.Visibility == Visibility.Visible) { float totalPrice = 0.00f; float selectedPrice = 0.00f; foreach (object child in tableItemLists[selectedTable - 1].Items.Children) { if (child is AnItemControl) { totalPrice += (child as AnItemControl).price; if ((child as AnItemControl).selected) { selectedPrice += (child as AnItemControl).price; } } } TotalRemaining.Text = totalPrice.ToString("c2"); TotalSelected.Text = selectedPrice.ToString("c2"); } }
public void AnItemModifying(object sender, RoutedEventArgs e, AnItemControl anItem) { ItemModifying.Visibility = Visibility.Visible; ModDescription.Text = anItem.ItemDescription.Text; ModPrice.Text = anItem.price.ToString(); ModDescription.IsReadOnly = false; ModPrice.IsReadOnly = false; }
private void AddItem_Click(object sender, RoutedEventArgs e) { string description = this.name + " (" + this.AddItemNotes.Text + ")"; AnItemControl anItem = new AnItemControl(description, this.price, this.window.selectedItems, this.window); this.window.tableItemLists[this.window.selectedTable - 1].Items.Children.Add(anItem); this.window.tableItemLists[this.window.selectedTable - 1].Scroller.ScrollToEnd(); }
private void AddCustomItem_Click(object sender, RoutedEventArgs e) { string description = this.CustomDescription.Text; string tempPrice = this.CustomPrice.Text; float price = float.Parse(tempPrice, CultureInfo.InvariantCulture.NumberFormat); //DEBUG: Needs error checking AnItemControl anItem = new AnItemControl(description, price, selectedItems, this); tableItemLists[selectedTable - 1].Items.Children.Add(anItem); tableItemLists[selectedTable - 1].Scroller.ScrollToEnd(); }
private void ModButton_Click(object sender, RoutedEventArgs e) { int count = selectedItems.Count; for (int i = 0; i < count; i++) { AnItemControl anItem = selectedItems.First(); anItem.Deselect(); selectedItems.Remove(anItem); } selectedItems.Add(this); this.ModButton.Background = new SolidColorBrush(Color.FromRgb(255, 255, 0)); window.AnItemModifying(sender, e, this); }