예제 #1
0
        /// <summary>Shows one menu.</summary>
        /// <param name="clearScreen">Indicates if you would like to clear the screen.</param>
        private void ShowOneMenu(bool clearScreen)
        {
            if (clearScreen)
            {
                _console.Clear();
            }

            var currentMenu = _menuStack.Peek();

            string title = string.IsNullOrWhiteSpace(currentMenu.BreadCrumbTitle) ? currentMenu.Title : currentMenu.BreadCrumbTitle;

            if (string.IsNullOrWhiteSpace(title) == false)
            {
                _console.WriteLine(title);
            }

            foreach (var menuItem in currentMenu.MenuItems)
            {
                _console.WriteLine($"{menuItem.ItemNumber}. {menuItem.Item.ItemText}");
            }

            _console.WriteLine("Hit enter to clear the screen and refresh the menu");
        }