/// <summary> /// Adds Cowboy Coffee /// </summary> /// <param name="sender">button</param> /// <param name="e">click</param> private void AddCowboyCoffee_Click(object sender, RoutedEventArgs e) { var ordercontrol = this.FindAncestor <OrderControl>(); if (DataContext is Order data) { var item = new CowboyCoffee(); var screen = new CowpokeCoffeeCustomization(); screen.DataContext = item; data.Add(item); ordercontrol.SwapScreen(screen); } }
/// <summary> /// Whatever listbox is selected is pulled up so you can edit the order item /// </summary> /// <param name="sender">Listbox</param> /// <param name="args">selected</param> public void Selected(object sender, SelectionChangedEventArgs args) { IOrderItem i = ((sender as ListBox).SelectedItem as IOrderItem); var ordercontrol = this.FindAncestor <OrderControl>(); if (i is AngryChicken) { if (DataContext is Order data) { var screen = new AngryChickenCustomization(); screen.DataContext = i; ordercontrol.SwapScreen(screen); } } else if (i is BakedBeans) { if (DataContext is Order data) { var screen = new BakedBeansCustomization(DataContext); screen.DataContext = i; ordercontrol.SwapScreen(screen); } } else if (i is ChiliCheeseFries) { if (DataContext is Order data) { var screen = new ChiliCheeseFriesCustomization(); screen.DataContext = i; ordercontrol.SwapScreen(screen); } } else if (i is CornDodgers) { if (DataContext is Order data) { var screen = new CornDodgersCustomization(); screen.DataContext = i; ordercontrol.SwapScreen(screen); } } else if (i is CowboyCoffee) { if (DataContext is Order data) { var screen = new CowpokeCoffeeCustomization(); screen.DataContext = i; ordercontrol.SwapScreen(screen); } } else if (i is CowpokeChili) { if (DataContext is Order data) { var screen = new CowpokeChiliCustomization(); screen.DataContext = i; ordercontrol.SwapScreen(screen); } } else if (i is DakotaDoubleBurger) { if (DataContext is Order data) { var screen = new DakotaDoubleCustomization(); screen.DataContext = i; ordercontrol.SwapScreen(screen); } } else if (i is JerkedSoda) { if (DataContext is Order data) { var screen = new JerkedSodaCustomization(); screen.DataContext = i; ordercontrol.SwapScreen(screen); } } else if (i is PanDeCampo) { if (DataContext is Order data) { var screen = new PanDeCampoCustomization(); screen.DataContext = i; ordercontrol.SwapScreen(screen); } } else if (i is PecosPulledPork) { if (DataContext is Order data) { var screen = new PecosPulledPorkCustomization(); screen.DataContext = i; ordercontrol.SwapScreen(screen); } } else if (i is RustlersRibs) { if (DataContext is Order data) { var screen = new RustlersRibsCustomization(); screen.DataContext = i; ordercontrol.SwapScreen(screen); } } else if (i is TexasTea) { if (DataContext is Order data) { var screen = new TexasTeaCustomization(); screen.DataContext = i; ordercontrol.SwapScreen(screen); } } else if (i is TexasTripleBurger) { if (DataContext is Order data) { var screen = new TexasTripleBurgerCustomization(); screen.DataContext = i; ordercontrol.SwapScreen(screen); } } else if (i is TrailBurger) { if (DataContext is Order data) { var screen = new TrailBurgerCustomization(); screen.DataContext = i; ordercontrol.SwapScreen(screen); } } else if (i is Water) { if (DataContext is Order data) { var screen = new WaterCustomization(); screen.DataContext = i; ordercontrol.SwapScreen(screen); } } }