Пример #1
0
        public void chargeElectricVehicle()
        {
            m_UserDisplay.ClearAndDisplayMessage("You have chosen to recharge an Electric type vehicle");
            string licenseNumber        = m_ChargeElectricVehicle.GetLicenseNumberForCharging();
            float  amountOfTimeToCharge = m_ChargeElectricVehicle.GetAmountOfMinutesToCharge();

            try
            {
                m_Garage.RechargeElectricVehicle(licenseNumber, amountOfTimeToCharge);
                m_UserDisplay.ClearAndDisplayMessage(string.Format("Vehicle with license number: {0}, with amount: {1} successfuly!", licenseNumber, amountOfTimeToCharge));
                m_UserDisplay.PressAnyKeyToContinue();
            }
            catch (Exception exception)
            {
                m_UserDisplay.ClearAndDisplayMessage(exception.Message);

                if (exception is ValueOutOfRangeException)
                {
                    m_UserDisplay.DisplayMessage(Messages.k_PleaseTryAgainMessage);
                    chargeElectricVehicle();
                }
                else
                {
                    m_UserDisplay.PressAnyKeyToContinue();
                }
            }
        }