Opc.Ua.Configuration.ServiceManager.GetServiceStatus C# (CSharp) Method

GetServiceStatus() public static method

Gets the status of the service with the given name.
public static GetServiceStatus ( string serviceName ) : ServiceStatus
serviceName string The name of the service.
return ServiceStatus
        public static ServiceStatus GetServiceStatus(string serviceName)
        {
            try
            {
                using (ServiceController c = new ServiceController(serviceName))
                {
                    c.Refresh();
                    return ConvertServiceControllerStatusToServiceStatus(c.Status);
                }
            }
            catch (Exception e)
            {
                Utils.Trace(e, "Unexpected error getting status for service {0}.", serviceName);
                return ServiceStatus.Unknown;
            }
        }