public static void RunAsConsole(ExServiceBase service) { Console.WriteLine("Starting..."); service.OnStart(null); Console.WriteLine("Started. Type ENTER to stop."); Console.ReadLine(); Console.WriteLine("Stopping..."); service.OnStop(); Console.WriteLine("Stopped"); }
private void TimeoutHandler(Func <string, ExServiceBase.ServiceTimeoutException> newException) { if (newException == null) { throw new ArgumentNullException("newException"); } if (!Debugger.IsAttached) { this.OnCommandTimeout(); ExServiceBase.ServiceTimeoutException exception = newException((this.serviceStateChanges != null) ? (Environment.NewLine + this.serviceStateChanges.ToString()) : string.Empty); if (ExServiceBase.IsSendEventLogsWithWatsonReportEnabled()) { string lastEventLogEntries = ExServiceBase.GetLastEventLogEntries(TimeSpan.FromMinutes(10.0), 5000); ExWatson.SendReport(exception, ReportOptions.ReportTerminateAfterSend, lastEventLogEntries); return; } ExWatson.SendReport(exception); } }