예제 #1
0
        public static void DisplayReset()
        {
            Console.SetWindowSize(WINDOW_WIDTH, WINDOW_HEIGHT);

            Console.Clear();
            Console.ResetColor();

            Console.ForegroundColor = ConsoleColor.DarkYellow;
            Console.BackgroundColor = ConsoleColor.White;

            Console.WriteLine(ConsoleUtilCenter.FillStringWithSpaces(WINDOW_WIDTH));
            Console.WriteLine(ConsoleUtilCenter.Center("Library Application", WINDOW_WIDTH));
            Console.WriteLine(ConsoleUtilCenter.FillStringWithSpaces(WINDOW_WIDTH));

            Console.ResetColor();
            Console.WriteLine();
        }
예제 #2
0
        public static void DisplayWelcomeScreen()
        {
            Console.Clear();
            Console.ResetColor();

            Console.ForegroundColor = ConsoleColor.DarkYellow;
            Console.BackgroundColor = ConsoleColor.White;

            Console.WriteLine(ConsoleUtilCenter.FillStringWithSpaces(WINDOW_WIDTH));
            Console.WriteLine(ConsoleUtilCenter.Center("Welcome to", WINDOW_WIDTH));
            Console.WriteLine(ConsoleUtilCenter.Center("The Library Application", WINDOW_WIDTH));
            Console.WriteLine(ConsoleUtilCenter.FillStringWithSpaces(WINDOW_WIDTH));

            Console.ResetColor();
            Console.WriteLine();

            DisplayContinuePrompt();
        }
예제 #3
0
        public static AppEnum.LibraryManager GetUserActionChoice()
        {
            AppEnum.LibraryManager userActionChoice = AppEnum.LibraryManager.None;

            string leftTab = ConsoleUtilCenter.FillStringWithSpaces(DISPLAY_HORIZONTAL_MARGIN);

            DisplayReset();

            DisplayMessage("");
            Console.WriteLine(ConsoleUtilCenter.Center("Library Application Manager Menu", WINDOW_WIDTH));
            DisplayMessage("");

            Console.WriteLine(
                leftTab + "1. List All the Books" + Environment.NewLine +
                leftTab + "2. Display the Books Detail" + Environment.NewLine +
                leftTab + "3. Add a Book" + Environment.NewLine +
                leftTab + "4. Delete a Book" + Environment.NewLine +
                leftTab + "5. Updated a Book" + Environment.NewLine +
                leftTab + "Q. Quite" + Environment.NewLine);

            DisplayMessage("");
            DisplayPromptMessage("Enter the number/letter from the menu choice: ");
            ConsoleKeyInfo userResponse = Console.ReadKey(true);

            switch (userResponse.KeyChar)
            {
            case '1':
                userActionChoice = AppEnum.LibraryManager.ListAllTheBooks;
                break;

            case '2':
                userActionChoice = AppEnum.LibraryManager.DisplayLibraryDetails;
                break;

            case '3':
                userActionChoice = AppEnum.LibraryManager.AddABook;
                break;

            case '4':
                userActionChoice = AppEnum.LibraryManager.RemoveABook;
                break;

            case '5':
                userActionChoice = AppEnum.LibraryManager.UpatedABook;
                break;

            case 'Q':
            case 'q':
                userActionChoice = AppEnum.LibraryManager.Quit;
                break;

            default:
                DisplayMessage("");
                DisplayMessage("");
                DisplayMessage("It appears that you have selected the incorrect choice in the Library Application Menu.");
                DisplayMessage("");
                DisplayMessage("Please be sure to press any key to try again or the ESC key to exit.");

                userResponse = Console.ReadKey(true);
                if (userResponse.Key == ConsoleKey.Escape)
                {
                    userActionChoice = AppEnum.LibraryManager.Quit;
                }
                break;
            }
            return(userActionChoice);
        }