A class containing extension methods for the ServiceController class.
public static class ServiceControllerExtensions
This class contains extensions methods to set the Windows Service start mode to any valid start mode including "Automatic (Delayed Start)".
A specific DICOM listening service (or any windows service) is configured to have a startup type:
Start mode | Description |
---|---|
Automatic |
The DICOM listening service automatically starts during the boot and logon process. |
Manual |
The DICOM listening service does not automatically start during boot and logon, but may be launched by Windows if needed. |
Disabled |
Use this setting to disable the DICOM listening service. Disabling the service prevents the service from starting. |
AutomaticDelayedStart |
Similar to Automatic, except the DICOM listening service is briefly delayed during the logon process to increase logon performance. |
This example shows how the ServiceControllerExtensions
class can be used to set the StartMode
for a Windows Service.
using Leadtools.Dicom.AddIn;
using Leadtools.Dicom.AddIn.Common;
using Leadtools.Dicom.Server.Admin;
public static void Example_ServerControllerExtensions()
{
using (ServiceController sc = new ServiceController("L22_PACS_SCP64"))
{
// Set start modes using constants
sc.SetStartMode(ServiceStartModeExtended.Disabled);
sc.SetStartMode(ServiceStartModeExtended.Manual);
sc.SetStartMode(ServiceStartModeExtended.Automatic);
sc.SetStartMode(ServiceStartModeExtended.AutomaticDelayedStart);
// Set start modes using strings
sc.SetStartMode("Disabled");
sc.SetStartMode("Manual");
sc.SetStartMode("Automatic");
sc.SetStartMode("AutomaticDelayedStart");
}
}