示例#1
0
 /// <summary>
 /// Stop this service.
 /// </summary>
 protected override void OnStop()
 {
     try
     {
         threadWorker.Stop();
         thread       = null;
         threadWorker = null;
         EventLog.WriteEntry(String.Format("TechBot service is stopped."));
     }
     catch (Exception ex)
     {
         EventLog.WriteEntry(String.Format("Ex. {0}", ex));
     }
 }
示例#2
0
 /// <summary>
 /// Start this service.
 /// </summary>
 protected override void OnStart(string[] args)
 {
     try
     {
         threadWorker = new ServiceThread(EventLog);
         thread       = new Thread(new ThreadStart(threadWorker.Start));
         thread.Start();
         EventLog.WriteEntry(String.Format("TechBot service is running."));
     }
     catch (Exception ex)
     {
         EventLog.WriteEntry(String.Format("Ex. {0}", ex));
     }
 }