/// <summary> /// Stops the service. /// </summary> public void Stop() { if (!ServiceManagerForm.IsElevated) { ServiceManagerForm.RequestElevatation(ServiceController.ServiceName, false); return; } ServiceController.Refresh(); if (ServiceController.Status == ServiceControllerStatus.Running) { ServiceController.Stop(); } }
/// <summary> /// Starts, stops the service. /// </summary> public void Start() { if (!ServiceManagerForm.IsElevated) { ServiceManagerForm.RequestElevatation(ServiceController.ServiceName, true); return; } ServiceController.Refresh(); if (ServiceController.Status == ServiceControllerStatus.Stopped) { ServiceController.Start(); } else { } }