コード例 #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);
     }
 }
コード例 #6
0
 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");
     }
 }
コード例 #9
0
 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
ファイル: Worker.cs プロジェクト: kouweizhong/ChairFactory
 public abstract void operateBus(String Message, Chair chair);
コード例 #12
0
ファイル: Worker.cs プロジェクト: kouweizhong/ChairFactory
 //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);