private void Commands(string selection) { switch (Console.ReadLine()) { case "menu": Chapter_8.Program.Load(); break; case "rerun": ExercisesHandler.ExerciseHandler(selection); break; case "help": Console.WriteLine(" 'menu' - Return to menu\n 'rerun' - Run the last selected item\n 'help' - Displays available commands\n 'exit' - Closes the application"); Commands(selection); break; case "exit": Environment.Exit(0); break; default: Console.WriteLine("Invalid Input."); Commands(selection); break; } }
public void MenuLoad() { DrawMenuOptions(); // This is where the menu selection is handled. switch (Console.ReadKey().Key) { case ConsoleKey.S: case ConsoleKey.DownArrow: currentSelection++; Console.Clear(); MenuLoad(); break; case ConsoleKey.W: case ConsoleKey.UpArrow: currentSelection--; Console.Clear(); MenuLoad(); break; case ConsoleKey.Spacebar: case ConsoleKey.Enter: // Passes the current selections value ExercisesHandler.ExerciseHandler(Options[currentSelection]); break; default: Console.Clear(); MenuLoad(); break; } }