Пример #1
0
        private void SelectPrev()
        {
            if (options.Count <= 1)
            {
                return;
            }

            int idx = options.IndexOf(currentOption);

            currentOption = --idx < 0 ? options[options.Count - 1] : options[idx];
        }
Пример #2
0
        private void SelectNext()
        {
            if (options.Count <= 1)
            {
                return;
            }

            int idx = options.IndexOf(currentOption);

            currentOption = ++idx == options.Count ? options[0] : options[idx];
        }
Пример #3
0
 public void AddItem <TState>(string name, Action <TState> execute, TState state)
 {
     options.Add(new CMenuOption <TState>(name, execute, state));
     currentOption = currentOption ?? options[0];
 }
Пример #4
0
 public void AddItem(string name, Action <object> execute, object state)
 {
     options.Add(new CMenuOption(name, execute, state));
     currentOption = currentOption ?? options[0];
 }