public void OnItemAddDrinkClick(object sender, RoutedEventArgs e) { IOrderItem Drink; var orderControl = this.FindAncestor <OrderControl>(); if (DataContext is Order order) { if (sender is Button button) { switch (button.Name) { case "AddJerkedSoda": Drink = new JerkedSoda(); var screen = new CustomizeDrink(); screen.DataContext = Drink; order.Add(Drink); orderControl.SwapScreen(screen); screen.Title.Text = "Customize Jerked Soda"; screen.SodaMenu(); break; case "AddTexasTea": Drink = new TexasTea(); var screen2 = new CustomizeDrink(); screen2.DataContext = Drink; order.Add(Drink); orderControl.SwapScreen(screen2); screen2.Title.Text = "Customize Texas Tea"; screen2.TeaMenu(); break; case "AddCowbyCoffee": Drink = new CowboyCoffee(); var screen3 = new CustomizeDrink(); screen3.DataContext = Drink; order.Add(Drink); orderControl.SwapScreen(screen3); screen3.Title.Text = "Customize Cowboy Coffee"; screen3.CoffeeMenu(); break; case "AddWater": Drink = new Water(); var screen4 = new CustomizeDrink(); screen4.DataContext = Drink; order.Add(Drink); orderControl.SwapScreen(screen4); screen4.Title.Text = "Customize Water"; screen4.WaterMenu(); break; } } } }
public void OnAddDrinkButtonClicked(object sender, RoutedEventArgs e) { var orderControl = this.FindAncestor <OrderControl>(); if (DataContext is Order order) { if (sender is Button button) { switch (button.Tag) { case "CowboyCoffee": var cowboyCoffee = new CowboyCoffee(); var screen = new CustomizeDrink("Cowboy Coffee", cowboyCoffee, order); screen.DataContext = cowboyCoffee; order.Add(cowboyCoffee); orderControl.SwapScreen(screen); break; case "JerkedSoda": var jerkedSoda = new JerkedSoda(); screen = new CustomizeDrink("Jerked Soda", jerkedSoda, order); screen.DataContext = jerkedSoda; order.Add(jerkedSoda); orderControl.SwapScreen(screen); break; case "TexasTea": var texasDrink = new TexasTea(); screen = new CustomizeDrink("Texas Tea", texasDrink, order); screen.DataContext = texasDrink; order.Add(texasDrink); orderControl.SwapScreen(screen); break; case "Water": var water = new Water(); screen = new CustomizeDrink("Water", water, order); screen.DataContext = water; order.Add(water); orderControl.SwapScreen(screen); break; } } } }
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); } }
/// <summary> /// Generalized event handler for button IOrderItem button clicks /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void OnIOrderItemButtonClicked(object sender, RoutedEventArgs e) { var orderControl = this.FindAncestor <OrderControl>(); if (DataContext is Order CurrentOrder) { if (sender is Button button) { switch (button.Tag) { case "CowpokeChili": { var item = new CowpokeChili(); var screen = new CustomizeEntree(item as IOrderItem); CurrentOrder.Add(item); orderControl.SwapScreen(screen); break; } case "AngryChicken": { var item = new AngryChicken(); var screen = new CustomizeEntree(item as IOrderItem); CurrentOrder.Add(item); orderControl.SwapScreen(screen); break; } case "DakotaDoubleBurger": { var item = new DakotaDoubleBurger(); var screen = new CustomizeEntree(item as IOrderItem); CurrentOrder.Add(item); orderControl.SwapScreen(screen); break; } case "PecosPulledPork": { var item = new PecosPulledPork(); var screen = new CustomizeEntree(item as IOrderItem); CurrentOrder.Add(item); orderControl.SwapScreen(screen); break; } case "RustlersRibs": { var item = new RustlersRibs(); CurrentOrder.Add(item); break; } case "TexasTripleBurger": { var item = new TexasTripleBurger(); var screen = new CustomizeEntree(item as IOrderItem); CurrentOrder.Add(item); orderControl.SwapScreen(screen); break; } case "TrailBurger": { var item = new TrailBurger(); var screen = new CustomizeEntree(item as IOrderItem); CurrentOrder.Add(item); orderControl.SwapScreen(screen); break; } case "BakedBeans": { var item = new BakedBeans(); var screen = new CustomizeSide(item); CurrentOrder.Add(item); orderControl.SwapScreen(screen); break; } case "ChiliCheeseFries": { var item = new ChiliCheeseFries(); var screen = new CustomizeSide(item); CurrentOrder.Add(item); orderControl.SwapScreen(screen); break; } case "CornDodgers": { var item = new CornDodgers(); var screen = new CustomizeSide(item); CurrentOrder.Add(item); orderControl.SwapScreen(screen); break; } case "PanDeCampo": { var item = new PanDeCampo(); var screen = new CustomizeSide(item); CurrentOrder.Add(item); orderControl.SwapScreen(screen); break; } case "CowboyCoffee": { var item = new CowboyCoffee(); var screen = new CustomizeDrink(item); CurrentOrder.Add(item); orderControl.SwapScreen(screen); break; } case "JerkedSoda": { var item = new JerkedSoda(); var screen = new CustomizeDrink(item); CurrentOrder.Add(item); orderControl.SwapScreen(screen); break; } case "TexasTea": { var item = new TexasTea(); var screen = new CustomizeDrink(item); CurrentOrder.Add(item); orderControl.SwapScreen(screen); break; } case "Water": { var item = new Water(); var screen = new CustomizeDrink(item); CurrentOrder.Add(item); orderControl.SwapScreen(screen); break; } } } } }
private void OnItemSelectChange(object sender, SelectionChangedEventArgs e) { var Control = this.FindAncestor <OrderControl>(); if (Control == null) { return; } foreach (object Item in e.AddedItems) { if (Item is CowpokeChili) { var cpc = new CustomizeEntree(); cpc.DataContext = Item; Control.SwapScreen(cpc); cpc.Title.Text = "Customize Cowpoke Chilli"; cpc.ChilliMenu(); } else if (Item is AngryChicken) { var cpc = new CustomizeEntree(); cpc.DataContext = Item; Control.SwapScreen(cpc); cpc.Title.Text = "Customize Angry Chicken"; cpc.AngryChickenMenu(); } else if (Item is DakotaDoubleBurger) { var cpc = new CustomizeEntree(); cpc.DataContext = Item; Control.SwapScreen(cpc); cpc.Title.Text = "Customize Dakota Double Burger"; cpc.DakotaDouble(); } else if (Item is PecosPulledPork) { var cpc = new CustomizeEntree(); cpc.DataContext = Item; Control.SwapScreen(cpc); cpc.Title.Text = "Customize Pecos Pulled Pork"; cpc.PecosPulledPork(); } else if (Item is RustlersRibs) { var cpc = new CustomizeEntree(); cpc.DataContext = Item; Control.SwapScreen(cpc); cpc.Title.Text = "Customize Rustler's Ribs"; } else if (Item is TrailBurger) { var cpc = new CustomizeEntree(); cpc.DataContext = Item; Control.SwapScreen(cpc); cpc.Title.Text = "Customize Trail Burger"; cpc.TrailBurger(); } else if (Item is TexasTripleBurger) { var cpc = new CustomizeEntree(); cpc.DataContext = Item; Control.SwapScreen(cpc); cpc.Title.Text = "Customize Texas Triple Burger"; cpc.TexasTriple(); } else if (Item is BakedBeans) { var cpc = new CustomizeSides(); cpc.DataContext = Item; Control.SwapScreen(cpc); cpc.Title.Text = "Customize Baked Beans"; } else if (Item is ChiliCheeseFries) { var cpc = new CustomizeSides(); cpc.DataContext = Item; Control.SwapScreen(cpc); cpc.Title.Text = "Customize Chilli Cheese Fries"; } else if (Item is PanDeCampo) { var cpc = new CustomizeSides(); cpc.DataContext = Item; Control.SwapScreen(cpc); cpc.Title.Text = "Customize Pan De Campo"; } else if (Item is CornDodgers) { var cpc = new CustomizeSides(); cpc.DataContext = Item; Control.SwapScreen(cpc); cpc.Title.Text = "Customize Corn Dodgers"; } else if (Item is JerkedSoda) { var cpc = new CustomizeDrink(); cpc.DataContext = Item; Control.SwapScreen(cpc); cpc.Title.Text = "Customize Jerked Soda"; cpc.SodaMenu(); } else if (Item is CowboyCoffee) { var cpc = new CustomizeDrink(); cpc.DataContext = Item; Control.SwapScreen(cpc); cpc.Title.Text = "Customize Cowboy Coffee"; cpc.CoffeeMenu(); } else if (Item is Water) { var cpc = new CustomizeDrink(); cpc.DataContext = Item; Control.SwapScreen(cpc); cpc.Title.Text = "Customize Water"; cpc.WaterMenu(); } else if (Item is TexasTea) { var cpc = new CustomizeDrink(); cpc.DataContext = Item; Control.SwapScreen(cpc); cpc.Title.Text = "Customize Texas Tea"; cpc.TeaMenu(); } } }