コード例 #1
0
        public static void Run()
        {
            Garage myGarage = new Garage();

            Console.WriteLine(string.Format("Welcome To The Garage!"));
            Garage.eGarageOptions?clientChoosement = null;
            string     licensePlate  = null;
            const bool k_GarageExist = true;

            do
            {
                Console.WriteLine();
                printActionOptionsToClient();
                clientChoosement = getClientChoosement();
                if (clientChoosement != Garage.eGarageOptions.ShowLicensePlates)
                {
                    licensePlate = GetLicensePlate();
                    if (clientChoosement != Garage.eGarageOptions.EnterVehicle)
                    {
                        if (myGarage.IsVehicleInGarage(licensePlate) == false)
                        {
                            Console.WriteLine("This Vehicle Is Not In The Garage.");
                            continue;
                        }
                    }
                }

                switch (clientChoosement)
                {
                case Garage.eGarageOptions.EnterVehicle:
                {
                    tryEnterVehicleToTheGarage(myGarage, licensePlate);
                    break;
                }

                case Garage.eGarageOptions.ShowLicensePlates:
                {
                    showLicensePlates(myGarage);
                    break;
                }

                case Garage.eGarageOptions.ChangeVehicleStatus:
                {
                    Garage.eVehicleStatus vehicleStatus = getVehicleStatus();
                    myGarage.ChangeVehicleStatus(licensePlate, vehicleStatus);
                    break;
                }

                case Garage.eGarageOptions.InflateTires:
                {
                    myGarage.InflateTires(licensePlate);
                    break;
                }

                case Garage.eGarageOptions.FuelTank:
                {
                    tryFuelTank(myGarage, licensePlate);
                    break;
                }

                case Garage.eGarageOptions.ChargeElectricVehicle:
                {
                    tryChargeElectricVehicle(myGarage, licensePlate);
                    break;
                }

                case Garage.eGarageOptions.ShowVehicleDetails:
                {
                    Console.WriteLine(myGarage.GetVehicleDetailsString(licensePlate));
                    break;
                }

                default:
                {
                    break;
                }
                }
            }while (k_GarageExist);
        }