Ejemplo n.º 1
0
        internal static int PromptUser()
        {
            string strUsersChoice = "";
            int    intUsersChoice = 0;
            bool   validChoice    = false;

            FlashcardCLIViewer.DisplayMenu();

            do
            {
                strUsersChoice = Console.ReadLine();
                if ((int.TryParse(strUsersChoice, out intUsersChoice)) && (intUsersChoice <= 4))
                {
                    validChoice = true;
                }
                if (!validChoice)
                {
                    Console.BackgroundColor = ConsoleColor.Blue;
                    Console.ForegroundColor = ConsoleColor.White;
                    Console.WriteLine($"Selection not available! {strUsersChoice}");
                    Console.ResetColor();
                    Console.Write("Selection? ");
                }
            } while (!validChoice);

            return(intUsersChoice);
        }