/// <summary> /// Initializes a new instance of the <see cref="AlarmWorkflowService"/> class. /// </summary> public AlarmWorkflowService() { InitializeComponent(); ErrorReportManager.RegisterAppDomainUnhandledExceptionListener(this.GetType().Name); // Set up the logger for this instance Logger.Instance.Initialize(this.GetType().Name); _manager = new AlarmWorkflowServiceManager(); }
static void Main(string[] args) { ErrorReportManager.RegisterAppDomainUnhandledExceptionListener(ComponentName); // Print welcome information :-) Console.WriteLine("********************************************************"); Console.WriteLine("* *"); Console.WriteLine("* AlarmWorkflow Service Console *"); Console.WriteLine("* FOR DEBUGGING ONLY! *"); Console.WriteLine("* *"); Console.WriteLine("* !!! Press ESCAPE to quit safely !!! *"); Console.WriteLine("* *"); Console.WriteLine("********************************************************"); Console.WriteLine(); Console.WriteLine(Properties.Resources.MainStartingService); // Catch all unhandled exceptions and display them. AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; Logger.Instance.Initialize(ComponentName); try { using (AlarmWorkflowServiceManager service = new AlarmWorkflowServiceManager()) { service.OnStart(args); // Wait for user exit while (true) { if (Console.KeyAvailable) { if (Console.ReadKey().Key == ConsoleKey.Escape) { break; } } Thread.Sleep(1); } Console.WriteLine(Properties.Resources.MainShuttingDownService); service.OnStop(); } } catch (Exception ex) { WriteExceptionInformation(ex); Console.WriteLine(Properties.Resources.MainFailStartingServiceException); Console.ReadKey(); } }