Exemple #1
0
        private static void WriteSelectionDescription(IMenuItemInfo option)
        {
            if (string.IsNullOrEmpty(option.Description))
            {
                return;
            }

            Console.WriteLine();
            Console.ForegroundColor = Constants.SecondaryColor;
            Console.WriteLine($"{option.Description}");

            if (!(option is IBackMenu))
            {
                Console.WriteLine(
                    option is IUseCase
                        ? "(press ENTER to run the use case)"
                        : "(press ENTER to explore the category)");
            }
        }
Exemple #2
0
        private static void WriteSelectedGlyph(IMenuItemInfo option)
        {
            switch (option)
            {
            case BackMenu _:
                Console.Write("<-  ");
                break;

            case ExitMenu _:
                Console.Write("<-  ");
                break;

            case ICategory _:
                Console.Write("->  ");
                break;

            case IUseCase _:
                Console.Write(">>  ");
                break;

            default:
                throw new InvalidOperationException("Invalid menu item type.");
            }
        }
Exemple #3
0
 private void WriteUseCaseHeader(IMenuItemInfo useCase) =>
 _breadcrumbs.Prepend(useCase).WriteBreadcrumbs();
Exemple #4
0
        private static int GetIndex(IMenuItemInfo[] options, IMenuItemInfo selectedItem)
        {
            var selectedOption = options.FirstOrDefault(item => item.GetType() == selectedItem.GetType());

            return(selectedOption != null?Array.IndexOf(options, selectedOption) : 0);
        }
Exemple #5
0
 public MenuItemInfoEventArgs(IMenuItemInfo menuItemInfo)
 {
     MenuItemInfo = menuItemInfo;
 }