Exemplo n.º 1
0
        static void UILoop()
        {
            int i;

            i = CalendarCalculations.InitialMystery();  // Start position based on the today's date
            RenderDisplay.DisplayAbout();               // Display initial about info

            while (i <= ERClass.RosaryBead.structRecords.Length)
            {
                Console.Clear();                        // clear console

                RenderDisplay.UpdateMainView(i);        // Populate view struct with new query data
                RenderDisplay.DisplayView();            // render console display text

                i = UserInput.KeyNavigation(i);         // prompt for UI input, update to next position
            }
        }
Exemplo n.º 2
0
        public static int KeyNavigation(int i)
        {
            ConsoleKeyInfo k         = Console.ReadKey();
            string         keyString = k.Key.ToString();

            switch (keyString)
            {
            case "q" or "Q" or "Escape":                                                    // Quit Application
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("\n\n\t_Terminated Application.\n");
                Console.ResetColor();
                Environment.Exit(0);
                break;

            case "l" or "L" or "Enter" or "RightArrow" or "Spacebar":       // Next
                i++;
                if (i >= ERClass.RosaryBead.totalRecords)
                {
                    i = 0;
                }
                break;

            case "h" or "H" or "LeftArrow":                                 // Previous
                if (i == 0)
                {
                    i = ERClass.RosaryBead.totalRecords;
                }
                i--;
                break;

            case "j" or "J" or "k" or "K":                                  // About
                RenderDisplay.DisplayAbout();
                break;

            default:
                //Console.WriteLine( "\nk.Key: " + k.Key + "\tkeyString: " + keyString + "\n" );
                //Environment.Exit(0);
                RenderDisplay.DisplayAbout();
                break;
            }

            return(i);
        }