Exemple #1
0
        public void addNewVehicle()
        {
            DataInputScreen      dataInputScreen      = r_Screens[eUIScreens.DataInput] as DataInputScreen;
            NumericalInputScreen numericalInputScreen = r_Screens[eUIScreens.NumericalInput] as NumericalInputScreen;

            ScreenUtils.Clear();

            dataInputScreen.SetMassageToDisplay("Enter Vehicle License Number");
            dataInputScreen.Display(out string licenseNumber);
            r_GarageManager.AddVehicle(licenseNumber);

            VehicleInfo vehicleInfo = r_GarageManager.GetVehicleInfo(licenseNumber);

            try
            {
                string userData;

                dataInputScreen.SetMassageToDisplay("Enter Vehicle Owner Name");
                dataInputScreen.Display(out userData);
                vehicleInfo.VehicleOwnerName = userData;

                numericalInputScreen.SetMassageToDisplay("Enter Vehicle Owner Phone Number");
                numericalInputScreen.Display(out userData);
                vehicleInfo.VehicleOwnerPhoneNumber = userData;

                vehicleInfo.Vehicle = getNewVehicleFromUser(licenseNumber);
            }
            catch (Exception i_Exception)
            {
                ScreenUtils.Display(i_Exception.ToString());
                ScreenUtils.Freeze();
            }
        }
Exemple #2
0
        private Wheel getWheelFromUser()
        {
            NumericalInputScreen numericalInputScreen = r_Screens[eUIScreens.NumericalInput] as NumericalInputScreen;
            DataInputScreen      dataInputScreen      = r_Screens[eUIScreens.DataInput] as DataInputScreen;

            dataInputScreen.SetMassageToDisplay("Enter Wheel Manufacturer Name");
            dataInputScreen.Display(out string manufacturerName);
            numericalInputScreen.SetMassageToDisplay("Enter Wheel Maximum Air Pressure");
            numericalInputScreen.Display(out string maximumAirPressureStr);
            float maximumAirPressure = float.Parse(maximumAirPressureStr);

            return(new Wheel(manufacturerName, maximumAirPressure));
        }
Exemple #3
0
        // $G$ DSN-002 (-5) The UI should not know Car\Truck\Motorcycle
        private void getTruckDataFromUser(ref Truck io_Truck)
        {
            NumericalInputScreen numericalInputScreen = r_Screens[eUIScreens.NumericalInput] as NumericalInputScreen;
            BoolInputScreen      boolInputScreen      = r_Screens[eUIScreens.BoolInput] as BoolInputScreen;

            boolInputScreen.SetMassageToDisplay("Is Truck Contain Hazardous Materials");
            boolInputScreen.Display(out bool containsHazardousMaterials);
            io_Truck.ContainsHazardousMaterials = containsHazardousMaterials;

            numericalInputScreen.SetMassageToDisplay("Enter Cargo Volume");
            numericalInputScreen.Display(out string cargoVolumeStr);
            float cargoVolume = float.Parse(cargoVolumeStr);

            io_Truck.CargoVolume = cargoVolume;
        }
Exemple #4
0
        // $G$ CSS-027 (-1) Unnecessary blank lines.

        private static Dictionary <eUIScreens, Screen> getScreens()
        {
            Dictionary <eUIScreens, Screen> screens = new Dictionary <eUIScreens, Screen>();
            Screen     displayMassage        = new Screen();
            MenuScreen mainMenuScreen        = new MenuScreen(typeof(eMainMenuOptions), "Garage Options: ");
            MenuScreen displayLicensesScreen = new MenuScreen(
                typeof(eDisplayLicensesOptions),
                "Display License Numbers In The Garage:");
            MenuScreen vehicleStatusScreen = new MenuScreen(
                typeof(eVehicleStatus),
                "Select Status To Filet By:");
            MenuScreen fuelScreen        = new MenuScreen(typeof(eFuel), "Select Vehicle Fuel:");
            MenuScreen vehicleTypeScreen = new MenuScreen(
                typeof(VehicleProducer.eProducibleVehicles),
                "Select Vehicle:");
            MenuScreen energySourceScreen = new MenuScreen(typeof(eEnergySource), "Select Vehicle Energy Source:");
            MenuScreen setWheelsScreen    = new MenuScreen(typeof(eSetWheelMode), "Select How To Set Wheels:");
            MenuScreen amountOfDoors      = new MenuScreen(typeof(eAmountOfDoors), "Select How Many Doors:");
            MenuScreen vehicleColor       = new MenuScreen(typeof(eVehicleColor), "Select Vehicle Color:");
            MenuScreen vehicleLicenseType = new MenuScreen(typeof(eLicenseType), "Select Vehicle License Type:");
            MenuScreen electricityVehicleActionsScreen = new MenuScreen(typeof(eElectricityVehicleActionsOptions), "Select Vehicle Action:");
            MenuScreen fuelVehicleActionsScreen        = new MenuScreen(typeof(eFuelVehicleActionsOptions), "Select Vehicle Action:");

            DataInputScreen      dataInputScreen      = new DataInputScreen();
            NumericalInputScreen numericalInputScreen = new NumericalInputScreen();
            BoolInputScreen      boolInputScreen      = new BoolInputScreen();

            screens.Add(eUIScreens.MainMenu, mainMenuScreen);
            screens.Add(eUIScreens.DisplayLicenseNumbers, displayLicensesScreen);
            screens.Add(eUIScreens.DataInput, dataInputScreen);
            screens.Add(eUIScreens.VehicleStatuses, vehicleStatusScreen);
            screens.Add(eUIScreens.FuelType, fuelScreen);
            screens.Add(eUIScreens.VehicleType, vehicleTypeScreen);
            screens.Add(eUIScreens.EnergySource, energySourceScreen);
            screens.Add(eUIScreens.SetWheels, setWheelsScreen);
            screens.Add(eUIScreens.NumericalInput, numericalInputScreen);
            screens.Add(eUIScreens.AmountOfDoors, amountOfDoors);
            screens.Add(eUIScreens.VehicleColor, vehicleColor);
            screens.Add(eUIScreens.BoolInput, boolInputScreen);
            screens.Add(eUIScreens.LicenseType, vehicleLicenseType);
            screens.Add(eUIScreens.ElectricityVehicleActions, electricityVehicleActionsScreen);
            screens.Add(eUIScreens.FuelVehicleActions, fuelVehicleActionsScreen);
            screens.Add(eUIScreens.DisplayMassage, displayMassage);


            return(screens);
        }
Exemple #5
0
        // $G$ DSN-002 (-5) The UI should not know Car\Truck\Motorcycle
        private void getMotorcycleDataFromUser(ref Motorcycle io_Motorcycle)
        {
            string               userInput;
            MenuScreen           licenseTypeScreen    = r_Screens[eUIScreens.LicenseType] as MenuScreen;
            NumericalInputScreen numericalInputScreen = r_Screens[eUIScreens.NumericalInput] as NumericalInputScreen;

            licenseTypeScreen.Display(out userInput);
            eLicenseType licenseType = (eLicenseType)parseMenuOption(userInput);

            io_Motorcycle.LicenseType = licenseType;

            numericalInputScreen.SetMassageToDisplay("Enter Engine Capacity");
            numericalInputScreen.Display(out userInput);
            int engineCapacity = parseMenuOption(userInput);

            io_Motorcycle.EngineCapacity = engineCapacity;
        }
Exemple #6
0
        private void addEnergy(string i_LicenseNumber, eEnergySource i_EnergySource)
        {
            NumericalInputScreen numericalInputScreen = r_Screens[eUIScreens.NumericalInput] as NumericalInputScreen;
            eFuel?fuel = null;

            if (i_EnergySource == eEnergySource.Electricity)
            {
                numericalInputScreen.SetMassageToDisplay("Enter Time To Add");
            }
            else
            {
                MenuScreen fuelScreen = r_Screens[eUIScreens.FuelType] as MenuScreen;
                fuelScreen.Display(out string fuelTypeStr);
                fuel = (eFuel)parseMenuOption(fuelTypeStr);
                numericalInputScreen.SetMassageToDisplay("Enter Amount of Fuel To Add");
            }

            numericalInputScreen.Display(out string energyToAddStr);
            float energyToAdd = float.Parse(energyToAddStr);

            try
            {
                if (i_EnergySource == eEnergySource.Electricity)
                {
                    r_GarageManager.ChargeVehicle(i_LicenseNumber, energyToAdd);
                }
                else
                {
                    r_GarageManager.FuelVehicle(i_LicenseNumber, fuel.Value, energyToAdd);
                }
            }
            catch (Exception exception)
            {
                ScreenUtils.Display(exception.ToString());
                ScreenUtils.Freeze();
            }
        }