diff options
author | Wouter Tinus <wouter.tinus@gmail.com> | 2020-05-12 20:47:04 +0200 |
---|---|---|
committer | Wouter Tinus <wouter.tinus@gmail.com> | 2020-05-12 20:47:04 +0200 |
commit | 503e287730befec7130a7912e97b93b5eaa39dc5 (patch) | |
tree | 45e96ed7e9061daa847ce42fc7e29fd234882dae | |
parent | e8ca67325e271e72491c415cf0ec78a532758bdd (diff) | |
download | letsencrypt-win-simple-503e287730befec7130a7912e97b93b5eaa39dc5.zip letsencrypt-win-simple-503e287730befec7130a7912e97b93b5eaa39dc5.tar.gz letsencrypt-win-simple-503e287730befec7130a7912e97b93b5eaa39dc5.tar.bz2 |
Use space instead of enter to prevent accidental trigger of the default option after the list
-rw-r--r-- | src/main.lib/Services/InputService.cs | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/main.lib/Services/InputService.cs b/src/main.lib/Services/InputService.cs index e4f51a1..eb5fb64 100644 --- a/src/main.lib/Services/InputService.cs +++ b/src/main.lib/Services/InputService.cs @@ -44,6 +44,25 @@ namespace PKISharp.WACS.Services } } + public Task<bool> Continue(string message = "Press <Space> to continue...") + { + Validate(message); + CreateSpace(); + Console.Write($" {message} "); + while (true) + { + var response = Console.ReadKey(true); + switch (response.Key) + { + case ConsoleKey.Spacebar: + Console.SetCursorPosition(0, Console.CursorTop); + Console.Write(new string(' ', Console.WindowWidth)); + Console.SetCursorPosition(0, Console.CursorTop); + return Task.FromResult(true); + } + } + } + public Task<bool> Wait(string message = "Press <Enter> to continue...") { Validate(message); @@ -417,7 +436,7 @@ namespace PKISharp.WACS.Services // Paging if (currentIndex > 0) { - if (await Wait()) + if (await Continue()) { currentPage += 1; } |