public void Run() { if (current.IsEnd()) { return; } int response = -1; if (current.optionsCount() == 1) { response = 1; } while (response <= 0 || response > current.optionsCount()) { DisplayMenu(); WriteEmpty(); WriteQuestion("Please select an option."); if (!Int32.TryParse(Console.ReadLine(), out response) || response <= 0 || response > current.optionsCount()) { WriteStatement("That is not a valid option. Please try again..."); } } current.PerformOption(response); current = current.Next(response); Run(); }
public MenuEntry(string name, Action action, ConsoleMenu next) { this.name = name; this.action = action; this.next = next; }
public void SetStartingMenu(ConsoleMenu start) { current = start; }