Код: Выделить всё
Name: Example Name
Images: 0
Videos: 0
Gifs: 0
Comics: 0
Collections: 0
Total: 0
>
Это метод, который я использую для этого: класс под названием «ConsoleBottom.cs»
Код: Выделить всё
public static (bool Success, string Response) DisplayContentAndGetResponse(List linedDisplayContent, string promptText, int promptLineNumber) {
if (promptText.Length > Console.WindowWidth) return (false, "");
if (promptLineNumber < 0 || promptLineNumber > Console.WindowHeight) return (false, "");
Console.Write("\x1b[2J");
Console.Clear();
// only write as many lines as can fit on the screen
int smaller = int.Min(linedDisplayContent.Count, Console.WindowHeight);
for (int i = 0; i < smaller; i++) {
Console.SetCursorPosition(0, i);
Console.Write("\x1b[2K");
Console.Write(linedDisplayContent[i]);
}
// Clear prompt line and write prompt
Console.SetCursorPosition(0, promptLineNumber);
Console.Write("\x1b[2K");
Console.Write(promptText);
string? response = Console.ReadLine();
response ??= string.Empty;
return (true, response);
}
Как лучше всего изменить поведение консоли в моем приложении, чтобы пользователь не мог прокручивать?
Подробнее здесь: https://stackoverflow.com/questions/792 ... he-console
Мобильная версия