Exemplo n.º 1
0
        static void Main(string[] args)
        {
            var key = new ConsoleKeyInfo();

            while (!(key.Key == ConsoleKey.D3 || key.Key == ConsoleKey.NumPad3))
            {
                var   cocina = new Cocina();
                Pizza pizza  = null;
                key = ShowMenu();
                switch (key.Key)
                {
                case ConsoleKey.D1:
                case ConsoleKey.NumPad1:
                    pizza = cocina.CocinarPizza(new CuatroQuesosBuilder(TamañoEnum.Familiar));
                    break;

                case ConsoleKey.D2:
                case ConsoleKey.NumPad2:
                    pizza = cocina.CocinarPizza(new HawaianaBuilder(TamañoEnum.Mediana));
                    break;
                }

                if (key.Key != ConsoleKey.D3 && key.Key != ConsoleKey.NumPad3 && key.Key != ConsoleKey.Escape)
                {
                    Console.WriteLine();
                    Console.WriteLine(pizza.ToString());
                    Wait();
                }
            }
        }
Exemplo n.º 2
0
        public GUI()
        {
            InitializeComponent();

            _cocina = new Cocina();
            dataGridView1.DataSource = new BindingSource {
                DataSource = _hamburguesas
            };
            dataGridView1.Columns["StringIngredientes"].Width = 300;

            _total = 0.00;
            UpdateTotal();
        }
Exemplo n.º 3
0
        private void button3_Click(object sender, EventArgs e)
        {
            var         cocina      = new Cocina();
            Hamburguesa hamburguesa = cocina.CocinarHamburguesa(new McPolloBuilder(TipoPanEnum.Con_Semilla, TipoCarneEnum.Pollo)); //30

            hamburguesa.IngredientesString = string.Join(",", hamburguesa.Ingredientes.ToArray());

            lista.Add(hamburguesa);
            MessageBox.Show("Hamburguesa " + hamburguesa.Nombre + " agregada con éxito.");

            var source = new BindingSource(lista, null);

            dataGridView1.DataSource = source;

            Ajustar();
            ActualizarPrecio();
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            Cocina       cocina               = new Cocina();
            PizzaBuilder hawai_pizzabuilder   = new HawaiPizzaBuilder();
            PizzaBuilder picante_pizzabuilder = new PicantePizzaBuilder();

            Console.WriteLine("Con Hawai:");
            cocina.setPizzaBuilder(hawai_pizzabuilder);
            cocina.construirPizza();
            Pizza pizza = cocina.getPizza();

            Console.WriteLine("Con Picante:");
            cocina.setPizzaBuilder(picante_pizzabuilder);
            cocina.construirPizza();
            Pizza pizza2 = cocina.getPizza();

            Console.ReadKey();
        }