Exemplo n.º 1
0
 private void DoPause()
 {
     try
     {
         ServiceController controller = GetServiceController();
         if (controller == null)
         {
             return;
         }
         WaitDlg.RunProgress("Pause...");
         if (controller.Status == ServiceControllerStatus.Paused || controller.Status == ServiceControllerStatus.PausePending)
         {
             controller.Continue();
             controller.WaitForStatus(ServiceControllerStatus.Running);
         }
         else
         {
             controller.Pause();
             controller.WaitForStatus(ServiceControllerStatus.Paused);
         }
         System.Threading.Thread.Sleep(1000);
         SetServiceStatus(controller);
         ShowServiceDetails();
     }
     finally
     {
         WaitDlg.EndProgress();
     }
 }
Exemplo n.º 2
0
 private void DoStop()
 {
     try
     {
         ServiceController controller = GetServiceController();
         if (controller == null)
         {
             return;
         }
         WaitDlg.RunProgress("Stop...");
         controller.Stop();
         controller.WaitForStatus(ServiceControllerStatus.Stopped);
         System.Threading.Thread.Sleep(1000);
         SetServiceStatus(controller);
         ShowServiceDetails();
     }
     finally
     {
         WaitDlg.EndProgress();
     }
 }