Esempio n. 1
0
        /// <summary>
        /// O padrão facade fornece uma interface simplificada para um conjunto de interfaces em um subsistema. Ele define uma interface de nível mais
        /// alto que facilita a utilização do subsistema.
        /// </summary>
        private static void TestFacade()
        {
            HomeTheaterFacade homeTheater = new HomeTheaterFacade(
                new Amplifier(),
                new Tuner(),
                new DvdPlayer(),
                new CdPlayer(),
                new Projector(),
                new EnvironmentLight(),
                new Screen(),
                new PopcornMachine()
                );

            homeTheater.WatchMovie("Fight Club");
        }
Esempio n. 2
0
        public static void UseFacadePattern(IView view)
        {
            Amplifier     amp       = new Amplifier(view);
            BlueRayPlayer blue      = new BlueRayPlayer(view);
            PopcornPopper pop       = new PopcornPopper(view);
            Projector     projector = new Projector(view);
            Screen        screen    = new Screen(view);
            TheaterLights lights    = new TheaterLights(view);

            HomeTheaterFacade facade = new HomeTheaterFacade(amp, blue, projector, lights, screen, pop, view);

            facade.WatchMovie("LOTR");
            view.DisplayMessage(string.Empty);
            facade.EndMovie();
        }