예제 #1
0
 public void Cook(CoffeeBuilder coffeeBuilder)
 {
     coffeeBuilder.AddCoffeeShot();
     coffeeBuilder.AddHotWater();
     coffeeBuilder.AddSteamedMilk();
     coffeeBuilder.AddFoamedMilk();
     coffeeBuilder.AddPrice();
 }
예제 #2
0
        private void button_pay_Click(object sender, RoutedEventArgs e)
        {
            int    price       = 0;
            string coffee_type = null;

            switch (selectedbutton)
            {
            case 1:
                builder = new EspressoBuilder();
                coffeemaker.Cook(builder);
                price       = builder.Coffee.GetPrice();
                coffee_type = builder.Coffee.GetCoffeeType();
                break;

            case 2:
                builder = new CappuccinoBuilder();
                coffeemaker.Cook(builder);
                price       = builder.Coffee.GetPrice();
                coffee_type = builder.Coffee.GetCoffeeType();
                break;

            case 3:
                builder = new LatteBuilder();
                coffeemaker.Cook(builder);
                price       = builder.Coffee.GetPrice();
                coffee_type = builder.Coffee.GetCoffeeType();
                break;

            case 4:
                builder = new LatteMacchiatoBuilder();
                coffeemaker.Cook(builder);
                price       = builder.Coffee.GetPrice();
                coffee_type = builder.Coffee.GetCoffeeType();
                break;

            case 5:
                builder = new CaffeeAmericanoBuilder();
                coffeemaker.Cook(builder);
                price       = builder.Coffee.GetPrice();
                coffee_type = builder.Coffee.GetCoffeeType();
                break;
            }
            window_pay pay_window = new window_pay();

            pay_window.Show();
            SingletonDB db = SingletonDB.GetInstance();

            db.Logger("type: " + coffee_type + ", price: " + price);
        }