コード例 #1
0
        private void Facade_Click(object sender, RoutedEventArgs e)
        {
            var theaterLights = new TheaterLights();
            var screen        = new Screen();
            var popcornPopper = new PopcornPopper();
            var projector     = new Projector();
            var dvdPlayer     = new DvdPlayer(projector);
            var tuner         = new Tuner();
            var cdPlayer      = new CdPlayer();
            var amplifier     = new Amplifier(tuner, cdPlayer, dvdPlayer);

            var homeTheaterFacade = new HomeTheaterFacade(amplifier, tuner, cdPlayer, dvdPlayer, theaterLights, screen, popcornPopper);

            homeTheaterFacade.WatchMovie();
        }
コード例 #2
0
        static void Main(string[] args)
        {
            Tuner         _tuner     = new Tuner();
            DvdPlayer     _dvd       = new DvdPlayer();
            CdPlayer      _cd        = new CdPlayer();
            Projector     _projector = new Projector();
            TheaterLights _lights    = new TheaterLights();
            Screen        _screen    = new Screen();
            PopcornPopper _popper    = new PopcornPopper();
            Amplifier     _amp       = new Amplifier(_tuner, _dvd, _cd);

            HomeTheaterFacade homeTheater = new HomeTheaterFacade(_amp, _tuner, _dvd, _cd, _projector, _lights, _screen, _popper);

            homeTheater.WatchMovie("Raiders of the Lost Ark");
            homeTheater.EndMovie();

            Console.ReadLine();
        }