Exemple #1
0
        private void printMotorcycleDialog()
        {
            string            userInput      = string.Empty;
            int               engineCapacity = 0;
            eRegistrationType regType        = eRegistrationType.None;

            Console.Write(@"What is your motorcycle registration type? (A,A1,A2,B)
>> ");
            userInput = Console.ReadLine();

            if (m_Garage.CheckRegistrationType(userInput, out regType) == true)
            {
                m_Garage.AddVehicleInfo("m_RegistrationType", regType);
            }
            else
            {
                throw new ArgumentException("Registration type");
            }

            Console.Clear();

            Console.Write(@"what is your motorcycle engine capacity?
>> ");
            userInput = Console.ReadLine();

            if (m_Garage.CheckEngineCapacity(userInput, ref engineCapacity) == true)
            {
                m_Garage.AddVehicleInfo("m_EngineCapacity", engineCapacity);
            }
            else
            {
                Console.WriteLine("Error: Invaild input. Please try again.{0}", Environment.NewLine);
            }

            Console.Clear();
        }