public void editScreen(IOrderItem item) { var screen = new CustomizeItemControl(); screen.DataContext = item; swapScreen(screen); }
/// <summary> /// An event handler to add Cow Poke Chili to a list /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void AddItem(object sender, RoutedEventArgs e) { var orderControl = this.FindAncestor <OrderControl>(); var screen = new CustomizeItemControl(); //ListBox.Items.Add(new CowpokeChili()); var result = DataContext is IOrderItem; if (DataContext is Order order) { if (sender is Button button) { switch (button.Tag) { case "cowPokeChili": var cowpokeChili = new CowpokeChili(); AddItemAndOpenCustomizationScreen(cowpokeChili, screen); break; case "rustlersRibs": var rustlersRibs = new RustlersRibs(); AddItemAndOpenCustomizationScreen(rustlersRibs, null); break; case "pecosPulledPork": var pecosPulledPork = new PecosPulledPork(); AddItemAndOpenCustomizationScreen(pecosPulledPork, screen); break; case "trailBurger": var trailBurger = new TrailBurger(); AddItemAndOpenCustomizationScreen(trailBurger, screen); break; case "dakotaDoubleBurger": var dakotaDoubleBurger = new DakotaDoubleBurger(); AddItemAndOpenCustomizationScreen(dakotaDoubleBurger, screen); break; case "texasTripleBurger": var texasTripleBurger = new TexasTripleBurger(); AddItemAndOpenCustomizationScreen(texasTripleBurger, screen); break; case "angryChicken": var angryChicken = new AngryChicken(); AddItemAndOpenCustomizationScreen(angryChicken, screen); break; case "chiliCheeseFries": var chiliCheeseFires = new ChiliCheeseFries(); AddItemAndOpenCustomizationScreen(chiliCheeseFires, screen); break; case "cornDodgers": var cornDodgers = new CornDodgers(); AddItemAndOpenCustomizationScreen(cornDodgers, screen); break; case "panDeCampo": var panDeCamp = new PanDeCampo(); AddItemAndOpenCustomizationScreen(panDeCamp, screen); break; case "bakedBeans": var bakedBeans = new BakedBeans(); AddItemAndOpenCustomizationScreen(bakedBeans, screen); break; case "jerkedSoda": var jerkedSoda = new JerkedSoda(); AddItemAndOpenCustomizationScreen(jerkedSoda, screen); break; case "texasTea": var texasTea = new TexasTea(); AddItemAndOpenCustomizationScreen(texasTea, screen); break; case "cowboyCoffee": var cowboyCoffee = new CowboyCoffee(); AddItemAndOpenCustomizationScreen(cowboyCoffee, screen); break; case "water": var water = new Water(); AddItemAndOpenCustomizationScreen(water, screen); break; } } } }