Exemplo n.º 1
0
 /// <summary>
 /// creates the number of trucks
 /// </summary>
 public void createTrucks()
 {
     try
     {
         for (int i = 0; i < max; i++)
         {
             Truck[i]                     = new Trucks();
             Truck[i].gsTruckID           = 100 + i;
             Truck[i].gsTruckLoadCapacity = 200;
         }
     }
     catch { }
 }
Exemplo n.º 2
0
 /// <summary>
 /// The method for the click on the loading box
 /// trucks list moves the truck to the loading queue and listbox
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void listBoxLoading_Click(object sender, EventArgs e)
 {
     try
     {
         Trucks lastTruck = AQueue[1].Peek();
         AQueue[1].Dequeue();
         listBoxLoading.Items.Remove(lastTruck.gsTruckID + "\t" + lastTruck.gsTruckStatus);
         AQueue[2].Enqueue(lastTruck);
         lastTruck.truckSwitch();
         listBoxTCrusher.Items.Add(lastTruck.gsTruckID + "\t" + lastTruck.gsTruckStatus);
         displayTrucks();
     }
     catch { }
 }
Exemplo n.º 3
0
 /// <summary>
 /// This will return a truck to the main box only when the button is clicked
 /// while the truck is in the transit to loading queue at the top.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnReturn_Click(object sender, EventArgs e)
 {
     try
     {
         int    index     = listBoxTrucks.SelectedIndex;
         Trucks lastTruck = AQueue[0].Peek();
         if (lastTruck.gsTruckID == Truck[index].gsTruckID)
         {
             listBoxTLoading.Items.Remove(Truck[index].gsTruckID + "\t" + Truck[index].gsTruckStatus);
             Truck[index].gsTruckStatus = 0;
             AQueue[0].Dequeue();
         }
         displayTrucks();
     }
     catch { }
 }
Exemplo n.º 4
0
        /// <summary>
        /// The method for the click on the crusher box
        /// trucks list moves the truck to the transit to loading queue and listbox
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void listBoxCrusher_Click(object sender, EventArgs e)
        {
            try
            {
                Trucks lastTruck = AQueue[3].Peek();
                AQueue[3].Dequeue();
                listBoxCrusher.Items.Remove(lastTruck.gsTruckID + "\t" + lastTruck.gsTruckStatus);
                AQueue[0].Enqueue(lastTruck);
                lastTruck.truckSwitch();
                listBoxTLoading.Items.Add(lastTruck.gsTruckID + "\t" + lastTruck.gsTruckStatus);
                lastTruck.gsTruckTotal = lastTruck.gsTruckTotal + lastTruck.gsTruckLoadCapacity;

                displayTrucks();
            }
            catch { }
        }