private void InitDCSGatewayServices() { Services.Clear(); ServiceController[] controllers = ServiceController.GetServices(); foreach (ServiceController controller in controllers) { if (controller.ServiceName.ToUpper().Contains(ServiceCommName.ToUpper())) { Services.Add( new ServiceEntity() { ServiceName = controller.ServiceName, Status = controller.Status, Service = controller, }); } } }
public List <ServiceEntity> GetDCSGatewayServices() { Services.Clear(); ServiceController[] services = ServiceController.GetServices(); foreach (ServiceController service in services) { if (service.ServiceName.ToUpper().Contains(ServiceCommName.ToUpper())) { Services.Add( new ServiceEntity() { ServiceName = service.ServiceName, Status = service.Status, Service = service, }); } } return(Services.ExtractToList()); }