コード例 #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
ファイル: MenuEntry.cs プロジェクト: A-F-V/Dash
 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;
 }