static void Main(string[] args) { Menu Menu = new Menu("My Awesome Menu"); Menu.AddMenuItem("point 1", "Bob the builder was here!"); Menu.AddMenuItem("point 2", "Bob the builder have yet to come here!"); Menu.AddMenuItem("point a bit longer", "Bob the builder will never come here!"); Menu.Start(); }
internal static IEnumerable<IMenu> ToMenuList(this IEnumerable<IMenuItem> menuItems, string instructionalText, int maxAllowed = Menu.MaxOnScreen) { var source = menuItems.ToNumberedMenuItems(maxAllowed).ToList(); var currentMenu = new Menu(instructionalText); foreach (var menuItem in source) { currentMenu.AddMenuItem(menuItem); if (menuItem.IsMore) { yield return currentMenu; currentMenu = new Menu(instructionalText); } } if (!source.Last().IsMore) { yield return currentMenu; } }
internal static IEnumerable <IMenu> ToMenuList(this IEnumerable <IMenuItem> menuItems, string instructionalText, int maxAllowed = Menu.MaxOnScreen) { var source = menuItems.ToNumberedMenuItems(maxAllowed).ToList(); var currentMenu = new Menu(instructionalText); foreach (var menuItem in source) { currentMenu.AddMenuItem(menuItem); if (menuItem.IsMore) { yield return(currentMenu); currentMenu = new Menu(instructionalText); } } if (!source.Last().IsMore) { yield return(currentMenu); } }