Esempio n. 1
0
        public static void Menu()
        {
            MainMenu();
            char mode = ' ';

            Bouquet    currentBuquet = null;
            FlowerShop shop          = FlowerShop.GetSource();

            do
            {
                mode = Program.EnterMode();
                switch (mode)
                {
                case 'o':
                    MainMenu();
                    break;

                case 'c':
                    shop.SetBuilder(new CascadeBouquetBuilder());
                    currentBuquet = shop.Menu();
                    MainMenu();
                    break;

                case 'r':
                    shop.SetBuilder(new RoundBouquetBuilder());
                    currentBuquet = shop.Menu();
                    MainMenu();
                    break;

                case 't':
                    shop.SetBuilder(new TriangularBouquetBuilder());
                    currentBuquet = shop.Menu();
                    MainMenu();
                    break;

                case 'i':
                    if (currentBuquet != null)
                    {
                        currentBuquet.GetInfo();
                    }
                    else
                    {
                        Console.WriteLine(" < Bouquet wasn't constructed > ");
                    }
                    break;

                case 'w':
                    if (currentBuquet != null)
                    {
                        BouquetWrapper wrapper = new BouquetWrapper();
                        wrapper.ChooseWrapper();
                        MainMenu();
                        currentBuquet = new WrappedBouquet(currentBuquet, wrapper);
                    }
                    else
                    {
                        Console.WriteLine(" < Bouquet wasn't constructed > ");
                    }
                    break;

                case 'p':
                    if (currentBuquet != null)
                    {
                        Postcard postcard = new Postcard();
                        postcard.SignPostcard();
                        currentBuquet = new SignedBouquet(currentBuquet, postcard);
                    }
                    else
                    {
                        Console.WriteLine(" < Bouquet wasn't constructed > ");
                    }
                    break;

                case 'q':
                    break;

                default:
                    Console.WriteLine(" < Wrong mode > ");
                    break;
                }
            } while (mode != 'q');
        }
Esempio n. 2
0
 public WrappedBouquet(SignedBouquet bouquet, BouquetWrapper wrapper) : base(bouquet)
 {
     Postcard = bouquet.Postcard;
     mainConstructor(wrapper);
 }