protected override void OnStart(string[] args) { ThreadService = new Thread(new ThreadStart(ThreadProc)); ThreadService.Start(); ServiceLog.CoreLog("Messenger Executed Succesfully"); }
public void ThreadProc() { int waitTime = 1000; // 1 second try { do { ServiceLog.DoWork(); Thread.Sleep(waitTime); ServiceLog.CoreLog("Service is Doing Work"); }while (true); } catch (ThreadAbortException e) { Debug.WriteLine(e.Message); ServiceLog.CoreLog(e.Message); } }
protected override void OnStop() { ServiceLog.CoreLog("Service Aborted"); }