Пример #1
0
 public override void Send(string msg, Composition composition)
 {
     if (composition == Alarm)
     {
         CoffeMaker.CoffeeTurn(msg);
     }
     else if (composition == CoffeMaker)
     {
         Shower.WaterHeating(msg);
         ClimateControl.TemperatDay(msg);
     }
 }
Пример #2
0
        static void Main(string[] args)
        {
            var mediator   = new ConcreteSmartHome();
            var alarm      = new Alarm(mediator);
            var coffemaker = new CoffeMaker(mediator);
            var shower     = new Shower(mediator);
            var climate    = new ClimateControl(mediator);

            mediator.Alarm          = alarm;
            mediator.CoffeMaker     = coffemaker;
            mediator.Shower         = shower;
            mediator.ClimateControl = climate;

            alarm.AlarmEvent();

            Console.ReadKey();
        }