// Private input handler for console commands. private static bool HandleConsoleInput(IWindowsService service, string line) { bool canContinue = true; // check input if (line != null) { switch (line.ToUpper()) { case "Q": canContinue = false; break; case "P": service.OnPause(); break; case "R": service.OnContinue(); break; default: service.OnCustomCommand(int.Parse(line)); break; } } return(canContinue); }
// Private input handler for console commands. private static bool HandleConsoleInput(IWindowsService service, string line) { bool canContinue = true; // check input if (line != null) { switch (line.ToUpper()) { case "Q": canContinue = false; break; case "P": service.OnPause(); break; case "R": service.OnContinue(); break; default: WriteToConsole(ConsoleColor.Red, "Did not understand that input, try again."); break; } } return(canContinue); }
private static bool HandleConsoleInput(IWindowsService service, string line) { bool canContinue = true; // check input if (line != null) { switch (line.ToUpper()) { case "Q": canContinue = false; break; case "P": service.OnPause(); break; case "R": service.OnContinue(); break; default: WriteToConsole(ConsoleColor.Red, "Did not understand that input, try again."); break; } } return canContinue; }
// Private input handler for console commands. private static bool HandleConsoleInput(IWindowsService service, string line) { bool canContinue = true; // check input if (line != null) { switch (line.ToUpper()) { case "Q": canContinue = false; break; case "P": service.OnPause(); break; case "R": service.OnContinue(); break; default: WriteToConsole(ConsoleColor.Red, "Je n'ai pas compris cette commande, veuillez réessayer."); break; } } return(canContinue); }
// Private input handler for console commands. private static bool HandleConsoleInput(IWindowsService service, ConsoleKeyInfo key) { bool canContinue = true; // check input switch (key.Key.ToString()) { case "Q": canContinue = false; break; case "P": service.OnPause(); break; case "R": service.OnContinue(); break; case "S": canContinue = false; shutdown = true; break; default: WriteToConsole(ConsoleColor.Red, "\nDid not understand that input, try again."); break; } return(canContinue); }
/// <summary> /// Reads the console input. /// </summary> /// <param name="service">The service.</param> /// <param name="line">The line.</param> /// <returns><c>true</c> if can continue, <c>false</c> otherwise.</returns> private static bool ReadConsoleInput(IWindowsService service, string line) { var canContinue = true; if (line != null) { switch (line.ToUpper()) { case "Q": WriteToConsole(ConsoleColor.Red, "Quitting..."); canContinue = false; break; case "P": WriteToConsole(ConsoleColor.DarkCyan, "Paused..."); service.OnPause(); break; case "R": WriteToConsole(ConsoleColor.Green, "Continuing..."); service.OnContinue(); break; default: WriteToConsole(ConsoleColor.Red, "Please select a a valid option."); break; } } return(canContinue); }
// Private input handler for console commands. private static bool HandleConsoleInput(IWindowsService service, string line) { bool canContinue = true; // check input if (line != null) { switch (line.ToUpper()) { case "S": canContinue = false; break; case "P": service.OnPause(); break; case "C": service.OnContinue(); break; default: WriteToConsole(ConsoleColor.Red, "Tecla Invalida. Tente outra vez."); break; } } return(canContinue); }
private static void TryHandleConsoleInput(IWindowsService service, ConsoleKey key, ref ServiceState state) { switch (key) { case ConsoleKey.Q: state = ServiceState.Stopped; break; case ConsoleKey.P: service.OnPause(); state = ServiceState.Paused; break; case ConsoleKey.R: service.OnContinue(); state = ServiceState.Running; break; } }
protected override void OnContinue() { _implementer.OnContinue(); }