示例#1
0
        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()
                });
            }
        }
示例#2
0
        private static void Worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            BGWData BGWData = e.Result as BGWData;

            Worker.Dispose();
            GlobalResources.WinServIsOver();
        }
示例#3
0
 public static void InitializePPM()
 {
     BGWData = new BGWData();
     GlobalResources.WindowsServicesIsOn += GlobalResources_WindowsServicesIsOn;
 }