private void radPizzaVegetariana_CheckedChanged(object sender, EventArgs e) { // Borrar/Destruir objeto pizzaRegular. pizzaRegular = null; // Limpia todos los CheckBoxes del gbIngredientes. foreach (CheckBox cbk in gbIngredientes.Controls) { cbk.Checked = false; } pizzaVegetariana = new ConcretePizzaVegetariana(); pbxPizza.Image = pizzaVegetariana.PintarImagen(); tipoPizza = TipoPizza.Vegetariana; gbIngredientes.Enabled = true; Mostrar(); }
private void cbxJalapeño_CheckedChanged(object sender, EventArgs e) { switch (tipoPizza) { case TipoPizza.Regular: if (cbxJalapeño.Checked) { // Agregar jalapeño... pizzaRegular = new Jalapeño <ConcretePizzaRegular>(pizzaRegular); pbxJalapeno.Image = pizzaRegular.PintarImagen(); } else { // Eliminar jalapeño... pizzaRegular = new Jalapeño <ConcretePizzaRegular>(new ConcretePizzaRegular()).Undecorate(); ActualizarIngredientes(); pbxJalapeno.Image = null; } break; case TipoPizza.Vegetariana: if (cbxJalapeño.Checked) { // Agregar jalapeño... pizzaVegetariana = new Jalapeño <ConcretePizzaVegetariana>(pizzaVegetariana); pbxJalapeno.Image = pizzaVegetariana.PintarImagen(); } else { // Eliminar jalapeño... pizzaVegetariana = new Jalapeño <ConcretePizzaVegetariana>(new ConcretePizzaVegetariana()).Undecorate(); ActualizarIngredientes(); pbxJalapeno.Image = null; } break; } Mostrar(); }
private void cbxPepperoni_CheckedChanged(object sender, EventArgs e) { switch (tipoPizza) { case TipoPizza.Regular: if (cbxPepperoni.Checked) { // Agregar pepperoni... pizzaRegular = new Pepperoni <ConcretePizzaRegular>(pizzaRegular); pbxPepperoni.Image = pizzaRegular.PintarImagen(); } else { // Descartar pepperoni... pizzaRegular = new Pepperoni <ConcretePizzaRegular>(new ConcretePizzaRegular()).Undecorate(); ActualizarIngredientes(); pbxPepperoni.Image = null; } break; case TipoPizza.Vegetariana: if (cbxPepperoni.Checked) { // Agregar pepperoni... pizzaVegetariana = new Pepperoni <ConcretePizzaVegetariana>(pizzaVegetariana); pbxPepperoni.Image = pizzaVegetariana.PintarImagen(); } else { // Descartar pepperoni... pizzaVegetariana = new Pepperoni <ConcretePizzaVegetariana>(new ConcretePizzaVegetariana()).Undecorate(); ActualizarIngredientes(); pbxPepperoni.Image = null; } break; } Mostrar(); }
private void ActualizarIngredientes() { foreach (CheckBox cbk in gbIngredientes.Controls) { if (!cbk.Checked) { continue; } switch (tipoPizza) { case TipoPizza.Regular: switch (cbk.Text.ToLower()) { case "pepperoni": pizzaRegular = new Pepperoni <ConcretePizzaRegular>(pizzaRegular); break; case "jamón": pizzaRegular = new Jamon <ConcretePizzaRegular>(pizzaRegular); break; case "tocino": pizzaRegular = new Tocino <ConcretePizzaRegular>(pizzaRegular); break; case "chile morron": pizzaRegular = new ChileMorron <ConcretePizzaRegular>(pizzaRegular); break; case "jalapeño": pizzaRegular = new Jalapeño <ConcretePizzaRegular>(pizzaRegular); break; case "champiñon": pizzaRegular = new Champiñon <ConcretePizzaRegular>(pizzaRegular); break; case "cebolla": pizzaRegular = new Cebolla <ConcretePizzaRegular>(pizzaRegular); break; case "tomate": pizzaRegular = new Tomate <ConcretePizzaRegular>(pizzaRegular); break; case "aceituna": pizzaRegular = new Aceituna <ConcretePizzaRegular>(pizzaRegular); break; case "piña": pizzaRegular = new Piña <ConcretePizzaRegular>(pizzaRegular); break; } break; case TipoPizza.Vegetariana: switch (cbk.Text.ToLower()) { case "pepperoni": pizzaVegetariana = new Pepperoni <ConcretePizzaVegetariana>(pizzaVegetariana); break; case "jamón": pizzaVegetariana = new Jamon <ConcretePizzaVegetariana>(pizzaVegetariana); break; case "tocino": pizzaVegetariana = new Tocino <ConcretePizzaVegetariana>(pizzaVegetariana); break; case "chile morron": pizzaVegetariana = new ChileMorron <ConcretePizzaVegetariana>(pizzaVegetariana); break; case "jalapeño": pizzaVegetariana = new Jalapeño <ConcretePizzaVegetariana>(pizzaVegetariana); break; case "champiñon": pizzaVegetariana = new Champiñon <ConcretePizzaVegetariana>(pizzaVegetariana); break; case "cebolla": pizzaVegetariana = new Cebolla <ConcretePizzaVegetariana>(pizzaVegetariana); break; case "tomate": pizzaVegetariana = new Tomate <ConcretePizzaVegetariana>(pizzaVegetariana); break; case "aceituna": pizzaVegetariana = new Aceituna <ConcretePizzaVegetariana>(pizzaVegetariana); break; case "piña": pizzaVegetariana = new Piña <ConcretePizzaVegetariana>(pizzaVegetariana); break; } break; } } }