Initializes a new instance of the ServiceController class that is not associated with a specific service.
| C# | Visual Basic |
public ServiceController()
Public Sub New
Under Windows CE all services are identified with a device style prefix and index e.g. APP0:
Toggles the state of the Obex listener service
CopyC#
CopyC#
[VB]
Dim sc As New ServiceController("OBX0:")
If sc.Status = ServiceControllerStatus.Running Or sc.Status = ServiceControllerStatus.StartPending Then
sc.Stop()
Else
sc.Start()
End If[C#]
ServiceController sc = new ServiceController("OBX0:");
if(sc.Status==ServiceControllerStatus.Running | sc.Status==ServiceControllerStatus.StartPending)
{
sc.Stop();
}
else
{
sc.Start();
}