示例#1
0
        public void FuelVehicle(string i_LisenceNumber, eFuelTypes i_FuelType, float i_AmountToFill)
        {
            Vehicle    requestedVehicle = null;
            FuelEngine vehicleEngine    = null;

            checkIfVehicleExist(i_LisenceNumber);
            requestedVehicle = m_GarageVehicles[i_LisenceNumber].VehicleEntity;
            checkIfFillable(requestedVehicle, eEngineTypes.FuelVehicle);
            vehicleEngine = requestedVehicle.VehicleEngine as FuelEngine;
            vehicleEngine.FillFuel(i_FuelType, i_AmountToFill);
        }
        private float setFuel(Vehicle i_Vehicle)
        {
            FuelEngine.eFuelType fuelType;
            float fuelAmount = 0;

            while (true)
            {
                try
                {
                    FuelEngine fuelEngine = i_Vehicle.Engine as FuelEngine;
                    UserConsole.Print("\nLets fill up Fuel!");
                    fuelType   = (FuelEngine.eFuelType)InputValidation.EnumChoiseToInt(typeof(FuelEngine.eFuelType), UserConsole.ChooseString("fuel type"));
                    fuelAmount = InputValidation.GetFloat("\nEnter amount of fuel you want to fill: ");
                    fuelEngine.FillFuel(fuelType, fuelAmount);
                    break;
                }
                catch (Exception ex)
                {
                    UserConsole.ExceptionOutput(ex);
                }
            }

            return(fuelAmount);
        }