public override void Send(string msg, Composition composition) { if (composition == Alarm) { CoffeMaker.CoffeeTurn(msg); } else if (composition == CoffeMaker) { Shower.WaterHeating(msg); ClimateControl.TemperatDay(msg); } }
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(); }