Ejemplo n.º 1
0
        private void chargeVehicle()
        {
            bool v_ChargedVehicle;
            ChargingVehicleDetails chargingForm;

            m_Ui.PrintSignToUser("charging vehicle");

            do
            {
                v_ChargedVehicle = true;

                try
                {
                    chargingForm = m_Ui.FillChargingVehicleForm(Garage);
                    r_Garage.ChargeEnergySource(chargingForm);
                }
                catch (ValueOutOfRangeException rangeException)
                {
                    m_Ui.PrintNatural(rangeException.Message);
                    m_Ui.PrintNatural(
                        "Overflows/Underflow the Contents of your Energy tank so tank was filled till max(in case of Overflows)/min (in case ofUnderflow) content reached");
                }
                catch (ArgumentException ae)
                {
                    m_Ui.PrintNatural(ae.Message);
                    m_Ui.PrintNatural("Fill Charging Form Again");
                    v_ChargedVehicle = false;
                }
            }while (v_ChargedVehicle == false);

            m_Ui.PrintNatural("Vehicle Charged!!");
        }