Exemplo n.º 1
0
 public static InsertQuantityOfEquipmentForRemovingWindow getInstance(int currentQuantity)
 {
     if (instance == null)
     {
         instance = new InsertQuantityOfEquipmentForRemovingWindow(currentQuantity);
     }
     return(instance);
 }
 private void TryReduceDynamicEquipment()
 {
     InsertQuantityOfEquipmentForRemovingWindow.getInstance(int.Parse(selectedEquipmentQuantity)).ShowDialog();
     if (InsertQuantityOfEquipmentForRemovingWindow.itSubmitted)
     {
         ReduceQuantity();
     }
 }
        private void ReduceQuantity()
        {
            int currentQuantity = int.Parse(selectedEquipmentQuantity);
            int removedQuantity = InsertQuantityOfEquipmentForRemovingWindow.getQuantity();

            if ((currentQuantity - removedQuantity) == 0)
            {
                this.roomEquipment.Remove(selectedEquipmentName);
                this.newEquipment.Remove(selectedEquipmentName);
            }
            else
            {
                roomEquipment[EquipmentController.getInstance().getEquipmentIdByName(selectedEquipmentName)] = currentQuantity - removedQuantity;
            }
            if (reducedEquipment.Contains(selectedEquipmentName))
            {
                reducedEquipment.Remove(selectedEquipmentName);
            }
            if (selectedRoom.EquipmentInRoom.Equipment.Contains(selectedEquipmentName))
            {
                reducedEquipment.Add(selectedEquipmentName, removedQuantity);
            }
        }
Exemplo n.º 4
0
 private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     instance = null;
 }