static void Main() { Debug.WriteLine("Running WindowsService.Main"); Debug.WriteLine(Directory.GetCurrentDirectory()); RunUI(); if (ohipsMonitor == null) { // Start our monitor thread ohipsMonitor = new OhipsMonitor(); Thread oThread = new Thread(new ThreadStart(ohipsMonitor.OhipsMonitorThread)); // Start the thread oThread.Start(); // Spin for a while waiting for the started thread to become // alive: while (!oThread.IsAlive) { ; } } // Start service ServiceBase.Run(new WindowsService()); }
/// <summary> /// OnStop(): Put your stop code here /// - Stop threads, set final data, etc. /// </summary> protected override void OnStop() { System.Diagnostics.Debug.WriteLine("OpenHIPS Stop"); running = false; OhipsMonitor.Uninstall(); KillUI(); base.OnStop(); }
static void Main() { Debug.WriteLine("Running WindowsService.Main"); Debug.WriteLine(Directory.GetCurrentDirectory()); RunUI(); if (ohipsMonitor == null) { // Start our monitor thread ohipsMonitor = new OhipsMonitor(); Thread oThread = new Thread(new ThreadStart(ohipsMonitor.OhipsMonitorThread)); // Start the thread oThread.Start(); // Spin for a while waiting for the started thread to become // alive: while (!oThread.IsAlive) ; } // Start service ServiceBase.Run(new WindowsService()); }