static void Main() { using (var service = new ProgramService()) { // so we can run interactive from Visual Studio or as a windows service if (Environment.UserInteractive) { service.OnStart(null); Console.WriteLine("\r\nPress enter key to stop program\r\n"); Console.ReadLine(); service.OnStop(); return; } Run(service); } }
static void Main() { using( var service = new ProgramService() ) { // so we can run interactive from Visual Studio or as a windows service if( Environment.UserInteractive ) { service.OnStart( null ); Console.WriteLine( "\r\nPress enter key to stop program\r\n" ); Console.ReadLine(); service.OnStop(); return; } Run( service ); } }