Пример #1
0
        private void printCarDialog()
        {
            string        userInput      = string.Empty;
            eVehicleColor carColor       = eVehicleColor.None;
            int           carDoorsAmount = 0;
            const int     minDoorsAmount = 2;
            const int     maxDoorsAmount = 5;

            Console.Write(@"How many doors your car has? (2/3/4/5)
>> ");
            userInput = Console.ReadLine();

            if (m_Garage.CheckCarDoorsAmount(userInput, out carDoorsAmount) == false)
            {
                throw new ValueOutOfRangeException("Doors amount", minDoorsAmount, maxDoorsAmount);
            }

            m_Garage.AddVehicleInfo("m_DoorsCount", carDoorsAmount);
            Console.Clear();

            Console.Write(@"What is Your car color? (Red/Blue/Black/Grey)
>> ");
            userInput = Console.ReadLine();

            if (m_Garage.CheckCarColor(userInput, out carColor) == true)
            {
                m_Garage.AddVehicleInfo("m_Color", carColor);
            }
            else
            {
                throw new ArgumentException("Car color");
            }

            Console.Clear();
        }