private static void RunService(Action <ISchedulingService> setupHandler, bool debug) { try { AppDomain.CurrentDomain.UnhandledException += (o, e) => ExceptionHelper.LogUnhandledException(e.ExceptionObject); using (var service = new SchedulingService()) { setupHandler(service); if (debug) { service.Start(); Console.ReadLine(); service.Stop(); } else { using (var adapter = new ServiceProcessAdapter(service)) { ServiceBase.Run(adapter); } } } } catch (Exception exception) { ExceptionHelper.LogUnhandledException(exception); } }
private static void RunService(Action<ISchedulingService> setupHandler, bool debug) { try { AppDomain.CurrentDomain.UnhandledException += (o, e) => ExceptionHelper.LogUnhandledException(e.ExceptionObject); using (var service = new SchedulingService()) { setupHandler(service); if (debug) { service.Start(); Console.ReadLine(); service.Stop(); } else { using (var adapter = new ServiceProcessAdapter(service)) { ServiceBase.Run(adapter); } } } } catch (Exception exception) { ExceptionHelper.LogUnhandledException(exception); } }