示例#1
0
 public ConcreteMediator(ConcreateColleage1 concreateColleage1, ConcreateColleage2 concreateColleage2)
 {
     this._concreateColleage1 = concreateColleage1;
     this._concreateColleage1.SetMediator(this);
     this._concreateColleage2 = concreateColleage2;
     this._concreateColleage2.SetMediator(this);
 }
示例#2
0
        static void Main(string[] args)
        {
            // The client code.
            ConcreateColleage1 concreateColleage1 = new ConcreateColleage1();
            ConcreateColleage2 concreateColleage2 = new ConcreateColleage2();

            new ConcreteMediator(concreateColleage1, concreateColleage2);

            Console.WriteLine("Client triggets operation A.");
            concreateColleage1.DoA();

            Console.WriteLine();

            Console.WriteLine("Client triggers operation D.");
            concreateColleage2.DoD();
        }