Esempio n. 1
0
        public void initFood(string foods)
        {
            FoodFactory factory = new FoodFactory();

            food        = factory.getFood(foods);
            label6.Text = foods;
            //if (foods.Equals("Pizza"))
            //{
            //    label1.Text = "      Crust";
            //    label6.Text = "Pizza";
            //    food = new Pizza();
            //}
            //else if (foods.Equals("Breadsticks"))
            //{
            //    label1.Text = "      Crust";
            //    label6.Text = "Calzone";
            //    food = new Breadstick();
            //}
            //else if (foods.Equals("Fries"))
            //{
            //    label1.Text = "Seasoning";
            //    label6.Text = "Fries";
            //    food = new Fries();
            //}
        }
Esempio n. 2
0
        private void inOven(string order, TurtleTime food, ListBox list)
        {
            Thread.Sleep(10000);
            OrderQueue.orderName.Remove(order);
            OrderQueue.orderQueue.Remove(food);


            list.Invoke(new MethodInvoker(delegate()
            {
                list.Items.Clear();

                for (int i = 0; i < OrderQueue.orderName.Count; i++)
                {
                    list.Items.Add("");
                    list.Items.Add((OrderQueue.orderName[i]) + " - " + (OrderQueue.orderQueue[i].name));
                }
                Notify n             = new Notify();
                n.Visible            = true;
                Notify.delivery.Text = (order + " your " + (food.name) + " has been cooked and is on its way!");
            }));
            if (OrderQueue.orderName.Count == 0)
            {
                Ordering.removeOrderScreen();
            }
        }
Esempio n. 3
0
 public static void populateOrders()
 {
     listBox.Items.Clear();
     for (int i = OrderQueue.orderName.Count - 1; i < OrderQueue.orderName.Count; i++)
     {
         TurtleTime t       = OrderQueue.orderQueue[i];
         string     oN      = OrderQueue.orderName[i];
         Oven       o       = new Oven(t, oN, listBox);
         Thread     oThread = new Thread(new ThreadStart(o.cook));
         oThread.Start();
         //Thread t = new Thread(new ThreadStart(o.cook(t,oN)));
         for (int j = 0; j < OrderQueue.orderName.Count; j++)
         {
             listBox.Items.Add("");
             listBox.Items.Add((OrderQueue.orderName[j]) + " - " + (OrderQueue.orderQueue[j].name));
         }
         //timeLabel.Text = ((OrderQueue.orderName.Count * 15).ToString() + "s");
     }
 }
Esempio n. 4
0
        public void cook()
        {
            ListBox    tempList = list;
            TurtleTime tempT    = food;
            string     tempOrd  = orderName;

            lock (Oven.o)
            {
                while (inUse == 1)
                {
                    Monitor.Wait(o);
                }
                inUse = 1;
                Console.WriteLine("COOKING: " + tempOrd);
                inOven(tempOrd, tempT, tempList);
                Console.WriteLine("DONE : " + tempOrd);
                inUse = 0;
            }
        }
Esempio n. 5
0
 public Oven(TurtleTime food, string orderName, ListBox list)
 {
     this.food      = food;
     this.orderName = orderName;
     this.list      = list;
 }