public void ComboButtonClickEvent(object sender, MenuSelectionEvent e) { if (e.fooditem is ComboOrder combo) // this will check if an object is a certain type { //newOrder.Add(combo.Entree); //newOrder.Add(combo.Drink); //newOrder.Add(combo.Side); newOrder.Add(combo); } DisplayCurrentOrder(); }
/// <summary> /// this class sets a new instance of the /// </summary> /// <param name="sender"></param> /// <param name="e">represents a food object passed from FoodSelected event handler</param> public void FoodButtonClickEvent(object sender, MenuSelectionEvent e) { //now how can we use the information from Custimization... //to make changes to e.fooditem which is the new BriarheartBurger() //final goal -> use BriarheartBurger.SpecialInstructions //we need to find a better way of capturing fooditem's customization information //FinalOrderListView.Items.Add("Briarheart Burger"); //entrees if (e.fooditem is BriarheartBurger) // this will check if an object is a certain type { BriarheartBurgerCustomization fooditem = new BriarheartBurgerCustomization(e.fooditem); switchBorder.Child = fooditem; //add burger customization to the current screen fooditem.DataContext = e.fooditem; //fooditem.DataContext = e.fooditem; //allows the DataContext of the XAML variables to access BriarheartBurger //fooditem.DataContext = newOrder; } else if (e.fooditem is DoubleDraugr) // this will check if an object is a certain type { DoubleDraugrCustomization fooditem = new DoubleDraugrCustomization(e.fooditem); switchBorder.Child = fooditem; fooditem.DataContext = e.fooditem; // fooditem.DataContext = newOrder; } else if (e.fooditem is ThalmorTriple) // this will check if an object is a certain type { ThalmorTripleCustomization fooditem = new ThalmorTripleCustomization(e.fooditem); switchBorder.Child = fooditem; fooditem.DataContext = e.fooditem; //fooditem.DataContext = newOrder; } else if (e.fooditem is SmokehouseSkeleton) // this will check if an object is a certain type { SmokehouseSkeletonCustomization fooditem = new SmokehouseSkeletonCustomization(e.fooditem); switchBorder.Child = fooditem; fooditem.DataContext = e.fooditem; //fooditem.DataContext = newOrder; } else if (e.fooditem is GardenOrcOmelette) // this will check if an object is a certain type { GardenOrcOmeletteCustomization fooditem = new GardenOrcOmeletteCustomization(e.fooditem); switchBorder.Child = fooditem; fooditem.DataContext = e.fooditem; //fooditem.DataContext = newOrder; } else if (e.fooditem is PhillyPoacher) // this will check if an object is a certain type { PhillyPoacherCustomization fooditem = new PhillyPoacherCustomization(e.fooditem); switchBorder.Child = fooditem; fooditem.DataContext = e.fooditem; //fooditem.DataContext = newOrder; } else if (e.fooditem is ThugsTBone) // this will check if an object is a certain type { ThugsTBoneCustomization fooditem = new ThugsTBoneCustomization(e.fooditem); switchBorder.Child = fooditem; fooditem.DataContext = e.fooditem; //fooditem.DataContext = newOrder; } //drinks else if (e.fooditem is SailorSoda) { SailorSodaCustomization fooditem = new SailorSodaCustomization(e.fooditem); switchBorder.Child = fooditem; fooditem.DataContext = e.fooditem; //fooditem.DataContext = newOrder; } else if (e.fooditem is MarkarthMilk) { MarkarthMilkCustomization fooditem = new MarkarthMilkCustomization(e.fooditem); switchBorder.Child = fooditem; fooditem.DataContext = e.fooditem; // fooditem.DataContext = newOrder; } else if (e.fooditem is AretinoAppleJuice) { AretinoAppleJuiceCustomization fooditem = new AretinoAppleJuiceCustomization(e.fooditem); switchBorder.Child = fooditem; fooditem.DataContext = e.fooditem; //fooditem.DataContext = newOrder; } else if (e.fooditem is CandlehearthCoffee) { CandlehearthCoffeeCustomization fooditem = new CandlehearthCoffeeCustomization(e.fooditem); switchBorder.Child = fooditem; fooditem.DataContext = e.fooditem; //fooditem.DataContext = newOrder; } else if (e.fooditem is WarriorWater) { WarriorWaterCustomization fooditem = new WarriorWaterCustomization(e.fooditem); switchBorder.Child = fooditem; fooditem.DataContext = e.fooditem; //fooditem.DataContext = newOrder; } //sides: else if (e.fooditem is VokunSalad) { VokunSaladCustomization fooditem = new VokunSaladCustomization(e.fooditem); switchBorder.Child = fooditem; fooditem.DataContext = e.fooditem; //fooditem.DataContext = newOrder; } else if (e.fooditem is FriedMiraak) { FriedMiraakCustomization fooditem = new FriedMiraakCustomization(e.fooditem); switchBorder.Child = fooditem; fooditem.DataContext = e.fooditem; //fooditem.DataContext = newOrder; } else if (e.fooditem is MadOtarGrits) { MadOtarGritsCustomization fooditem = new MadOtarGritsCustomization(e.fooditem); switchBorder.Child = fooditem; fooditem.DataContext = e.fooditem; //fooditem.DataContext = newOrder; } else if (e.fooditem is DragonbornWaffleFries) { DragonbornWaffleFriesCustomization fooditem = new DragonbornWaffleFriesCustomization(e.fooditem); switchBorder.Child = fooditem; fooditem.DataContext = e.fooditem; //fooditem.DataContext = newOrder; //finalOrder.Add(e.fooditem); //only need once below } // finalOrder.Add(e.fooditem); //add food item to the list of IOrderItem newOrder.Add(e.fooditem); //setting everything up for newOrder DisplayCurrentOrder(); }