/// <summary> /// Click event for button /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void AddWaterButton_Click(object sender, RoutedEventArgs e) { var orderControl = this.FindAncestor <OrderControl>(); if (DataContext is Order data) { var item = new Water(); var screen = new WaterCustimization(); screen.DataContext = item; data.Add(item); orderControl.SwapScreen(screen); } }
/// <summary> /// Accesses the data context of the selected item and reopens its custimization screen /// </summary> /// <param name="sender"></param> /// <param name="args"></param> private void AccessItemDataContext(object sender, SelectionChangedEventArgs args) { var orderControl = this.FindAncestor <OrderControl>(); if (DataContext is Order data) { var item = ((sender as ListView).SelectedItem as IOrderItem); var screen = new FrameworkElement(); switch (item) { case AngryChicken ac: screen = new AngryChickenCustimization(); break; case BakedBeans ac: screen = new BakedBeansCustimization(); break; case ChiliCheeseFries ac: screen = new ChiliCheeseFriesCustimization(); break; case CornDodgers ac: screen = new CornDodgersCustimization(); break; case CowboyCoffee ac: screen = new CowboyCoffeeCustimization(); break; case CowpokeChili ac: screen = new CowpokeChiliCustumization(); break; case DakotaDoubleBurger ac: screen = new DakotaDoubleBurgerCustimization(); break; case JerkedSoda ac: screen = new JerkedSodaCustimization(); break; case PanDeCampo ac: screen = new PandeCampoCustimization(); break; case PecosPulledPork ac: screen = new PecosPulledPorkCustimization(); break; case RustlersRibs ac: screen = new RustlersRibsCustimization(); break; case TexasTea ac: screen = new TexasTeaCustimization(); break; case TexasTripleBurger ac: screen = new TexasTripleBurgerCustimization(); break; case TrailBurger ac: screen = new TrailBurgerCustimization(); break; case Water ac: screen = new WaterCustimization(); break; } screen.DataContext = item; orderControl.SwapScreen(screen); } }