Hey, is there a wait statement for processes like the one in this code snippet:
Right at this point:Code:private void StopService(string serviceName, int timeoutMilliseconds) { using (ServiceController service = new ServiceController(serviceName)) { //service.DisplayName = ; // Do not Stop the service if it is already stopped if (service.Status == ServiceControllerStatus.Stopped) return; try { TimeSpan timeout = TimeSpan.FromMilliseconds(timeoutMilliseconds); service.Stop(); service.WaitForStatus(ServiceControllerStatus.Stopped, timeout); } catch (Exception) { } } }
Is there something like that for a process?Code:service.WaitForStatus(ServiceControllerStatus.Stopped, timeout);
Thanks, in advance.




Reply With Quote