/// <summary> /// Order item method to add to the list and change price /// </summary> /// <param name="sender">order button</param> /// <param name="e">event handler when button pressed</param> void OrderTheItem(object sender, RoutedEventArgs e) { switch (StringGetter) { case "aretinoAppleJuice": AretinoAppleJuice drink = new AretinoAppleJuice(); if (this.ice.IsChecked == true) { drink.Ice = true; } if (this.sizer.Text == "Small") { drink.Size = BleakwindBuffet.Data.Enums.Size.Small; } if (this.sizer.Text == "Medium") { drink.Size = BleakwindBuffet.Data.Enums.Size.Medium; } if (this.sizer.Text == "Large") { drink.Size = BleakwindBuffet.Data.Enums.Size.Large; } if (modifier == true) { ((AretinoAppleJuice)Item).Size = drink.Size; ((AretinoAppleJuice)Item).Ice = drink.Ice; } (Application.Current.MainWindow as MainWindow).curOrder.Add(drink); return; case "candleHearthCoffee": CandlehearthCoffee coffee = new CandlehearthCoffee(); if (this.ice.IsChecked == true) { coffee.Ice = true; } if (this.cream.IsChecked == true) { coffee.RoomForCream = true; } if (this.decaf.IsChecked == true) { coffee.Decaf = true; } if (this.sizer.Text == "Small") { coffee.Size = BleakwindBuffet.Data.Enums.Size.Small; } if (this.sizer.Text == "Medium") { coffee.Size = BleakwindBuffet.Data.Enums.Size.Medium; } if (this.sizer.Text == "Large") { coffee.Size = BleakwindBuffet.Data.Enums.Size.Large; } if (modifier == true) { foreach (IOrderItem item in (Application.Current.MainWindow as MainWindow).curOrder.Orders) { if (item.GetType().IsAssignableFrom(coffee.GetType())) { (((CandlehearthCoffee)item).Size) = coffee.Size; (((CandlehearthCoffee)item).Ice) = coffee.Ice; (((CandlehearthCoffee)item).Decaf) = coffee.Decaf; (((CandlehearthCoffee)item).RoomForCream) = coffee.RoomForCream; } } } else { if (Combo.IsChecked == true && (Application.Current.MainWindow as MainWindow).Combo.Drink == null) { (Application.Current.MainWindow as MainWindow).Combo.Drink = coffee; } else { (Application.Current.MainWindow as MainWindow).curOrder.Add(coffee); } } return; case "markarthMilk": MarkarthMilk milk = new MarkarthMilk(); if (this.ice.IsChecked == true) { milk.Ice = true; } if (this.sizer.Text == "Small") { milk.Size = BleakwindBuffet.Data.Enums.Size.Small; } if (this.sizer.Text == "Medium") { milk.Size = BleakwindBuffet.Data.Enums.Size.Medium; } if (this.sizer.Text == "Large") { milk.Size = BleakwindBuffet.Data.Enums.Size.Large; } if (modifier == true) { foreach (IOrderItem item in (Application.Current.MainWindow as MainWindow).curOrder) { if (item.GetType().IsAssignableFrom(milk.GetType())) { ((CandlehearthCoffee)item).Size = milk.Size; ((CandlehearthCoffee)item).Ice = milk.Ice; } } } else { if (Combo.IsChecked == true && (Application.Current.MainWindow as MainWindow).Combo.Drink == null) { (Application.Current.MainWindow as MainWindow).Combo.Drink = milk; } (Application.Current.MainWindow as MainWindow).curOrder.Add(milk); } return; case "sailorSoda": SailorSoda soda = new SailorSoda(); if (this.ice.IsChecked == false) { soda.Ice = false; } if (this.blackberry.IsChecked == true) { soda.Flavor = SodaFlavor.Blackberry; } if (this.cherry.IsChecked == true) { soda.Flavor = SodaFlavor.Cherry; } if (this.lemon.IsChecked == true) { soda.Flavor = SodaFlavor.Lemon; } if (this.watermelon.IsChecked == true) { soda.Flavor = SodaFlavor.Watermelon; } if (this.grapefruit.IsChecked == true) { soda.Flavor = SodaFlavor.Grapefruit; } if (this.peach.IsChecked == true) { soda.Flavor = SodaFlavor.Peach; } if (this.sizer.Text == "Small") { soda.Size = BleakwindBuffet.Data.Enums.Size.Small; } if (this.sizer.Text == "Medium") { soda.Size = BleakwindBuffet.Data.Enums.Size.Medium; } if (this.sizer.Text == "Large") { soda.Size = BleakwindBuffet.Data.Enums.Size.Large; } if (Combo.IsChecked == true && (Application.Current.MainWindow as MainWindow).Combo.Drink == null) { (Application.Current.MainWindow as MainWindow).Combo.Drink = soda; } else { (Application.Current.MainWindow as MainWindow).curOrder.Add(soda); } return; case "warriorWater": WarriorWater water = new WarriorWater(); if (this.ice.IsChecked == false) { water.Ice = false; } if (this.sizer.Text == "Small") { water.Size = BleakwindBuffet.Data.Enums.Size.Small; } if (this.sizer.Text == "Medium") { water.Size = BleakwindBuffet.Data.Enums.Size.Medium; } if (this.sizer.Text == "Large") { water.Size = BleakwindBuffet.Data.Enums.Size.Large; } if (Combo.IsChecked == true && (Application.Current.MainWindow as MainWindow).Combo.Drink == null) { (Application.Current.MainWindow as MainWindow).Combo.Drink = water; } else { (Application.Current.MainWindow as MainWindow).curOrder.Add(water); } return; } }