Exemplo n.º 1
0
        public void Display(out bool o_UserInput)
        {
            o_UserInput = false;
            bool   legalInput = false;
            string userInput  = null;

            ScreenUtils.Clear();
            base.Display();
            ScreenUtils.Display(@"1. Yes
2. No");
            while (!legalInput)
            {
                userInput = ScreenUtils.GetUserInput();
                try
                {
                    legalInput = isUserInputLegal(userInput);
                }
                catch (Exception exception)
                {
                    ScreenUtils.Display(exception.ToString());
                }
            }

            o_UserInput = userInput.Equals("1");
        }
Exemplo n.º 2
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();
            }
        }
Exemplo n.º 3
0
        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();
        }
Exemplo n.º 4
0
        public override void Display(out string o_UserInput)
        {
            o_UserInput = null;
            string userInput  = null;
            bool   legalInput = false;

            ScreenUtils.Clear();
            ScreenUtils.Display(base.m_MassageToDisplay.ToString());
            ScreenUtils.Display(m_StrOptions);

            while (!legalInput)
            {
                userInput = ScreenUtils.GetUserInput();
                try
                {
                    legalInput = isUserInputLegal(userInput);
                }
                catch (Exception exception)
                {
                    ScreenUtils.Display(exception.ToString());
                }
            }

            o_UserInput = userInput;
        }
Exemplo n.º 5
0
        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();
            }
        }
Exemplo n.º 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();
            }
        }
Exemplo n.º 7
0
        public virtual void Display(out string o_UserInput)
        {
            o_UserInput = null;
            bool   inputLegal = false;
            string userInput  = null;

            ScreenUtils.Clear();
            base.Display();

            while (!inputLegal)
            {
                userInput = ScreenUtils.GetUserInput();
                try
                {
                    inputLegal = isUserInputLegal(userInput);
                }
                catch (Exception exception)
                {
                    ScreenUtils.Display(exception.ToString());
                }
            }

            o_UserInput = userInput;
        }
Exemplo n.º 8
0
 public virtual void Display()
 {
     ScreenUtils.Display(m_MassageToDisplay.ToString());
 }
Exemplo n.º 9
0
 private void displayVehicle(VehicleInfo i_VehicleInfo)
 {
     ScreenUtils.Display(i_VehicleInfo.ToString());
     ScreenUtils.Freeze();
 }
Exemplo n.º 10
0
 public void startEngine()
 {
     ScreenUtils.Clear();
     ScreenUtils.Display("=============Garage Manager=============");
     manageGarage();
 }