/// <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)); } }
/// <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)); } }