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

                finalExit = true;

                if (!EventLog.SourceExists("ScanServiceServer"))
                {
                    EventLog.CreateEventSource("ScanServiceServer", "");
                }

                ScanServiceServerEventLog.Source = "ScanServiceServer";
                ScanServiceServerEventLog.Log    = "";

                ServiceExecution.GetInstance().scanService = this;

                EventLogger.log = ScanServiceServerEventLog;

                // ServiceExecution.GetInstance().myService = this;
            } catch (Exception e) {
                EventLogger.Entry("Service Error: Init - " + e, EventLogEntryType.Error);
            }
        }