static void Main(string[] args) { MenuItem mi = new MenuItem("Itemmm 1", 'A'); ColoredMenuItem cmi = new ColoredMenuItem("Item 2", 'B', ConsoleColor.Green); EmptyItem ei = new EmptyItem(); mi.Display(10); cmi.Display(10); ei.Display(10); }
private IMenuItem SelectByKey(ConsoleKey code) { IMenuItem result = new EmptyItem(); foreach (IMenuItem item in _itemList.Values) { if (item.Code == code && item.Visible) { result = item; break; } } return(result); }