private static void Worker_DoWork(object sender, DoWorkEventArgs e) { BGWData BGWDataOfWorker = e.Argument as BGWData; ServiceController[] services = ServiceController.GetServices(); ServiceController[] devices = ServiceController.GetDevices(); // try to find service name foreach (ServiceController service in services) { BGWDataOfWorker.WinServHolder.Add(new WindowsServices_Model { Service = service.ServiceName, Information = service.DisplayName, Status = service.Status.ToString() }); } foreach (ServiceController device in devices) { BGWDataOfWorker.WinDriverHolder.Add(new WindowsServices_Model { Service = device.ServiceName, Information = device.DisplayName, Status = device.Status.ToString() }); } }
private static void Worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { BGWData BGWData = e.Result as BGWData; Worker.Dispose(); GlobalResources.WinServIsOver(); }
public static void InitializePPM() { BGWData = new BGWData(); GlobalResources.WindowsServicesIsOn += GlobalResources_WindowsServicesIsOn; }