Exemplo n.º 1
0
        private static House Initialization()
        {
            House house = new House("Дом1");
            house.AddRoom(new Room("Зал"));
            house.AddRoom(new Room("Кухня"));

            house.AddDevice("Зал", new ClimatControl("Климат"));

            HouseCinema cinema = new HouseCinema("Кинотеатр");

            Tv tv = new Tv("TV1");
            tv.Connection(cinema);

            DVDPlayer dvd = new DVDPlayer("DVD");
            dvd.Connection(cinema);

            house.AddDevice("Зал", cinema);
            house.AddDevice("Зал", new DVDPlayer("DVD"));
            house.AddDevice("Зал", new Tv("TV1"));
            house.AddDevice("Зал", new Tv("TV2"));
            house.AddDevice("Зал", new Lamp("Лампа1"));
            house.AddDevice("Зал", new Lamp("Лампа2"));

            house.AddDevice("Кухня", new Tv("TV"));
            house.AddDevice("Кухня", new Heating("Heating"));
            house.AddDevice("Кухня", new Conditioner("Condition"));
            house.AddDevice("Кухня", new Lamp("Лампа1"));
            house.AddDevice("Кухня", new Lamp("Лампа2"));

            return house;
        }
Exemplo n.º 2
0
        private static House Initialization()
        {
            House house = new House("Дом1");

            house.AddRoom(new Room("Зал"));
            house.AddRoom(new Room("Кухня"));

            house.AddDevice("Зал", new ClimatControl("Климат"));

            HouseCinema cinema = new HouseCinema("Кинотеатр");

            Tv tv = new Tv("TV1");

            tv.Connection(cinema);

            DVDPlayer dvd = new DVDPlayer("DVD");

            dvd.Connection(cinema);


            house.AddDevice("Зал", cinema);
            house.AddDevice("Зал", new DVDPlayer("DVD"));
            house.AddDevice("Зал", new Tv("TV1"));
            house.AddDevice("Зал", new Tv("TV2"));
            house.AddDevice("Зал", new Lamp("Лампа1"));
            house.AddDevice("Зал", new Lamp("Лампа2"));

            house.AddDevice("Кухня", new Tv("TV"));
            house.AddDevice("Кухня", new Heating("Heating"));
            house.AddDevice("Кухня", new Conditioner("Condition"));
            house.AddDevice("Кухня", new Lamp("Лампа1"));
            house.AddDevice("Кухня", new Lamp("Лампа2"));

            return(house);
        }
Exemplo n.º 3
0
 public void Connection(HouseCinema houseCinema)
 {
     if (houseCinema != null)
     {
         houseCinema.AddDevice(this);
     }
 }
Exemplo n.º 4
0
 public void Connection(HouseCinema houseCinema)
 {
     if (houseCinema != null)
         houseCinema.AddDevice(this);
 }