void OnAddDakotaDoubleBurgerButtonClicked(object sender, RoutedEventArgs e) { //o.Add(new DakotaDoubleBurger()); orderControl = this.FindAncestor <OrderControl>(); if (DataContext is Order order) { var entree = new DakotaDoubleBurger(); var screen = new CustomizeDakotaDoubleBurger(); screen.DataContext = entree; order.Add(entree); orderControl.SwapScreen(screen); } }
void OnAddPecosPulledPorkButtonClicked(object sender, RoutedEventArgs e) { //o.Add(new PecosPulledPork()); orderControl = this.FindAncestor <OrderControl>(); if (DataContext is Order order) { var entree = new PecosPulledPork(); var screen = new CustomizePecosPulledPork(); screen.DataContext = entree; order.Add(entree); orderControl.SwapScreen(screen); } }
void OnAddChiliCheeseFriesButtonClicked(object sender, RoutedEventArgs e) { //OrderListView.Items.Add(new ChiliCheeseFries()); //o.Add(new ChiliCheeseFries()); /*if (DataContext is Order order) * { * order.Add(new ChiliCheeseFries()); * }*/ orderControl = this.FindAncestor <OrderControl>(); if (DataContext is Order order) { var side = new ChiliCheeseFries(); var screen = new CustomizeSide(); screen.DataContext = side; order.Add(side); orderControl.SwapScreen(screen); } }
/// <summary> /// Event handler for order selection changes /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void OnListBoxSelectionChanged(object sender, SelectionChangedEventArgs e) { if (e.AddedItems.Count <= 0 || e.AddedItems[0] == null) { return; } if (e.AddedItems[0] is IOrderItem item) { OrderControl orderControl = this.FindAncestor <OrderControl>(); if (DataContext is Order order) { OrderCustomizeControl screen = new OrderCustomizeControl(); screen.DataContext = item; orderControl.SwapScreen(screen); // Switch screen } } }
/// <summary> /// Function to toggle screen to go back to customization later on in the order process /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void ToggleScreen(object sender, RoutedEventArgs e) { if (sender is ListBox li) { if (li.SelectedItem is IOrderItem ioi) { if (ioi is AngryChicken angryChicken) { var screen = new CustomizeAngryChicken(); screen.DataContext = angryChicken; orderControl = this.FindAncestor <OrderControl>(); orderControl.SwapScreen(screen); } else if (ioi is BakedBeans bakedBeans) { var screen = new CustomizeBakedBeans(); screen.DataContext = bakedBeans; orderControl = this.FindAncestor <OrderControl>(); orderControl.SwapScreen(screen); } else if (ioi is ChiliCheeseFries chiliCheeseFries) { var screen = new CustomizeChiliCheeseFries(); screen.DataContext = chiliCheeseFries; orderControl = this.FindAncestor <OrderControl>(); orderControl.SwapScreen(screen); } else if (ioi is CornDodgers cornDodgers) { var screen = new CustomizeCornDodgers(); screen.DataContext = cornDodgers; orderControl = this.FindAncestor <OrderControl>(); orderControl.SwapScreen(screen); } else if (ioi is CowboyCoffee cowboyCoffee) { var screen = new CustomizeCowboyCoffee(); screen.DataContext = cowboyCoffee; orderControl = this.FindAncestor <OrderControl>(); orderControl.SwapScreen(screen); } else if (ioi is CowpokeChili cowpokeChili) { var screen = new CustomizeCowpokeChili(); screen.DataContext = cowpokeChili; orderControl = this.FindAncestor <OrderControl>(); orderControl.SwapScreen(screen); } else if (ioi is DakotaDoubleBurger dakotaDoubleBurger) { var screen = new CustomizeDakotaDoubleBurger(); screen.DataContext = dakotaDoubleBurger; orderControl = this.FindAncestor <OrderControl>(); orderControl.SwapScreen(screen); } else if (ioi is JerkedSoda jerkedSoda) { var screen = new CustomizeJerkedSoda(); screen.DataContext = jerkedSoda; orderControl = this.FindAncestor <OrderControl>(); orderControl.SwapScreen(screen); } else if (ioi is PanDeCampo panDeCampo) { var screen = new CustomizePanDeCampo(); screen.DataContext = panDeCampo; orderControl = this.FindAncestor <OrderControl>(); orderControl.SwapScreen(screen); } else if (ioi is PecosPulledPork pecosPulledPork) { var screen = new CustomizePecosPulledPork(); screen.DataContext = pecosPulledPork; orderControl = this.FindAncestor <OrderControl>(); orderControl.SwapScreen(screen); } else if (ioi is RustlersRibs rustlersRibs) { var screen = new CustomizeRustlersRibs(); screen.DataContext = rustlersRibs; orderControl = this.FindAncestor <OrderControl>(); orderControl.SwapScreen(screen); } else if (ioi is TexasTea texasTea) { var screen = new CustomizeTexasTea(); screen.DataContext = texasTea; orderControl = this.FindAncestor <OrderControl>(); orderControl.SwapScreen(screen); } else if (ioi is TexasTripleBurger texasTripleBurger) { var screen = new CustomizeTexasTripleBurger(); screen.DataContext = texasTripleBurger; orderControl = this.FindAncestor <OrderControl>(); orderControl.SwapScreen(screen); } else if (ioi is TrailBurger trailBurger) { var screen = new CustomizeTrailBurger(); screen.DataContext = trailBurger; orderControl = this.FindAncestor <OrderControl>(); orderControl.SwapScreen(screen); } else if (ioi is Water water) { var screen = new CustomizeWater(); screen.DataContext = water; orderControl = this.FindAncestor <OrderControl>(); orderControl.SwapScreen(screen); } else { return; } } } }
public void OnItemSelectionChanged(object sender, SelectionChangedEventArgs e, OrderControl oc, Order o) { var item = e.AddedItems[0]; if (e.AddedItems[0] is CowpokeChili) { var screen = new CustomizeEntree("Cowpoke Chili"); screen.DataContext = item; oc.SwapScreen(screen); } if (e.AddedItems[0] is AngryChicken) { var screen = new CustomizeEntree("Angry Chicken"); screen.DataContext = item; oc.SwapScreen(screen); } if (e.AddedItems[0] is DakotaDoubleBurger) { var screen = new CustomizeEntree("Dakota Double Burger"); screen.DataContext = item; oc.SwapScreen(screen); } if (e.AddedItems[0] is PecosPulledPork) { var screen = new CustomizeEntree("Pecos Pulled Pork"); screen.DataContext = item; oc.SwapScreen(screen); } if (e.AddedItems[0] is RustlersRibs) { var screen = new CustomizeEntree("Rustler Ribs"); screen.DataContext = item; oc.SwapScreen(screen); } if (e.AddedItems[0] is TexasTripleBurger) { var screen = new CustomizeEntree("Texas Triple Burger"); screen.DataContext = item; oc.SwapScreen(screen); } if (e.AddedItems[0] is TrailBurger) { var screen = new CustomizeEntree("Trail Burger"); screen.DataContext = item; oc.SwapScreen(screen); } if (e.AddedItems[0] is CowboyCoffee) { var screen = new CustomizeDrink("Cowboy Coffee", e.AddedItems[0], o); screen.DataContext = item; oc.SwapScreen(screen); } if (e.AddedItems[0] is JerkedSoda) { var screen = new CustomizeDrink("Jerked Soda", e.AddedItems[0], o); screen.DataContext = item; oc.SwapScreen(screen); } if (e.AddedItems[0] is TexasTea) { var screen = new CustomizeDrink("Texas Tea", e.AddedItems[0], o); screen.DataContext = item; oc.SwapScreen(screen); } if (e.AddedItems[0] is Water) { var screen = new CustomizeDrink("Water", e.AddedItems[0], o); screen.DataContext = item; oc.SwapScreen(screen); } if (e.AddedItems[0] is BakedBeans) { var screen = new CustomizeSide(e.AddedItems[0], o); screen.DataContext = item; oc.SwapScreen(screen); } if (e.AddedItems[0] is ChiliCheeseFries) { var screen = new CustomizeSide(e.AddedItems[0], o); screen.DataContext = item; oc.SwapScreen(screen); } if (e.AddedItems[0] is CornDodgers) { var screen = new CustomizeSide(e.AddedItems[0], o); screen.DataContext = item; oc.SwapScreen(screen); } if (e.AddedItems[0] is PanDeCampo) { var screen = new CustomizeSide(e.AddedItems[0], o); screen.DataContext = item; oc.SwapScreen(screen); } }
public void SwitchScreen(object sender, RoutedEventArgs e) { if (sender is ListBox box) { if (box.SelectedItem is IOrderItem item) { box.SelectedItem = null; if (item is AngryChicken chicken) { order = this.FindAncestor <OrderControl>(); var screen = new CustomizeAngryChicken(); screen.DataContext = chicken; order.SwapScreen(screen); } else if (item is BakedBeans bean) { order = this.FindAncestor <OrderControl>(); var screen = new CustomizeSide(); screen.DataContext = bean; order.SwapScreen(screen); } else if (item is ChiliCheeseFries fries) { order = this.FindAncestor <OrderControl>(); var screen = new CustomizeSide(); screen.DataContext = fries; order.SwapScreen(screen); } else if (item is CornDodgers corn) { order = this.FindAncestor <OrderControl>(); var screen = new CustomizeSide(); screen.DataContext = corn; order.SwapScreen(screen); } else if (item is CowboyCoffee coffee) { order = this.FindAncestor <OrderControl>(); var screen = new CustomizeCowboyCoffee(); screen.DataContext = coffee; order.SwapScreen(screen); } else if (item is CowpokeChili chili) { order = this.FindAncestor <OrderControl>(); var screen = new CustomizeCowpokeChili(); screen.DataContext = chili; order.SwapScreen(screen); } else if (item is DakotaDoubleBurger dakota) { order = this.FindAncestor <OrderControl>(); var screen = new CustomizeDakotaDouble(); screen.DataContext = dakota; order.SwapScreen(screen); } else if (item is JerkedSoda soda) { order = this.FindAncestor <OrderControl>(); var screen = new CustomizeJerkedSoda(); screen.DataContext = soda; order.SwapScreen(screen); } else if (item is PanDeCampo pan) { order = this.FindAncestor <OrderControl>(); var screen = new CustomizeSide(); screen.DataContext = pan; order.SwapScreen(screen); } else if (item is PecosPulledPork pork) { order = this.FindAncestor <OrderControl>(); var screen = new CustomizePecosPulledPork(); screen.DataContext = pork; order.SwapScreen(screen); } else if (item is TexasTea tea) { order = this.FindAncestor <OrderControl>(); var screen = new CustomizeTexasTea(); screen.DataContext = tea; order.SwapScreen(screen); } else if (item is TexasTripleBurger tex) { order = this.FindAncestor <OrderControl>(); var screen = new CustomizeTexasTriple(); screen.DataContext = tex; order.SwapScreen(screen); } else if (item is TrailBurger burger) { order = this.FindAncestor <OrderControl>(); var screen = new CustomizeTrailburger(); screen.DataContext = burger; order.SwapScreen(screen); } else if (item is Water water) { order = this.FindAncestor <OrderControl>(); var screen = new CustomizeWater(); screen.DataContext = water; order.SwapScreen(screen); } } } }
private void Cancel_Clicked(object sender, RoutedEventArgs e) { OrderControl parent = (OrderControl)((Border)Parent).Parent; parent.SwapScreen(null); }
/// <summary> /// Allows customization of selected item from summary control /// </summary> /// <param name="sender"></param> /// <param name="args"></param> public void OnItemSelection(object sender, SelectionChangedEventArgs args) { FrameworkElement screen; OrderControl orderControl = null; // Need ancestor to load customization screen orderControl = this.FindAncestor <OrderControl>(); if (orderControl == null) { throw new Exception("An ancestor of OrderControl expected"); } // Entrees --------------------------------------------------------------------- if (orderList.SelectedItem is IOrderItem item) { if (item is AngryChicken angryChicken) { screen = new AngryChickenCustomization(angryChicken); if (screen != null) { // Add item to customization screen screen.DataContext = angryChicken; orderControl.SwapScreen(screen); } } else if (orderList.SelectedItem is CowpokeChili cowpokeChili) { screen = new CowpokeChiliCustomization(cowpokeChili); if (screen != null) { // Add item to customization screen screen.DataContext = cowpokeChili; orderControl.SwapScreen(screen); } } else if (orderList.SelectedItem is DakotaDoubleBurger dakotaDouble) { screen = new DakotaDoubleBurgerCustomization(dakotaDouble); if (screen != null) { // Add item to customization screen screen.DataContext = dakotaDouble; orderControl.SwapScreen(screen); } } else if (orderList.SelectedItem is PecosPulledPork pecosPulledPork) { screen = new PecosPulledPorkCustomization(pecosPulledPork); if (screen != null) { // Add item to customization screen screen.DataContext = pecosPulledPork; orderControl.SwapScreen(screen); } } else if (orderList.SelectedItem is TexasTripleBurger texasTriple) { screen = new TexasTripleBurgerCustomization(texasTriple); if (screen != null) { // Add item to customization screen screen.DataContext = texasTriple; orderControl.SwapScreen(screen); } } else if (orderList.SelectedItem is TrailBurger trailBurger) { screen = new TrailBurgerCustomization(trailBurger); if (screen != null) { // Add item to customization screen screen.DataContext = trailBurger; orderControl.SwapScreen(screen); } } // Sides --------------------------------------------------------------------- else if (orderList.SelectedItem is BakedBeans bakedBeans) { screen = new BakedBeansCustomization(bakedBeans); if (screen != null) { // Add item to customization screen screen.DataContext = bakedBeans; orderControl.SwapScreen(screen); } } else if (orderList.SelectedItem is ChiliCheeseFries chiliCheeseFries) { screen = new ChiliCheeseFriesCustomization(chiliCheeseFries); if (screen != null) { // Add item to customization screen screen.DataContext = chiliCheeseFries; orderControl.SwapScreen(screen); } } else if (orderList.SelectedItem is CornDodgers cornDodgers) { screen = new CornDodgersCustomization(cornDodgers); if (screen != null) { // Add item to customization screen screen.DataContext = cornDodgers; orderControl.SwapScreen(screen); } } else if (orderList.SelectedItem is PanDeCampo panDeCampo) { screen = new PandeCampoCustomization(panDeCampo); if (screen != null) { // Add item to customization screen screen.DataContext = panDeCampo; orderControl.SwapScreen(screen); } } // Drinks --------------------------------------------------------------------- else if (orderList.SelectedItem is CowboyCoffee cowboyCoffee) { screen = new CowboyCoffeeCustomization(cowboyCoffee); if (screen != null) { // Add item to customization screen screen.DataContext = cowboyCoffee; orderControl.SwapScreen(screen); } } else if (orderList.SelectedItem is JerkedSoda jerkedSoda) { screen = new JerkedSodaCustomization(jerkedSoda); if (screen != null) { // Add item to customization screen screen.DataContext = jerkedSoda; orderControl.SwapScreen(screen); } } else if (orderList.SelectedItem is TexasTea texasTea) { screen = new TexasTeaCustomization(texasTea); if (screen != null) { // Add item to customization screen screen.DataContext = texasTea; orderControl.SwapScreen(screen); } } else if (orderList.SelectedItem is Water water) { screen = new WaterCustomization(water); if (screen != null) { // Add item to customization screen screen.DataContext = water; orderControl.SwapScreen(screen); } } // All else --------------------------------------------------------------------- else { // Add item to customization screen orderControl?.SwapScreen(new MenuItemSelectionControl()); } orderList.SelectedItem = null; } }
private void Button_Click(object sender, RoutedEventArgs e) { OrderControl orderControll = ((OrderControl)((Border)(this.Parent)).Parent); orderControll.SwapScreen(null); }
// Generic handler for ItemAddButton clicked event public void OnItemAddButtonClicked(object sender, RoutedEventArgs e) { orderControl = this.FindAncestor <OrderControl>(); if (DataContext is Order order) { if (sender is Button button) { IOrderItem item = null; OrderCustomizeControl screen = new OrderCustomizeControl(); switch (button.Tag) { case "Angry Chicken": item = new AngryChicken(); break; case "Cowpoke Chili": item = new CowpokeChili(); break; case "Dakota Double Burger": item = new DakotaDoubleBurger(); break; case "Pecos Pulled Pork": item = new PecosPulledPork(); break; case "Rustlers Ribs": item = new RustlersRibs(); break; case "Texas Triple Burger": item = new TexasTripleBurger(); break; case "Trail Burger": item = new TrailBurger(); break; case "Baked Beans": item = new BakedBeans(); break; case "Chili Cheese Fries": item = new ChiliCheeseFries(); break; case "Corn Dodgers": item = new CornDodgers(); break; case "Pan de Campo": item = new PanDeCampo(); break; case "Cowboy Coffee": item = new CowboyCoffee(); break; case "Jerked Soda": item = new JerkedSoda(); break; case "Texas Tea": item = new TexasTea(); break; case "Water": item = new Water(); break; default: throw new NotImplementedException(); } screen.DataContext = item; order.AddItem(item); orderControl.SwapScreen(screen); // Switch screen } } }
void OnListBoxItemSelected(object sender, SelectionChangedEventArgs args) { if(sender is ListBox lb) { if(lb.SelectedItem is IOrderItem orderItem) { if(orderItem is AngryChicken ac) { var screen = new CustomizeAngryChicken(); screen.DataContext = ac; orderControl = this.FindAncestor<OrderControl>(); orderControl.SwapScreen(screen); } else if (orderItem is CowboyCoffee c) { var screen = new CustomizeCowboyCoffee(); screen.DataContext = c; screen.SetButton(); orderControl = this.FindAncestor<OrderControl>(); orderControl.SwapScreen(screen); } else if (orderItem is CowpokeChili chili) { var screen = new CustomizeCowpokeChili(); screen.DataContext = chili; orderControl = this.FindAncestor<OrderControl>(); orderControl.SwapScreen(screen); } else if (orderItem is DakotaDoubleBurger db) { var screen = new CustomizeDakotaDoubleBurger(); screen.DataContext = db; orderControl = this.FindAncestor<OrderControl>(); orderControl.SwapScreen(screen); } else if (orderItem is JerkedSoda soda) { var screen = new CustomizeJerkedSoda(); screen.DataContext = soda; screen.SetButton(); screen.SetFlavorButton(); orderControl = this.FindAncestor<OrderControl>(); orderControl.SwapScreen(screen); } else if (orderItem is PecosPulledPork pork) { var screen = new CustomizePecosPulledPork(); screen.DataContext = pork; orderControl = this.FindAncestor<OrderControl>(); orderControl.SwapScreen(screen); } else if (orderItem is Side s) { var screen = new CustomizeSide(); screen.DataContext = s; screen.SetButton(); //sets the correct radio button to be checked orderControl = this.FindAncestor<OrderControl>(); orderControl.SwapScreen(screen); } else if (orderItem is TexasTea t) { var screen = new CustomizeTexasTea(); screen.DataContext = t; screen.SetButton(); orderControl = this.FindAncestor<OrderControl>(); orderControl.SwapScreen(screen); } else if (orderItem is TexasTripleBurger triple) { var screen = new CustomizeTexasTripleBurger(); screen.DataContext = triple; orderControl = this.FindAncestor<OrderControl>(); orderControl.SwapScreen(screen); } else if (orderItem is TrailBurger tb) { var screen = new CustomizeTrailBurger(); screen.DataContext = tb; orderControl = this.FindAncestor<OrderControl>(); orderControl.SwapScreen(screen); } else if (orderItem is Water w) { var screen = new CustomizeWater(); screen.DataContext = w; screen.SetButton(); orderControl = this.FindAncestor<OrderControl>(); orderControl.SwapScreen(screen); } } } }
/// <summary> /// This is an action handler to the xaml so that when the user clicks on the order summary and selects which item to edit /// this method fires off and finds which screen and properties to display. /// </summary> /// <param name="sender">??</param> /// <param name="e">??</param> public void OnItemClick(object sender, SelectionChangedEventArgs e) { if (sender is ListBox listBox) { if (listBox.SelectedItem is IOrderItems listBoxItem) { if (listBoxItem is AngryChicken chicken) { var screen = new CustomizeAngryChicken(); screen.DataContext = chicken; control = this.FindAncestor <OrderControl>(); control.SwapScreen(screen); } if (listBoxItem is CowpokeChili chili) { var screen = new CustomizeCowpokeChili(); screen.DataContext = chili; control = this.FindAncestor <OrderControl>(); control.SwapScreen(screen); } if (listBoxItem is PecosPulledPork pork) { var screen = new CustomizePecosPulledPork(); screen.DataContext = pork; control = this.FindAncestor <OrderControl>(); control.SwapScreen(screen); } if (listBoxItem is TrailBurger trailBurger) { var screen = new CustomizeTrailBurger(); screen.DataContext = trailBurger; control = this.FindAncestor <OrderControl>(); control.SwapScreen(screen); } if (listBoxItem is DakotaDoubleBurger dakotaDouble) { var screen = new CustomizeDakotaDouble(); screen.DataContext = dakotaDouble; control = this.FindAncestor <OrderControl>(); control.SwapScreen(screen); } if (listBoxItem is TexasTripleBurger texasTriple) { var screen = new CustomizeTexasTriple(); screen.DataContext = texasTriple; control = this.FindAncestor <OrderControl>(); control.SwapScreen(screen); } if (listBoxItem is BakedBeans baked) { var screen = new CustomizeBakedBeans(); screen.DataContext = baked; control = this.FindAncestor <OrderControl>(); control.SwapScreen(screen); } if (listBoxItem is ChiliCheeseFries cheeseFries) { var screen = new CustomizeChiliCheeseFries(); screen.DataContext = cheeseFries; control = this.FindAncestor <OrderControl>(); control.SwapScreen(screen); } if (listBoxItem is CornDodgers dodgers) { var screen = new CustomizeCornDodgers(); screen.DataContext = dodgers; control = this.FindAncestor <OrderControl>(); control.SwapScreen(screen); } if (listBoxItem is PanDeCampo pan) { var screen = new CustomizePanDeCampo(); screen.DataContext = pan; control = this.FindAncestor <OrderControl>(); control.SwapScreen(screen); } if (listBoxItem is JerkedSoda soda) { var screen = new CustomizeJerkedSoda(); screen.DataContext = soda; control = this.FindAncestor <OrderControl>(); control.SwapScreen(screen); } if (listBoxItem is TexasTea tea) { var screen = new CustomizeTexasTea(); screen.DataContext = tea; control = this.FindAncestor <OrderControl>(); control.SwapScreen(screen); } if (listBoxItem is CowboyCoffee coffee) { var screen = new CustomizeCowboyCoffee(); screen.DataContext = coffee; control = this.FindAncestor <OrderControl>(); control.SwapScreen(screen); } if (listBoxItem is Water water) { var screen = new CustomizeWater(); screen.DataContext = water; control = this.FindAncestor <OrderControl>(); control.SwapScreen(screen); } } } }
/// <summary> /// Event handler for menuitem buttons calls correct constructor for button chosen and adds to the list /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void OnItemAddButtonClicked(object sender, RoutedEventArgs e) { orderControl = this.FindAncestor <OrderControl>(); if (DataContext is Order order) { if (sender is Button button) { IOrderItem nItem; switch (button.Tag) { case "CowpokeChili": nItem = new CowpokeChili(); var screen = new CustomizeCowpokeChili(); screen.DataContext = nItem; order.Add(new CowpokeChili()); orderControl.SwapScreen(new CustomizeCowpokeChili()); break; case "AngryChicken": nItem = new AngryChicken(); // var screen = new CustomizeCowpokeChili(); //screen.DataContext = entree; order.Add(new AngryChicken()); //orderControl.SwapScreen(new CustomizeCowpokeChili()); break; case "BakedBeans": nItem = new BakedBeans(); // var screen = new CustomizeCowpokeChili(); //screen.DataContext = entree; order.Add(new BakedBeans()); //orderControl.SwapScreen(new CustomizeCowpokeChili()); break; case "ChiliCheeseFries": nItem = new ChiliCheeseFries(); // var screen = new CustomizeCowpokeChili(); //screen.DataContext = entree; order.Add(new ChiliCheeseFries()); //orderControl.SwapScreen(new CustomizeCowpokeChili()); break; case "CornDodgers": nItem = new CornDodgers(); // var screen = new CustomizeCowpokeChili(); //screen.DataContext = entree; order.Add(new CornDodgers()); //orderControl.SwapScreen(new CustomizeCowpokeChili()); break; case "CowboyCoffee": nItem = new CowboyCoffee(); // var screen = new CustomizeCowpokeChili(); //screen.DataContext = entree; order.Add(new CowboyCoffee()); //orderControl.SwapScreen(new CustomizeCowpokeChili()); break; case "DakotaDoubleBurger": nItem = new DakotaDoubleBurger(); // var screen = new CustomizeCowpokeChili(); //screen.DataContext = entree; order.Add(new DakotaDoubleBurger()); //orderControl.SwapScreen(new CustomizeCowpokeChili()); break; case "JerkedSoda": nItem = new JerkedSoda(); // var screen = new CustomizeCowpokeChili(); //screen.DataContext = entree; order.Add(new JerkedSoda()); //orderControl.SwapScreen(new CustomizeCowpokeChili()); break; case "PanDeCampo": nItem = new PanDeCampo(); // var screen = new CustomizeCowpokeChili(); //screen.DataContext = entree; order.Add(new PanDeCampo()); //orderControl.SwapScreen(new CustomizeCowpokeChili()); break; case "PecosPulledPork": nItem = new PecosPulledPork(); // var screen = new CustomizeCowpokeChili(); //screen.DataContext = entree; order.Add(new PecosPulledPork()); //orderControl.SwapScreen(new CustomizeCowpokeChili()); break; case "RustlersRibs": nItem = new RustlersRibs(); // var screen = new CustomizeCowpokeChili(); //screen.DataContext = entree; order.Add(new RustlersRibs()); //orderControl.SwapScreen(new CustomizeCowpokeChili()); break; case "TexasTea": nItem = new TexasTea(); // var screen = new CustomizeCowpokeChili(); //screen.DataContext = entree; order.Add(new TexasTea()); //orderControl.SwapScreen(new CustomizeCowpokeChili()); break; case "TexasTripleBurger": nItem = new TexasTripleBurger(); // var screen = new CustomizeCowpokeChili(); //screen.DataContext = entree; order.Add(new TexasTripleBurger()); //orderControl.SwapScreen(new CustomizeCowpokeChili()); break; case "TrailBurger": nItem = new BakedBeans(); // var screen = new CustomizeCowpokeChili(); //screen.DataContext = entree; order.Add(new TrailBurger()); //orderControl.SwapScreen(new CustomizeCowpokeChili()); break; case "Water": nItem = new BakedBeans(); // var screen = new CustomizeCowpokeChili(); //screen.DataContext = entree; order.Add(new CowboyCoffee()); //orderControl.SwapScreen(new CustomizeCowpokeChili()); break; } } } }
private void Cash_Clicked(object sender, RoutedEventArgs e) { OrderControl parent = ((OrderControl)((Border)Parent).Parent); parent.SwapScreen(new RegisterControll()); }
private void Confirm_Click(object sender, RoutedEventArgs e) { Order order = (Order)DataContext; double change = Total - order.Total; if (Pennies != 0) { drawer.AddCoin(Coins.Penny, Pennies); } else if (Nickles != 0) { drawer.AddCoin(Coins.Nickel, Nickles); } else if (Dimes != 0) { drawer.AddCoin(Coins.Dime, Dimes); } else if (Quarters != 0) { drawer.AddCoin(Coins.Quarter, Quarters); } else if (HalfDollars != 0) { drawer.AddCoin(Coins.HalfDollar, HalfDollars); } else if (Dollars != 0) { drawer.AddCoin(Coins.Dollar, Dollars); } else if (Ones != 0) { drawer.AddBill(Bills.One, Ones); } else if (Twos != 0) { drawer.AddBill(Bills.Two, Twos); } else if (Fives != 0) { drawer.AddBill(Bills.Five, Fives); } else if (Tens != 0) { drawer.AddBill(Bills.Ten, Tens); } else if (Twenties != 0) { drawer.AddBill(Bills.Twenty, Twenties); } else if (Fifties != 0) { drawer.AddBill(Bills.Fifty, Fifties); } else if (Hundreds != 0) { drawer.AddBill(Bills.Hundred, Hundreds); } if (change < 0) { MessageBox.Show("Insuficient Funds"); return; } else if (change > drawer.TotalValue) { MessageBox.Show("Error Not enough money to break this bill"); return; } else if (change == 0) { MessageBox.Show("Sucess"); OrderControl parent = ((OrderControl)((Border)Parent).Parent); MainWindow main = (MainWindow)((Grid)(parent.Parent)).Parent; main.DataContext = new Order(); } else { MessageBox.Show("Change Due: " + change.ToString("C")); while (change >= 0.009999999999999999999999999999999999999) { if (change - 100 > 0 && drawer.Hundreds > 0) { drawer.RemoveBill(Bills.Hundred, 1); change -= 100; } if (change - 50 > 0 && drawer.Fifties > 0) { drawer.RemoveBill(Bills.Fifty, 1); change -= 50; } if (change - 20 > 0 && drawer.Twenties > 0) { drawer.RemoveBill(Bills.Twenty, 1); change -= 20; } if (change - 10 > 0 && drawer.Tens > 0) { drawer.RemoveBill(Bills.Ten, 1); change -= 10; } if (change - 5 > 0 && drawer.Fives > 0) { drawer.RemoveBill(Bills.Five, 1); change -= 5; } if (change - 1 > 0 && drawer.Ones > 0) { drawer.RemoveBill(Bills.One, 1); change -= 1; } if (change - 1 > 0 && drawer.Dollars > 0) { drawer.RemoveCoin(Coins.Dollar, 1); change -= 1; } if (change - .50 > 0 && drawer.HalfDollars > 0) { drawer.RemoveCoin(Coins.HalfDollar, 1); change -= .50; } if (change - .25 > 0 && drawer.Quarters > 0) { drawer.RemoveCoin(Coins.Quarter, 1); change -= .25; } if (change - .10 > 0 && drawer.Dimes > 0) { drawer.RemoveCoin(Coins.Dime, 1); change -= .10; } if (change - .05 > 0 && drawer.Nickels > 0) { drawer.RemoveCoin(Coins.Nickel, 1); change -= .05; } if (change - .01 > 0 && drawer.Pennies > 0) { drawer.RemoveCoin(Coins.Penny, 1); change -= .01; } } OrderControl parent = (OrderControl)((Border)Parent).Parent; MainWindow main = (MainWindow)((Grid)(parent.Parent)).Parent; Cash_Print(Total); main.DataContext = new Order(); parent.SwapScreen(null); } }
/// <summary> /// Event Handler for item selection on the Order Summary Control ListBox /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SelectionClicked(object sender, SelectionChangedEventArgs e) { if (sender is ListBox list) { if (list.SelectedItem is IOrderItem item) { /*********************Entree Selection*********************/ if (item is AngryChicken angry) { var screen = new AngryChickenCustomization(); screen.DataContext = angry; orderControl = this.FindAncestor <OrderControl>(); orderControl?.SwapScreen(screen); } if (item is CowpokeChili cowpoke) { var screen = new CowpokeChiliCustomization(); screen.DataContext = cowpoke; orderControl = this.FindAncestor <OrderControl>(); orderControl?.SwapScreen(screen); } if (item is RustlersRibs rustlers) { var screen = new RustlersRibsCustomization(); screen.DataContext = rustlers; orderControl = this.FindAncestor <OrderControl>(); orderControl?.SwapScreen(screen); } if (item is PecosPulledPork pecos) { var screen = new PecosPulledPorkCustomization(); screen.DataContext = pecos; orderControl = this.FindAncestor <OrderControl>(); orderControl?.SwapScreen(screen); } if (item is DakotaDoubleBurger dakota) { var screen = new DakotaDoubleBurgerCustomization(); screen.DataContext = dakota; orderControl = this.FindAncestor <OrderControl>(); orderControl?.SwapScreen(screen); } if (item is TrailBurger trail) { var screen = new TrailBurgerCustomization(); screen.DataContext = trail; orderControl = this.FindAncestor <OrderControl>(); orderControl?.SwapScreen(screen); } if (item is TexasTripleBurger texas) { var screen = new TexasTripleBurgerCustomization(); screen.DataContext = texas; orderControl = this.FindAncestor <OrderControl>(); orderControl?.SwapScreen(screen); } /*********************Side Selection*********************/ if (item is BakedBeans baked) { var screen = new SideCustomization(DataContext); screen.DataContext = baked; orderControl = this.FindAncestor <OrderControl>(); screen.ButtonSwitch(baked.Size); orderControl?.SwapScreen(screen); } if (item is ChiliCheeseFries chili) { var screen = new SideCustomization(DataContext); screen.DataContext = chili; orderControl = this.FindAncestor <OrderControl>(); screen.ButtonSwitch(chili.Size); orderControl?.SwapScreen(screen); } if (item is CornDodgers corn) { var screen = new SideCustomization(DataContext); screen.DataContext = corn; orderControl = this.FindAncestor <OrderControl>(); screen.ButtonSwitch(corn.Size); orderControl?.SwapScreen(screen); } if (item is PanDeCampo pan) { var screen = new SideCustomization(DataContext); screen.DataContext = pan; orderControl = this.FindAncestor <OrderControl>(); screen.ButtonSwitch(pan.Size); orderControl?.SwapScreen(screen); } /*********************Drink Selection*********************/ if (item is CowboyCoffee cowboy) { var screen = new CowboyCoffeeCustomization(DataContext); screen.DataContext = cowboy; orderControl = this.FindAncestor <OrderControl>(); screen.ButtonSizeSwitch(cowboy.Size); orderControl?.SwapScreen(screen); } if (item is JerkedSoda jerked) { var screen = new JerkedSodaCustomization(DataContext); screen.DataContext = jerked; orderControl = this.FindAncestor <OrderControl>(); screen.ButtonSizeSwitch(jerked.Size); screen.ButtonFlavorSwitch(jerked.Flavor); orderControl?.SwapScreen(screen); } if (item is TexasTea texasTea) { var screen = new TexasTeaCustomization(DataContext); screen.DataContext = texasTea; orderControl = this.FindAncestor <OrderControl>(); screen.ButtonSizeSwitch(texasTea.Size); orderControl?.SwapScreen(screen); } if (item is Water water) { var screen = new WaterCustomization(DataContext); screen.DataContext = water; orderControl = this.FindAncestor <OrderControl>(); screen.ButtonSizeSwitch(water.Size); orderControl?.SwapScreen(screen); } } } }
/// <summary> /// Handles manual selection of items in the list. /// </summary> /// <param name="sender">SelectionChanged</param> /// <param name="args">the args</param> private void OnSelectionChanged(object sender, SelectionChangedEventArgs args) { if (sender is ListBox list) { if (list.SelectedItem is IOrderItem OrderItem) { if (OrderItem is AngryChicken chicken) { var screen = new CustomizeAngryChicken(); screen.DataContext = chicken; order = this.FindAncestor <OrderControl>(); order.SwapScreen(screen); } if (OrderItem is CowpokeChili chili) { var screen = new CustomizeCowPokeChili(); screen.DataContext = chili; order = this.FindAncestor <OrderControl>(); order.SwapScreen(screen); } if (OrderItem is PecosPulledPork pork) { var screen = new CustomizePecosPulledPork(); screen.DataContext = pork; order = this.FindAncestor <OrderControl>(); order.SwapScreen(screen); } if (OrderItem is TrailBurger trailBurger) { var screen = new CustomizeTrailBurger(); screen.DataContext = trailBurger; order = this.FindAncestor <OrderControl>(); order.SwapScreen(screen); } if (OrderItem is DakotaDoubleBurger dakotaDouble) { var screen = new CustomizeDakotaDouble(); screen.DataContext = dakotaDouble; order = this.FindAncestor <OrderControl>(); order.SwapScreen(screen); } if (OrderItem is TexasTripleBurger texasTriple) { var screen = new CustomizeTexasTripleBurger(); screen.DataContext = texasTriple; order = this.FindAncestor <OrderControl>(); order.SwapScreen(screen); } if (OrderItem is ChiliCheeseFries chiliCheeseFries) { var screen = new CustomizeChiliCheeseFries(); screen.DataContext = chiliCheeseFries; order = this.FindAncestor <OrderControl>(); order.SwapScreen(screen); } if (OrderItem is CornDodgers cornDodgers) { var screen = new CustomizeCornDodgers(); screen.DataContext = cornDodgers; order = this.FindAncestor <OrderControl>(); order.SwapScreen(screen); } if (OrderItem is PanDeCampo panDeCampo) { var screen = new CustomizePanDeCampo(); screen.DataContext = panDeCampo; order = this.FindAncestor <OrderControl>(); order.SwapScreen(screen); } if (OrderItem is BakedBeans bakedBeans) { var screen = new CustomizeBakedBeans(); screen.DataContext = bakedBeans; order = this.FindAncestor <OrderControl>(); order.SwapScreen(screen); } if (OrderItem is JerkedSoda jerkedSoda) { var screen = new CustomizeJerkedSoda(); screen.DataContext = jerkedSoda; order = this.FindAncestor <OrderControl>(); order.SwapScreen(screen); } if (OrderItem is TexasTea texasTea) { var screen = new CustomizeTexasTea(); screen.DataContext = texasTea; order = this.FindAncestor <OrderControl>(); order.SwapScreen(screen); } if (OrderItem is CowboyCoffee coffee) { var screen = new CustomizeCowboyCoffee(); screen.DataContext = coffee; order = this.FindAncestor <OrderControl>(); order.SwapScreen(screen); } if (OrderItem is Water water) { var screen = new CustomizeWater(); screen.DataContext = water; order = this.FindAncestor <OrderControl>(); order.SwapScreen(screen); } } } }