Пример #1
0
 public void Notify(object sender, string ev)
 {
     if (ev == "A")
     {
         Console.WriteLine("Mediator reacts on A and triggers following operations:");
         _component2.DoC();
     }
     if (ev == "D")
     {
         Console.WriteLine("Mediator reacts on D and triggers following operations:");
         _component1.DoB();
         _component2.DoC();
     }
 }
Пример #2
0
        public string Notify(object sender, string ev)
        {
            switch (ev)
            {
            case "A":
                _component2.DoC();
                return(ev);

            case "D":
                _component1.DoB();
                _component2.DoC();
                return(ev);
            }
            return(string.Empty);
        }