public void buildChair(Chair chair) { foreach (var worker in workers) { worker.operate(chair); } }
public void buildChair(Chair chair) { int cnt = 0; foreach (var itemChair in chairs) { String itemType = getItemType(itemChair.GetType().ToString()); Console.WriteLine("----Start building type of chair " + itemType + " with number " + cnt + "----\n"); if (!itemChair.checkState()) { //pub.publishChair(itemChair); foreach (var worker in workers) { pubWorker.publishWorker(worker, itemChair); } } else { Console.WriteLine("----Done building type of chair " + itemType + " with number " + cnt + "----\n"); } cnt++; } }
public void publishChair(Chair chair) { if (!chair.seat) { OnRaiseCustomEvent(new ChairEventBusMessage("NEED_C", chair)); } if (!chair.feet) { OnRaiseCustomEvent(new ChairEventBusMessage("NEED_F", chair)); } if (!chair.stabilizerBar) { OnRaiseCustomEvent(new ChairEventBusMessage("NEED_S", chair)); } if (!chair.backRest) { OnRaiseCustomEvent(new ChairEventBusMessage("NEED_B", chair)); } if (!chair.package) { OnRaiseCustomEvent(new ChairEventBusMessage("NEED_P", chair)); } }
public void buildChair(Chair chair) { int cnt = 0; foreach (var item in chairs) { String itemType = getItemType(item.GetType().ToString()); Console.WriteLine("----Start building type of chair " + itemType + " with number " + cnt + "----\n"); if (!item.checkState()) { foreach (var worker in workers) { worker.operate(item); } } else { Console.WriteLine("----Done building type of chair " + itemType + " with number " + cnt + "----\n"); } cnt++; } }
public override void operate(Chair chair) { if (!chair.feet) { chair.feet = true; Console.WriteLine(workerName + " done assembling feet."); System.Threading.Thread.Sleep(workTime * 100); } }
public override void operate(Chair chair) { if (!chair.package) { chair.package = true; Console.WriteLine(workerName + " done packing chair."); System.Threading.Thread.Sleep(workTime * 100); } }
public override void operate(Chair chair) { if (!chair.stabilizerBar) { chair.stabilizerBar = true; Console.WriteLine(workerName + " done assembling stabilizer bar."); System.Threading.Thread.Sleep(workTime * 100); } }
public override void operateBus(string Message, Chair chair) { if (Message.Equals("NEED_F")) { this.operate(chair); } else { Console.WriteLine(this.workerName + " said that " + Message + " is not his job"); } }
public ChairEventBusMessage(String s, Chair _chair) { message = s; chiar = _chair; }
public void publishWorker(Worker worker, Chair chair) { worker.operate(chair); OnRaiseCustomEvent(new WorkerEventBusMessage(worker.workerName + ": " + worker.eventMessage)); }
public abstract void operateBus(String Message, Chair chair);
//public Worker(String _workerName, int _workTime, PublishEvent _pub, List<Subscriber> _subscribers) //{ // workerName = _workerName; // workTime = _workTime; // pub = _pub; // subscribers = _subscribers; //} public abstract void operate(Chair chair);