Пример #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();
            }
        }
Пример #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));
        }
Пример #3
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();
            }
        }
Пример #4
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;
        }
Пример #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;
        }