Пример #1
0
 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);
     }
 }
Пример #2
0
 public static ServiceExecution GetInstance()
 {
     if (instance == null)
     {
         lock (instanceLock) {
             if (instance == null)
             {
                 instance = new ServiceExecution();
             }
         }
     }
     return(instance);
 }
Пример #3
0
 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);
     }
 }
Пример #4
0
        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);
            }
        }