private static void Main()
        {
            var amplifier = new Amplifier();
            var tuner     = new Tuner();
            var dvd       = new DvdPlayer();
            var cd        = new CdPlayer();
            var projector = new Projector();
            var lights    = new TheaterLights();
            var screen    = new Screen();
            var popper    = new PopcornPopper();

            var homeTheater = new HomeTheaterFacade(amplifier, tuner, dvd, cd, projector, lights, screen, popper);

            homeTheater.WatchMovie("Raiders of the Lost Ark");
            homeTheater.EndMovie();
        }
Esempio n. 2
0
        //外观模式设计基于子系统设计简单的接口方便客户端调用子系统的功能
        static void Main(string[] args)
        {
            Amplifier     amp       = new Amplifier();
            DvdPlayer     dvd       = new DvdPlayer(amp);
            CDPlayer      cd        = new CDPlayer(amp);
            Projector     projector = new Projector(dvd);
            Tuner         tuner     = new Tuner(amp);
            Screen        screen    = new Screen();
            TheaterLights lights    = new TheaterLights();
            PopcornPopper popper    = new PopcornPopper();

            HomeTheaterFacade homeTheater = new HomeTheaterFacade(amp, tuner, dvd, cd, projector, screen, lights, popper);

            homeTheater.WatchMovie("Raiders of the Lost Ark");
            homeTheater.EndMovie();
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            Amplifier         amp         = new Amplifier();
            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();
            HomeTheatreFacade homeTheater = new HomeTheatreFacade(amp, tuner, dvd, cd, projector, lights, screen, popper);


            homeTheater.WatchMovie("Avatar");
            homeTheater.EndMovie();
        }
Esempio n. 4
0
 public HomeTheaterFacade(PopcornPopper popper,
                          TheaterLights lights,
                          Screen screen,
                          DvdPlayer dvd,
                          CdPlayer cd,
                          Tuner tuner,
                          Projector projector,
                          Amplifier amp)
 {
     Popper    = popper;
     Lights    = lights;
     Screen    = screen;
     Dvd       = dvd;
     Cd        = cd;
     Tuner     = tuner;
     Projector = projector;
     Amp       = amp;
 }
 public HomeTheaterFacade(Amplifier amp,
                          Tuner tuner,
                          DvdPlayer dvd,
                          CdPlayer cd,
                          Projector projector,
                          TheaterLights lights,
                          Screen screen,
                          PopcornPopper popper)
 {
     _amp       = amp;
     _tuner     = tuner;
     _dvd       = dvd;
     _cd        = cd;
     _projector = projector;
     _lights    = lights;
     _screen    = screen;
     _popper    = popper;
 }
Esempio n. 6
0
 public HomeTheaterFacade(Amplifier amp,
                          Tuner tuner,
                          DvdPlayer dvd,
                          CDPlayer cd,
                          Projector projector,
                          Screen screen,
                          TheaterLights lights,
                          PopcornPopper popper)
 {
     this.amp       = amp;
     this.tuner     = tuner;
     this.dvd       = dvd;
     this.cd        = cd;
     this.projector = projector;
     this.screen    = screen;
     this.lights    = lights;
     this.popper    = popper;
 }
Esempio n. 7
0
        static void Main(string[] args)
        {
            PopcornPopper popper    = new PopcornPopper();
            TheaterLights lights    = new TheaterLights();
            Screen        screen    = new Screen();
            DvdPlayer     dvd       = new DvdPlayer();
            CdPlayer      cd        = new CdPlayer();
            Tuner         tuner     = new Tuner();
            Projector     projector = new Projector(dvd);
            Amplifier     amp       = new Amplifier(tuner, dvd, cd);

            HomeTheaterFacade facade = new HomeTheaterFacade(popper, lights, screen, dvd,
                                                             cd, tuner, projector, amp);

            facade.WatchMovie();
            Console.WriteLine();
            facade.EndMovie();
        }
Esempio n. 8
0
        static void Main(string[] args)
        {
            // Initialize components
            var popper    = new PopcornPopper();
            var lights    = new TheaterLights();
            var screen    = new Screen();
            var projector = new Projector();
            var amp       = new Amplifier();
            var dvd       = new DvdPlayer();

            // Watch "Raiders of the Lost Ark"
            var movieTitle = "Raiders of the Lost Ark";

            Console.WriteLine($"Get ready to watch a movie...");
            popper.On();
            lights.Dim(10);
            screen.Down();
            projector.On();
            projector.WideScreenMode();
            amp.On();
            amp.setDvd(dvd);
            amp.SetSurroundSound();
            amp.SetVolume(5);
            dvd.On();
            dvd.Play(movieTitle);

            // End Movie
            Console.WriteLine("Shutting movie theater down");
            popper.Off();
            lights.On();
            screen.Up();
            projector.Off();
            amp.Off();
            dvd.Stop();
            dvd.Eject();
            dvd.Off();
        }
Esempio n. 9
0
 public DvdPlayer(Amplifier amp)
 {
     this.amp = amp;
 }
Esempio n. 10
0
 public CDPlayer(Amplifier amp)
 {
     this.amp = amp;
 }
Esempio n. 11
0
 public Tuner(Amplifier amp)
 {
     this.amp = amp;
 }