Example #1
0
 public DvdFacade(Dvd _dvd, Light _light, Popper _popper, Screen _screen)
 {
     dvd = _dvd;
     light = _light;
     popper = _popper;
     screen = _screen;
 }
 protected void btn_Close_Click(object sender, EventArgs e)
 {
     Dvd dvd = new Dvd();
     Light light = new Light();
     Popper popper = new Popper();
     Screen screen = new Screen();
     //不好的方法
     //ShowMsg(dvd.Off());
     //ShowMsg(screen.Up());
     //ShowMsg(screen.Off());
     //ShowMsg(popper.Off());
     //ShowMsg(light.Off());
     //運用表象模式
     DvdFacade dvdFacade = new DvdFacade(dvd, light, popper, screen);
     ShowMsg(dvdFacade.Close ());
 }