private void SelectPrev() { if (options.Count <= 1) { return; } int idx = options.IndexOf(currentOption); currentOption = --idx < 0 ? options[options.Count - 1] : options[idx]; }
private void SelectNext() { if (options.Count <= 1) { return; } int idx = options.IndexOf(currentOption); currentOption = ++idx == options.Count ? options[0] : options[idx]; }
public void AddItem <TState>(string name, Action <TState> execute, TState state) { options.Add(new CMenuOption <TState>(name, execute, state)); currentOption = currentOption ?? options[0]; }
public void AddItem(string name, Action <object> execute, object state) { options.Add(new CMenuOption(name, execute, state)); currentOption = currentOption ?? options[0]; }