/// <summary> /// Adds the ingredients(Factory). /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void AddIngredientBtn_Click(object sender, RoutedEventArgs e) { this.pizza.AddIngredient(IngredientFactory.CreateIngredient(IngredientList.ThinCrust)); this.pizza.AddIngredient(IngredientFactory.CreateIngredient(IngredientList.Marinara)); this.pizza.AddIngredient(IngredientFactory.CreateIngredient(IngredientList.Mozzarella)); this.pizza.AddIngredient(IngredientFactory.CreateIngredient(IngredientList.Pepperoni)); // This should throw exceptions // this.pizza.AddIngredient(IngredientFactory.CreateIngredient(IngredientList.ThickCrust)); // this.pizza.AddIngredient(IngredientFactory.CreateIngredient(IngredientList.BBQ)); this.PizzaLbl.Text = this.pizza.ToString(); this.PriceLbl.Content = string.Format("Price: {0:C}", this.pizza.CalculatePrice()); }