protected virtual void OnChosen() { if (Chosen != null) { Chosen.Invoke(); } }
private void HandleInput(IMenuItemInfo[] options, ref int selected) { var key = Console.ReadKey(true).Key; switch (key) { case ConsoleKey.UpArrow: if (selected <= 0) { selected = options.GetUpperBound(0); } else { selected--; } break; case ConsoleKey.DownArrow: if (selected >= options.GetUpperBound(0)) { selected = 0; } else { selected++; } break; case ConsoleKey.Backspace: case ConsoleKey.Escape: Back?.Invoke(this, EventArgs.Empty); selected = -1; break; case ConsoleKey.Enter: Chosen?.Invoke(this, new MenuItemInfoEventArgs(options[selected])); selected = -1; break; } }
protected virtual void OnChosen(MenuItem i_MenuItem) { Chosen?.Invoke(i_MenuItem); }
private EventHandler InitializeButtonClickHandler(string choice) => (sender, args) => Chosen?.Invoke(null, choice);
internal void OnChosen() { Chosen?.Invoke(this); }