Ejemplo n.º 1
0
        private void getValidEngineVolume(out int o_EngineVolume)
        {
            bool   parseSucceeded = false;
            string input;

            o_EngineVolume = 0;
            Console.Clear();
            do
            {
                Console.WriteLine("Please enter your engine volume");
                input = Console.ReadLine();
                try
                {
                    o_EngineVolume = CustomConverter.ConvertStringToPositiveInt(input);
                    parseSucceeded = true;
                }
                catch (FormatException e)
                {
                    Console.WriteLine(e.Message);
                    parseSucceeded = false;
                }
                catch (ValueOutOfRangeException e)
                {
                    Console.WriteLine(e.Message);
                    parseSucceeded = false;
                }
            }while (!parseSucceeded);
        }
Ejemplo n.º 2
0
        private void getValidPhoneNumberFromUser(out string o_PhoneNumber)
        {
            bool   parseSucceeded = false;
            string input          = string.Empty;

            Console.Clear();
            do
            {
                try
                {
                    Console.WriteLine("Please insert the owner's phone number: ");
                    input = Console.ReadLine();
                    CustomConverter.ConvertStringToPositiveInt(input);
                    parseSucceeded = true;
                }
                catch (FormatException e)
                {
                    Console.WriteLine(e.Message);
                    parseSucceeded = false;
                }
                catch (ValueOutOfRangeException e)
                {
                    Console.WriteLine(e.Message);
                    parseSucceeded = false;
                }
            }while (!parseSucceeded);

            o_PhoneNumber = input;
        }