コード例 #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 void Notify(object sender, string e)
        {
            switch (e)
            {
            case "A":
                Console.WriteLine("Mediator reacts on A and triggers folowing operations:");
                _component2.DoC();
                break;

            case "D":
                Console.WriteLine("Mediator reacts on D and triggers following operations:");
                _component1.DoB();
                _component2.DoC();
                break;
            }
        }