public CustomerProcess() { welcome = new Welcome( this ); shop = new Shop( this ); purchase = new Purchase( this ); exit = new Exit( this ); }
public override void Register(Colleague colleague) { if (!colleagues.ContainsValue(colleague)) { colleagues[colleague.Name] = colleague; } colleague.Chatroom = this; }
public void PostMessage(Colleague sender, string message) { foreach (Colleague c in ColleagueList) { if (c != sender) { c.ReceiveMessage(message, sender.Name); } } }
public override void Send(string message, Colleague colleague) { if (colleague == _colleague1) { _colleague2.Notify(message); } else { _colleague1.Notify(message); } }
public override void Send(string message, Colleague colleague) { if (colleague == colleague1) { colleague2.Notify(message); } else { colleague1.Notify(message); } //throw new NotImplementedException(); }
//public void Register(Colleague colleague) //{ // colleague.Mediator = this; // _colleagues.Add(colleague); //} //public T CreateCollegue<T>() where T : Colleague, new() //{ // var c = new T {Mediator = this}; // _colleagues.Add(c); // return c; //} public void Send(string message, Colleague colleague) { if (colleague == Colleague1) { Colleague2.HandleNotification(message); } else { Colleague1.HandleNotification(message); } //_colleagues.Where(c => c != colleague).ToList().ForEach(c => c.HandleNotification(message)); }
public override void Send(string msg, Colleague colleague) { if (Customer == colleague) { Programmer.Notify(msg); } else if (Programmer == colleague) { Tester.Notify(msg); } else if (Tester == colleague) { Customer.Notify(msg); } }
public override void Send(string msg, Colleague colleague) { if (colleague == Client) { Waiter.Notify(msg); } else if (colleague == Waiter) { Cheff.Notify(msg); } else if (colleague == Cheff) { Client.Notify(msg); } }
public override void Send(string order, Colleague colleague) { if (colleague == Waiter) { if (orders.Contains(order) == false) { orders.Add(order); Cook.MakeOrder(order); } } else if (colleague == Cook) { Waiter.GiveAnOrder(order); } }
public override void send(Colleague c, String message) { if (c == cc1) { cc2.Notify(message); } else if (c == cc2) { cc1.Notify(message); } else { Console.WriteLine("invalid message!!!"); } }
public override void Send(string msg, Colleague colleague) { /* если отправитель - исполнитель, значит продукт готов * отправляем сообщение представителю*/ if (Executor == colleague) { Executor.Notify(msg); } /* если отправитель - представитель, * отправляем сообщение заказчику*/ else if (Representative == colleague) { Representative.Notify(msg); } }
static void Main(string[] args) { var mediator = new ConcreteMediator();; // Colleague1 c1 = new Colleague1(); // mediator.Register(c1); // Colleague2 c2 = new Colleague2(); call Create colleague as single statement instead of both // mediator.Register(c2); // mediator.Colleague1 = c1; // mediator.Colleague2 = c2; Colleague c1 = mediator.CreateColleague <Colleague1>(); Colleague c2 = mediator.CreateColleague <Colleague2>(); mediator.Send("a message", c1); mediator.Send("another message", c2); }
static void Main(string[] args) { Mediator m = new Mediator(); Colleague head1 = new Colleague(m, "John"); ColleagueB branch1 = new ColleagueB(m, "David"); Colleague head2 = new Colleague(m, "Lucy"); head1.Send("Meeting on Tuesday, please all ack"); branch1.Send("Ack"); m.Block(branch1.Receive); head1.Send("Still awaiting some Acks"); head2.Send("Ack"); m.Unblock(branch1.Receive); head1.Send("Thanks all"); Console.ReadLine(); }
static void Sample2() { Sample2.Mediator m = new Sample2.Mediator(); Colleague head1 = new Colleague(m, "John"); ColleagueB branch1 = new ColleagueB(m, "David"); Colleague head2 = new Colleague(m, "Lucy"); head1.Send("Meeting on Tuesday, please all ack"); branch1.Send("Ack"); m.Block(branch1.Receive); head1.Send("Still awaiting some Acks"); head2.Send("Ack"); m.Unblock(branch1.Receive); head1.Send("Thanks all"); }
public override void Send(string message, Colleague colleague) { if (Customer == colleague) { Programmer.Notify(message); } if (colleague == Programmer) { Tester.Notify(message); } if (colleague == Tester) { Customer.Notify(message); } }
public override void RelatedChange(Colleague colleague) { if (colleague is Manager) { Mgr.AddTask(); Dev.DevTask(); Tes.TestTask(); } else if (colleague is Develop) { Dev.SolveProblem(); Tes.VerifyProblem(); } else if (colleague is Test) { Tes.FindProblem(); Mgr.Supervise(); Dev.SolveProblem(); } }
public override void Send(string msg, Colleague colleague) { // если отправитель - завод, значит есть продукт // отправляем сообщение курьеру - доставить продукцию if (Factory == colleague) { Courier.Notify(msg); } // если отправитель - курьер, значит товар доставлен // отправляем сообщение в магазин else if (Courier == colleague) { Shop.Notify(msg); } // если отправитель - магазин, значит продукция сбыта // отправляем сообщение заводу else if (Shop == colleague) { Factory.Notify(msg); } }
public override void Send(string message, Colleague colleague) { // Если отправитель - заказчик, значит есть новый заказ // отправляем сообщение программисту - выполнить заказ if (Customer == colleague) { Programmer.Notify(message); } // Если отправитель - программист, то можно приступать к тестированию // отправляем сообщение тестеру else if (Programmer == colleague) { Tester.Notify(message); } // Если отправитель - тест, значит продукт готов // отправляем сообщение заказчику else if (Tester == colleague) { Customer.Notify(message); } }
private void btnGo_Click(object sender, EventArgs e) { Colleague colleagueBob = new Colleague("Bob"); Colleague colleagueSue = new Colleague("Sue"); Colleague colleagueChris = new Colleague("Chris"); Colleague colleagueDonna = new Colleague("Donna"); IMediator mediator1 = new Mediator(); mediator1.Register(colleagueBob); mediator1.Register(colleagueSue); mediator1.Register(colleagueChris); colleagueBob.SendMessage(mediator1, "Hi folks!"); IMediator mediator2 = new Mediator(); mediator2.Register(colleagueSue); mediator2.Register(colleagueDonna); colleagueSue.SendMessage(mediator2, "A more private message."); }
public override void Register(Colleague colleague) { _mediator.Add(colleague.name, colleague); colleague.chatroom = this; }
public abstract string Send(string msg, Colleague colleague);
public override void Send(string message, Colleague colleague) { colleagues.Where(c => c != colleague).ToList().ForEach(c => c.HandleNotification(message)); }
public void Register(Colleague colleague) { colleague.SetMediator(this); colleagues.Add(colleague); }
public abstract void Send(string message, Colleague colleague);
public abstract void Send(string msg, Colleague colleague);
public void Register(Colleague colleague) { ColleagueList.Add(colleague); }
public abstract void send(Colleague mediator, String message);
public abstract void pushMessage(string message, Colleague enty);
public abstract void Register(Colleague colleague);
public abstract void Send(Colleague _from, string msg);
public void AddColleague(Colleague a) { a.SetMediator(this); colleague.Add(a); }
public void Add(Colleague subscriber) { colleagues.Add(subscriber); }
public abstract void RelatedChange(Colleague colleague);
public void Send(string message, Colleague colleague) { mediator.Send(message, colleague); }
public void Send(string message, Colleague colleague) { if (colleague == colleague1) { colleague1.Notify(message); } else if (colleague == colleague2) { colleague2.Notify(message); } }