public static void Run(string[] args, IWindowsService service) { var serviceName = service.GetType().Name; service.WriteToConsole += OnWriteToConsole; var isRunning = true; AllocConsole(); service.Start(args); while (isRunning) { WriteToConsole(ConsoleColor.Yellow, "Enter either [Q]uit, [P]ause, [R]esume : "); isRunning = HandleConsoleInput(service, Console.ReadLine()); } service.Stop(); service.Shutdown(); }