예제 #1
0
 public void buildChair(Chair chair)
 {
     foreach (var worker in workers)
     {
         worker.operate(chair);
     }
 }
예제 #2
0
        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++;
            }
        }
예제 #3
0
        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));
            }
        }
예제 #4
0
        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++;
            }
        }
예제 #5
0
 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);
     }
 }
예제 #7
0
 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);
     }
 }
예제 #8
0
 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;
 }
예제 #10
0
 public void publishWorker(Worker worker, Chair chair)
 {
     worker.operate(chair);
     OnRaiseCustomEvent(new WorkerEventBusMessage(worker.workerName + ": " + worker.eventMessage));
 }
예제 #11
0
 public abstract void operateBus(String Message, Chair chair);
예제 #12
0
 //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);