public override void Send(string message, Colleague colleague)
 {
     if (colleague == colleague1)
     {
         colleague2.Notify(message);
     }
     else
     {
         colleague1.Notify(message);
     }
 }
        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();
        }
Beispiel #3
0
 public abstract void Send(string message, Colleague colleague);
Beispiel #4
0
 public abstract void Send(string message, Colleague colleague);
Beispiel #5
0
 public override void Send(string message, Colleague colleague) =>
 colleagues.Where(col => col == colleague).ToList()
 .ForEach(coll => coll.HandleNotification(message));
Beispiel #6
0
 public void Register(Colleague colleague)
 {
     colleague.SetMediator(this);
     colleagues.Add(colleague);
 }
Beispiel #7
0
 public void Send(string message, Colleague to)
 {
     mediator.Send(message, this, to);
 }