Exemplo n.º 1
0
        static void Main()
        {
            ConcreteMediator   m  = new ConcreteMediator();
            ConcreteColleague1 c1 = new ConcreteColleague1(m);
            ConcreteColleague2 c2 = new ConcreteColleague2(m);
            ConcreteColleague3 c3 = new ConcreteColleague3(m);

            m.Colleague1 = c1;
            m.Colleague2 = c2;
            m.Send("How are you?", c1);
            m.Send("Fine, thanks", c2);
            m.Send("Hello!", c3);
            // Wait for user
            Console.Read();
        }
Exemplo n.º 2
0
        static void Main()
        {
            Console.OutputEncoding = Encoding.UTF8;
            ConcreteMediator   m  = new ConcreteMediator();
            ConcreteColleague1 c1 = new ConcreteColleague1(m);
            ConcreteColleague2 c2 = new ConcreteColleague2(m);

            m.Colleague1 = c1;
            m.Colleague2 = c2;

            m.Send("How are you?", c1);
            m.Send("Fine, thanks", c2);

            // Wait for user
            Console.Read();
        }