コード例 #1
0
        protected override void OnStart(string[] args)
        {
            ThreadService = new Thread(new ThreadStart(ThreadProc));
            ThreadService.Start();

            ServiceLog.CoreLog("Messenger Executed Succesfully");
        }
コード例 #2
0
        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);
            }
        }
コード例 #3
0
 protected override void OnStop()
 {
     ServiceLog.CoreLog("Service Aborted");
 }