/// <summary> /// Cancel the currently active scanner. /// </summary> public void Cancel() { lock (sync) { if (scanner != null) { scanner.Cancel(); } } }
static void WaitUserInput(IScanner scanner) { PrintMessage("Processing (to cancel or exit press [Esc])...", ConsoleColor.Green); while (true) { var keyInfo = Console.ReadKey(true); if (keyInfo.Key == ConsoleKey.Escape) { scanner?.Cancel(); break; } } }