Esempio n. 1
0
        /// <summary>
        /// Produces the order.
        /// </summary>
        private void ProduceOrder()
        {
            while (true)
            {
                Queue <CustomOrder> customOrderQueue = order.CustomOrderQueue;
                customOrderQueue.Enqueue(customOrder);

                switch (customOrderQueue.Peek().OrderItem)
                {
                case OrderList.RoastedHotdog:
                    ProduceRoastedHotdog();
                    break;

                case OrderList.OrdinaryHotdog:
                    ProduceOrdinaryHotdog();
                    break;

                case OrderList.RoastedSausageWithBread:
                    ProduceRoastedSausageWithBread();
                    break;

                case OrderList.CookedSausageWithBread:
                    ProduceCookedSausageWithBread();
                    break;

                case OrderList.SloppyJoe:
                    ProduceSloppyJoe();
                    break;

                case OrderList.FrenchFries:
                    ProduceFrenchFries();
                    break;

                default:
                    Debug.Write($"Order Doesn't Exist.");
                    break;
                }

                ProductProduced?.Invoke(customOrderQueue, new ProductEventArgs($"Produced {customOrderQueue.Peek().OrderItem}"));
                customOrderQueue.Dequeue();
                Thread.Sleep(threadSleep);
            }
        }
Esempio n. 2
0
 /// <summary>
 /// 产生产品
 /// </summary>
 /// <param name="obj"></param>
 protected void OnProductProduced(MultiSiteEpochInfo obj)
 {
     ProductProduced?.Invoke(obj);
 }