コード例 #1
0
        static void Main(string[] args)
        {
            #region Computer Facade

            var computer = new ComputerFacade();
            computer.Start();

            #endregion

            #region Restuarant

            ServerFacade server = new ServerFacade();

            Console.WriteLine("Hello!  I'll be your server today. What is your name?");
            var name = Console.ReadLine();

            Patron patron = new Patron(name);

            Console.WriteLine("Hello " + patron.Name + ". What appetizer would you like? (1-15):");
            var appID = int.Parse(Console.ReadLine());

            Console.WriteLine("That's a good one.  What entree would you like? (1-20):");
            var entreeID = int.Parse(Console.ReadLine());

            Console.WriteLine("A great choice!  Finally, what drink would you like? (1-60):");
            var drinkID = int.Parse(Console.ReadLine());

            Console.WriteLine("I'll get that order in right away.");

            server.PlaceOrder(patron, appID, entreeID, drinkID);  //Here's what the Facade simplifies

            Console.ReadKey();

            #endregion
        }
コード例 #2
0
ファイル: Facade.cs プロジェクト: yao-lin-902/Design-Patterns
    static void Main(string[] args)
    {
        // client code
        ComputerFacade cf      = new ComputerFacade();
        Computer       home_pc = cf.build();

        // testing the pc
        cf.turn_on(home_pc);
    }