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)"); } }
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."); } }
private void WriteUseCaseHeader(IMenuItemInfo useCase) => _breadcrumbs.Prepend(useCase).WriteBreadcrumbs();
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); }
public MenuItemInfoEventArgs(IMenuItemInfo menuItemInfo) { MenuItemInfo = menuItemInfo; }