public void RegisterColleague(IColleague colleague) { if (Colleagues.Contains(colleague)) { return; } colleague.SetMediator(this); Colleagues.Add(colleague); }
/// <summary> /// 中介者可以动态地与某个同事建立联系 /// </summary> /// <param name="name"></param> /// <param name="colleague"></param> public void AddColleague(String name, IColleague colleague) { //在中介者这里帮助具体同事建立起于中介者的联系 colleague.SetMediator(this); this.Colleagues.Add(name, colleague); }