public override void Send(string message, Colleague colleague)
 {
     if (colleague == colleague1)
     {
         colleague2.Notify(message);
     }
     else
     {
         colleague1.Notify(message);
     }
 }
Example #2
0
        private static void Main()
        {
            var mediator = new Spokesperson();
            var alice    = new Colleague("Alice", mediator);
            var bob      = new Colleague("Bob", mediator);

            alice.Say("I want feature X ready for tomorrow !");
            bob.Say("Sorry, I'm on holidays for the next two weeks !");

            Console.WriteLine();
            Console.WriteLine("Press any key...");
            Console.Read();
        }
Example #3
0
 public abstract void Send(string message, Colleague colleague);
Example #4
0
 public abstract void Send(string message, Colleague colleague);
Example #5
0
 public override void Send(string message, Colleague colleague) =>
 colleagues.Where(col => col == colleague).ToList()
 .ForEach(coll => coll.HandleNotification(message));
Example #6
0
 public void Register(Colleague colleague)
 {
     colleague.SetMediator(this);
     colleagues.Add(colleague);
 }
Example #7
0
 public void Send(string message, Colleague to)
 {
     mediator.Send(message, this, to);
 }