Example #1
0
 public override void Send(string message, Colleague colleague)
 {
     if (colleague == Farmer)
     {
         Cannery.MakeKetchup(message);
     }
     else if (colleague == Cannery)
     {
         Shop.SellKetchup(message);
     }
 }
Example #2
0
        static void Main()
        {
            var mediator = new ConcreteMediator();
            var farmer   = new Farmer(mediator);
            var cannery  = new Cannery(mediator);
            var shop     = new Shop(mediator);

            mediator.Farmer  = farmer;
            mediator.Cannery = cannery;
            mediator.Shop    = shop;

            farmer.GrowTomato();

            // Delay.
            Console.ReadKey();
        }