protected override void OnStop() { try { ServiceExecution.GetInstance().StopServiceExecution(); thread.Join(); EventLogger.DebugEntry("Service stopped", EventLogEntryType.Information); } catch (Exception e) { EventLogger.Entry("Service Error: Stopping - " + e, EventLogEntryType.Error); } }
public static ServiceExecution GetInstance() { if (instance == null) { lock (instanceLock) { if (instance == null) { instance = new ServiceExecution(); } } } return(instance); }
protected override void OnStart(string[] args) { try { thread = new Thread(ServiceExecution.GetInstance().StartServiceExecution) { Name = "Service Executer" }; thread.Start(); EventLogger.DebugEntry("Service started", EventLogEntryType.Information); } catch (Exception e) { EventLogger.Entry("Service Error: Starting - " + e, EventLogEntryType.Error); } }
public MainScanService() { try { InitializeComponent(); finalExit = true; if (!EventLog.SourceExists("MainScanService")) { EventLog.CreateEventSource("MainScanService", ""); } MainScanServiceEventLog.Source = "MainScanService"; MainScanServiceEventLog.Log = ""; ServiceExecution.GetInstance().scanService = this; EventLogger.log = MainScanServiceEventLog; // ServiceExecution.GetInstance().myService = this; } catch (Exception e) { EventLogger.Entry("Service Error: Init - " + e, EventLogEntryType.Error); } }