public List <TResponseType> Draw() { Console.CursorVisible = false; StartPosition = Console.CursorTop; while (true) { Position.Write(Question); if (CurrentIndex < 0) { ChangeIndex(0); } for (var index = 0; index < Options.Count; index++) { var consoleRadioCheck = Options[index]; Position.WriteCleaningLine(consoleRadioCheck.ToString(), index + 1); } var key = Console.ReadKey(true); if (DownKeys.Contains(key.Key)) { DownIndex(); } if (UpKeys.Contains(key.Key)) { UpIndex(); } if (SelectKeys.Contains(key.Key)) { ToggleCurrent(); } if (key.Key == ConsoleKey.Enter) { var consoleRadioChecks = Options.Where(i => i.IsChecked).ToList(); if (Parameters.Required && consoleRadioChecks.Count <= 0) { continue; } Console.CursorVisible = true; Clear(); Console.WriteLine(Question + " > " + consoleRadioChecks .Select(i => i.Message) .Aggregate((x, y) => $"{x}, {y}")); return(consoleRadioChecks.Select(i => i.Value).ToList()); } } }
public bool IsKeyUp(Key key) => UpKeys.Contains(key);