Пример #1
0
        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();
        }
Пример #2
0
 public MenuEntry(string name, Action action, ConsoleMenu next)
 {
     this.name   = name;
     this.action = action;
     this.next   = next;
 }
Пример #3
0
 public void SetStartingMenu(ConsoleMenu start)
 {
     current = start;
 }