Esempio n. 1
0
        public void InflateWheelsToMax(string i_LicensePlate)
        {
            VehicleInGarage vehicleInGarageToUpdate = FindAndReturnVehicleInGarage(i_LicensePlate);

            Wheel[] VehicleWheelsToInflate = vehicleInGarageToUpdate.Vehicle.Wheels;

            for (int i = 0; i < VehicleWheelsToInflate.Length; i++)
            {
                VehicleWheelsToInflate[i].Inflate(VehicleWheelsToInflate[i].MaxAirPressure - VehicleWheelsToInflate[i].CurrentAirPressure);
            }
        }
Esempio n. 2
0
        // methods:
        public override bool Equals(object obj)
        {
            bool            isEqual = false;
            VehicleInGarage vehicleInGarageToCompare = obj as VehicleInGarage;

            if (vehicleInGarageToCompare != null)
            {
                isEqual = this.GetHashCode() == obj.GetHashCode();
            }

            return(isEqual);
        }
Esempio n. 3
0
        public void ChargeElectricVehicle(string i_LicensePlate, float i_MinutesToCharge)
        {
            VehicleInGarage vehicleInGarageToUpdate = FindAndReturnVehicleInGarage(i_LicensePlate);

            if (vehicleInGarageToUpdate.Vehicle.Engine is ElecrticEngine)
            {
                ((ElecrticEngine)vehicleInGarageToUpdate.Vehicle.Engine).ChargeBattery(i_MinutesToCharge / 60);
                vehicleInGarageToUpdate.Vehicle.UpdateEnergyPercentage();
            }
            else
            {
                throw new ArgumentException("This is not an Electric vehicle.");
            }
        }
Esempio n. 4
0
        public void RefuelGasVehicle(string i_LicensePlate, GasEngine.eFuelType i_FuelType, float i_AmountOfFuelToAdd)
        {
            VehicleInGarage vehicleInGarageToUpdate = FindAndReturnVehicleInGarage(i_LicensePlate);

            if (vehicleInGarageToUpdate.Vehicle.Engine is GasEngine)
            {
                ((GasEngine)vehicleInGarageToUpdate.Vehicle.Engine).Refueling(i_AmountOfFuelToAdd, i_FuelType);
                vehicleInGarageToUpdate.Vehicle.UpdateEnergyPercentage();
            }
            else
            {
                throw new ArgumentException("This is not a fuel based vehicle.");
            }
        }
Esempio n. 5
0
        public string GetVehicleInfo(string i_LicensePlate)
        {
            VehicleInGarage vehicleInGarageToShow = FindAndReturnVehicleInGarage(i_LicensePlate);

            return(vehicleInGarageToShow.ToString());
        }
Esempio n. 6
0
        public void ChangeVehicleStatus(string i_LicensePlate, VehicleInGarage.eStatus i_NewStatus)
        {
            VehicleInGarage vehicleInGarageToUpdate = FindAndReturnVehicleInGarage(i_LicensePlate);

            vehicleInGarageToUpdate.Status = i_NewStatus;
        }
Esempio n. 7
0
 // Methods:
 public void AddVehical(VehicleInGarage i_VehicalToAdd)
 {
     m_VehicelsList.Add(i_VehicalToAdd.GetHashCode(), i_VehicalToAdd);
 }