private void SetServiceStatus(string serviceName) { var serviceModel = _model.Services.Single(x => x.ServiceName == serviceName); serviceModel.ServiceExists = _windowsServiceHelper.ServiceExists(serviceName); if (serviceModel.ServiceExists) { serviceModel.DisplayName = _windowsServiceHelper.GetServiceDisplayName(serviceName); serviceModel.IsServiceEnabled = _windowsServiceHelper.IsServiceEnabled(serviceName); } }
private void SetServiceStatus(string serviceName) { var serviceModel = _model.Services.Single(x => x.ServiceName == serviceName); try { serviceModel.ServiceExists = _windowsServiceHelper.ServiceExists(serviceName); if (serviceModel.ServiceExists) { serviceModel.DisplayName = _windowsServiceHelper.GetServiceDisplayName(serviceName); serviceModel.IsServiceEnabled = _windowsServiceHelper.IsServiceEnabled(serviceName); } } catch (Exception ex) { Wu10Logger.LogError(ex); } }