Ejemplo n.º 1
0
        public void Start()
        {
            welcomeNewUser();
            m_UserAction = (eUserOptions)getUserSelection(
                m_UserOptionsDict,
                k_SelectOperationMsg,
                (byte)eUserOptions.Min,
                (byte)eUserOptions.Max);
            while (m_UserAction != eUserOptions.Exit)
            {
                startSelectedOperation();
                m_UserAction = (eUserOptions)getUserSelection(
                    m_UserOptionsDict,
                    k_SelectOperationMsg,
                    (byte)eUserOptions.Min,
                    (byte)eUserOptions.Max);
            }

            Console.WriteLine(k_GoodByeMsg);
            Console.ReadLine();
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Determines whether the specified option is enabled.
 /// </summary>
 /// <param name="option">The option.</param>
 /// <returns>
 /// 	<c>true</c> if the specified option is enabled; otherwise, <c>false</c>.
 /// </returns>
 public bool IsOptionEnabled(eUserOptions option)
 {
     return (Options & (ulong)option) == (ulong)option;
 }
Ejemplo n.º 3
0
        public void ChooseUserActions(string i_LicensePlate)
        {
            eUserOptions userOption          = 0;
            string       currentLicensePlate = m_MainClientLicensePlate;
            bool         isValidAction       = false;
            string       userActionInput     = string.Empty;
            const bool   v_IsFueledEngine    = true;

            OutputToConsole(
                @"Choose the action you would like to make (by entering it's number):
1. Insert a new vehicle
2. Display license plates in garage (filtered)
3. Change vehicle status (by license plate)
4. Set tires pressure (by license plate)
5. ReFuel vehicle (by license plate)
6. ReCharge vehicle (by license plate)
7. Display vehicle info (by license plate)");

            while (!isValidAction)
            {
                try
                {
                    userActionInput = InputFromConsole();
                    userOption      = UserInputExceptions.ParseUserOptions(userActionInput);
                    isValidAction   = true;
                }
                catch (FormatException e)
                {
                    Console.WriteLine(e.Message);
                    continue;
                }
            }

            OutputClearConsole();
            switch (userOption)
            {
            case UI.eUserOptions.InsertNewVehicle:
                GarageManager.eSupportedVehciles o_VehicleType;
                OutputToConsole(string.Format("Please enter a new license plate for your new vehicle{0}", Environment.NewLine));
                m_CurrentVehicleLicensePlate = InputFromConsole();
                Vehicle newVehicle = EnterNewVehicle(m_MainClientLicensePlate, out o_VehicleType);
                this.m_CurrentClient.AddVehicleToClient(newVehicle, GarageClient.eVehicleStatus.InRepair, o_VehicleType, m_CurrentVehicleLicensePlate);
                break;

            case UI.eUserOptions.DisplayFilteredLicenses:
                DisplayFilteredGarageVehicles();
                break;

            case UI.eUserOptions.ChangeVehicleStatus:
                OutputClearConsole();
                updateVehicleStatus(currentLicensePlate);
                break;

            case UI.eUserOptions.InflateTires:
                this.m_GarageManager.SetTirePressureToMax(m_MainClientLicensePlate, m_CurrentVehicleLicensePlate);
                OutputToConsole("We have inflated your tires");
                break;

            case UI.eUserOptions.RefuelVehicle:
                RePowerVehcile(v_IsFueledEngine);
                break;

            case UI.eUserOptions.ReChargeVehicle:
                RePowerVehcile(!v_IsFueledEngine);
                break;

            case UI.eUserOptions.DisplayCarInfo:
                string outoutDetails = this.m_GarageManager.GetFullClientInfo(currentLicensePlate);
                OutputToConsole(outoutDetails);
                break;
            }
        }