/// <summary> /// Adds Texas Tea to the order list. /// </summary> private void AddTexasTeaButton_Click(object sender, RoutedEventArgs e) { var orderControl = this.FindAncestor <OrderControl>(); if (DataContext is Order order) { IOrderItem item = new TexasTea(); var screen = new TexasTeaCustomize(); screen.DataContext = item; order.Add(item); orderControl?.SwapScreen(screen); } }
/// <summary> /// Swaps screen for instructions on items ordered /// </summary> private void OrderList_SelectionChanged(object sender, SelectionChangedEventArgs e) { var orderControl = this.FindAncestor <OrderControl>(); foreach (object items in e.AddedItems) { if (items is AngryChicken) { var screen = new AngryChickenCustomize(); screen.DataContext = items; orderControl?.SwapScreen(screen); } else if (items is CowboyCoffee) { var screen = new CowboyCoffeeCustomize(); screen.DataContext = items; orderControl?.SwapScreen(screen); } else if (items is CowpokeChili) { var screen = new CowpokeChiliCustomize(); screen.DataContext = items; orderControl?.SwapScreen(screen); } else if (items is JerkedSoda) { var screen = new JerkedSodaCustomize(); screen.DataContext = items; orderControl?.SwapScreen(screen); } else if (items is DakotaDoubleBurger) { var screen = new DakotaDoubleBurgerCustomize(); screen.DataContext = items; orderControl?.SwapScreen(screen); } else if (items is PecosPulledPork) { var screen = new PecosPulledPorkCustomize(); screen.DataContext = items; orderControl?.SwapScreen(screen); } else if (items is TexasTea) { var screen = new TexasTeaCustomize(); screen.DataContext = items; orderControl?.SwapScreen(screen); } else if (items is TexasTripleBurger) { var screen = new TexasTripleBurgerCustomize(); screen.DataContext = items; orderControl?.SwapScreen(screen); } else if (items is TrailBurger) { var screen = new TrailBurgerCustomize(); screen.DataContext = items; orderControl?.SwapScreen(screen); } else if (items is Water) { var screen = new WaterCustomize(); screen.DataContext = items; orderControl?.SwapScreen(screen); } } }