Beispiel #1
0
        private void SavedServicesRestart(object sender, EventArgs e)
        {
            if (Services == null)
            {
                return;
            }

            // Restart only running services.
            ServicesCollection runningServices = new ServicesCollection();

            runningServices.AddRange(from entry in Services.GetStatuses() where entry.Value == ServiceControllerStatus.Running select entry.Key);
            runningServices.InvokeRestart();
        }