internal void ShowVehiclesWithFilter()
        {
            VehicleGarageInfo.eVehicleCondition vehicleCondition;

            while (true)
            {
                try
                {
                    vehicleCondition = (VehicleGarageInfo.eVehicleCondition)InputValidation.EnumChoiseToInt(typeof(VehicleGarageInfo.eVehicleCondition), UserConsole.ChooseString("vehicle condition"));
                    UserConsole.Print(string.Format("All vehicles in the garage that are {0}:", vehicleCondition.ToString()));
                    UserConsole.Print(r_Garage.VehicleInGarageToString(vehicleCondition));
                    break;
                }
                catch (Exception ex)
                {
                    UserConsole.ExceptionOutput(ex);
                }
                finally
                {
                    UserConsole.PrintAndRead("Press any key to go back to vehicle menu");
                    endAction();
                }
            }

            endAction();
        }
        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);
        }
 private void setMotorcycleInfo(Motorcycle i_Motorcycle)
 {
     while (true)
     {
         try
         {
             i_Motorcycle.LicenseType  = (Motorcycle.eLicenseType)InputValidation.EnumChoiseToInt(typeof(Motorcycle.eLicenseType), UserConsole.ChooseString("license type"));
             i_Motorcycle.EngineVolume = InputValidation.GetPositiveInt("\nEnter Engine volume: ");
             break;
         }
         catch (Exception ex)
         {
             UserConsole.ExceptionOutput(ex);
         }
     }
 }
        internal void AddVehicleToGarage()
        {
            Vehicle vehicle;

            VehicleCreater.eVehicleTypes vehicleType;
            while (true)
            {
                try
                {
                    vehicleType = (VehicleCreater.eVehicleTypes)InputValidation.EnumChoiseToInt(typeof(VehicleCreater.eVehicleTypes),
                                                                                                UserConsole.ChooseString("vehicle type"));
                    vehicle = VehicleCreater.InitVehicle(vehicleType);
                    vehicle.LicenseNumber = InputValidation.GetString("\nEnter License number: ");
                    vehicle.ModelName     = InputValidation.GetString("\nEnter model Name: ");
                    r_Garage.AddVehicleToGarage(vehicle);
                    break;
                }
                catch (Exception ex)
                {
                    UserConsole.ExceptionOutput(ex);
                }
            }

            vehicle.VehicleInfo = setVehicleInfo();
            setEnergy(vehicle);
            UserConsole.SleepAndClear();
            setWheelInfo(vehicle);
            UserConsole.Print("\n");
            setExtraDeatails(vehicle);
            UserConsole.Print("\nVehicle was added successfully!");
            endAction();
        }
 private void setCarInfo(Car i_Car)
 {
     while (true)
     {
         try
         {
             i_Car.Color         = (Car.eColor)InputValidation.EnumChoiseToInt(typeof(Car.eColor), UserConsole.ChooseString("car color"));
             i_Car.NumberOfDoors = (Car.eNumberOfDoors)InputValidation.EnumChoiseToInt(typeof(Car.eNumberOfDoors), UserConsole.ChooseString("number of doors for car"));
             break;
         }
         catch (Exception ex)
         {
             UserConsole.ExceptionOutput(ex);
         }
     }
 }
Exemple #6
0
        internal void FillFuelVehicle()
        {
            while (true)
            {
                try
                {
                    FuelEngine.eFuelType fuelTypeInput = (FuelEngine.eFuelType)InputValidation.EnumChoiseToInt(typeof(FuelEngine.eFuelType), UserConsole.ChooseString("fuel type"));
                    float amountOfFuel = InputValidation.GetFloat("Enter the amount of fuel to fill");
                    r_Garage.FillFuelVehicle(r_Vehicle.LicenseNumber, fuelTypeInput, amountOfFuel);
                    break;
                }
                catch (Exception ex)
                {
                    UserConsole.ExceptionOutput(ex);
                    if (ex.Message.Contains("not on fuel!"))
                    {
                        break;
                    }
                }
            }

            endAction();
        }
Exemple #7
0
        internal void ChangeVehicleStatus()
        {
            while (true)
            {
                try
                {
                    VehicleGarageInfo.eVehicleCondition vehicleStatus = (VehicleGarageInfo.eVehicleCondition)InputValidation.EnumChoiseToInt(typeof(VehicleGarageInfo.eVehicleCondition), UserConsole.ChooseString("vehicle condition"));
                    r_Garage.ChangeVehicleCondition(r_Vehicle.LicenseNumber, vehicleStatus);
                    break;
                }
                catch (Exception ex)
                {
                    UserConsole.ExceptionOutput(ex);
                }
            }

            endAction();
        }