System.ServiceProcess.ServiceController.Refresh C# (CSharp) Method

Refresh() public method

public Refresh ( ) : void
return void
        public void Refresh()
        {
        }

Usage Example

        private static void serviceStart()
        {
            ServiceController[] scServices;
            scServices = ServiceController.GetServices();

            foreach (ServiceController scTemp in scServices)
            {

                if (scTemp.ServiceName == "open-audit-check-service")
                {

                    ServiceController sc = new ServiceController("open-audit-check-service");
                    if (sc.Status == ServiceControllerStatus.Stopped)
                    {
                        int tries = 0;
                        sc.Start();
                        while (sc.Status == ServiceControllerStatus.Stopped && tries < 5)
                        {
                            Thread.Sleep(1000);
                            sc.Refresh();
                            tries++;
                        }
                    }

                }
            }
        }
All Usage Examples Of System.ServiceProcess.ServiceController::Refresh