コード例 #1
0
        private void UserDoorsOfCar()
        {
            bool IsTypeOfDoors = false;

            try
            {
                Console.WriteLine(
                    @"Choose car number of doors from one of the options:
======================================================
1) two 
2) three
3) Four
4) Five ");
                string str = Console.ReadLine();
                m_UserCarDoors = UserEnumParseofValue <Car.eDoor>(str);
                if (m_UserCarDoors != null)
                {
                    IsTypeOfDoors    = true;
                    m_car.DoorsOfCar = m_UserCarDoors;
                }
                if (!IsTypeOfDoors)
                {
                    Console.WriteLine("Your choose of car doors number not exist in the system ");
                }
            }
            catch (ArgumentException ex)
            {
                IsTypeOfDoors = false;
            }
            if (!IsTypeOfDoors)
            {
                UserDoorsOfCar();
            }
        }
コード例 #2
0
        private void insertAmountOfDoors(Car i_NewCar)
        {
            int userChoice;

            Car.eDoor amountOfDoorsOptions   = new Car.eDoor();
            string    PartOfOptionsHeaderMsg = string.Format("amount of doors");

            userChoice             = UI.GetSpecificEnumInput(PartOfOptionsHeaderMsg, amountOfDoorsOptions);
            i_NewCar.AmountOfDoors = (Car.eDoor)userChoice;
        }