예제 #1
0
        protected override void OnStop()
        {
            _war.Dispose();
            _war = null;

            // Kill the thread keeping the app going.
            _shutdownEvent.Set();
            if (!_thread.Join(3000))
            { // give the thread 3 seconds to stop
                _thread.Abort();
            }
        }
예제 #2
0
        protected override void OnStart(string[] args)
        {
            _war = new WatchAndRip(EventLog);

            //Create a thread to keep the app alive
            _thread = new Thread(WorkerThreadFunc)
            {
                Name         = "MsDevShow.ShownoteStyleStripper.Service.WorkerThread",
                IsBackground = true
            };
            _thread.Start();
        }
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main()
 {
     if (Environment.UserInteractive)
     {
         var war = new WatchAndRip();
         new System.Threading.AutoResetEvent(false).WaitOne();
     }
     else
     {
         ServiceBase[] ServicesToRun;
         ServicesToRun = new ServiceBase[]
         {
             new ShownoteStyleStripperService()
         };
         ServiceBase.Run(ServicesToRun);
     }
 }