예제 #1
0
파일: UI.cs 프로젝트: OzHog/Garage-Manager
        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
파일: UI.cs 프로젝트: OzHog/Garage-Manager
        private void displayLicenseNumbersInTheGarage()
        {
            string         userInput;
            eVehicleStatus?filerStatus = null;

            (r_Screens[eUIScreens.DisplayLicenseNumbers] as MenuScreen).Display(out userInput);
            eDisplayLicensesOptions userOption = (eDisplayLicensesOptions)parseMenuOption(userInput);

            if (userOption == eDisplayLicensesOptions.FilterVehiclesByStatus)
            {
                (r_Screens[eUIScreens.VehicleStatuses] as MenuScreen).Display(out userInput);
                filerStatus = (eVehicleStatus)parseMenuOption(userInput);
            }

            List <string> LicenseNumbers = r_GarageManager.GetLicenseNumbers(filerStatus);

            if (LicenseNumbers.Count > 0)
            {
                foreach (string licenseNumber in LicenseNumbers)
                {
                    ScreenUtils.Display(licenseNumber);
                }
            }
            else
            {
                ScreenUtils.Display("There Are No Vehicles In The Garage For This Request");
            }

            ScreenUtils.Freeze();
        }
예제 #3
0
파일: UI.cs 프로젝트: OzHog/Garage-Manager
        private void inflate(string i_LicenseNumber)
        {
            Screen screen = r_Screens[eUIScreens.DisplayMassage];

            r_GarageManager.InflateWheelsToMaximum(i_LicenseNumber);

            screen.SetMassageToDisplay("Inflate Succeeded");
            screen.Display();
            ScreenUtils.Freeze();
        }
예제 #4
0
파일: UI.cs 프로젝트: OzHog/Garage-Manager
        private void displayVehicleActions()
        {
            string          licenseNumber;
            DataInputScreen screen = r_Screens[eUIScreens.DataInput] as DataInputScreen;

            ScreenUtils.Clear();

            screen.SetMassageToDisplay("Enter Vehicle License Number");
            screen.Display(out licenseNumber);

            try
            {
                VehicleInfo vehicleInfo = r_GarageManager.GetVehicleInfo(licenseNumber);
                if (vehicleInfo != null)
                {
                    MenuScreen menu;
                    if (vehicleInfo.Vehicle.EnergySource is Battery)
                    {
                        menu = r_Screens[eUIScreens.ElectricityVehicleActions] as MenuScreen;
                    }
                    else
                    {
                        menu = r_Screens[eUIScreens.FuelVehicleActions] as MenuScreen;
                    }

                    bool back = false;
                    while (!back)
                    {
                        menu.Display(out string userInput);
                        vehicleActionHandler(vehicleInfo, userInput, out back);
                    }
                }
            }
            catch (Exception i_Exception)
            {
                ScreenUtils.Display(i_Exception.ToString());
                ScreenUtils.Freeze();
            }
        }
예제 #5
0
파일: UI.cs 프로젝트: OzHog/Garage-Manager
        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();
            }
        }
예제 #6
0
파일: UI.cs 프로젝트: OzHog/Garage-Manager
 private void displayVehicle(VehicleInfo i_VehicleInfo)
 {
     ScreenUtils.Display(i_VehicleInfo.ToString());
     ScreenUtils.Freeze();
 }