예제 #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];
 }