Exemple #1
0
        /// <summary>
        /// Starts the menu loop.
        /// </summary>
        public void Run()
        {
            try
            {
                Push(new StoreCliMenu.Main(this.AppState));
            }
            catch (Exception)
            {
                CliPrinter.Error("An error occurred while connecting to database. Please try running the program again.");
                return;
            }

            while (this.Menus.Count > 0)
            {
                try
                {
                    this.Menus.Peek().PrintMenu();
                    this.Menus.Peek().InputLoop();
                }
                catch (Exception)
                {
                    CliInput.PressAnyKey("\nAn error occurred while processing your request. Returning.");
                    this.Pop();
                    continue;
                }
            }
        }
Exemple #2
0
 /// <summary>
 /// Prints an error message then waits for the user to confirm, after which
 /// the menu will be taken off the menu stack causing navigation to back one menu.
 /// </summary>
 /// <param name="menu">The current menu.</param>
 /// <param name="message">Message to print to the user.</param>
 public static void AbortThenExit(this CliMenu menu, string message)
 {
     CliPrinter.Error(message);
     CliInput.PressAnyKey();
     menu.MenuExit();
 }