ServiceController.CanPauseAndContinue Właściwość

Definicja

Pobiera wartość wskazującą, czy można wstrzymać i wznowić usługę.

public:
 property bool CanPauseAndContinue { bool get(); };
public bool CanPauseAndContinue { get; }
[System.ServiceProcess.ServiceProcessDescription("SPCanPauseAndContinue")]
public bool CanPauseAndContinue { get; }
member this.CanPauseAndContinue : bool
[<System.ServiceProcess.ServiceProcessDescription("SPCanPauseAndContinue")>]
member this.CanPauseAndContinue : bool
Public ReadOnly Property CanPauseAndContinue As Boolean

Wartość właściwości

true jeśli można wstrzymać usługę; w przeciwnym razie , false.

Atrybuty

Wyjątki

Wystąpił błąd podczas uzyskiwania dostępu do interfejsu API systemu.

Nie można odnaleźć usługi.

Przykłady

W poniższym przykładzie pokazano użycie CanPauseAndContinue właściwości w celu określenia, czy usługa może wstrzymać i kontynuować. Ten przykład jest częścią większego przykładu udostępnionego ServiceController dla klasy.

// Display properties for the Simple Service sample
// from the ServiceBase example.
ServiceController sc = new ServiceController("Simple Service");
Console.WriteLine("Status = " + sc.Status);
Console.WriteLine("Can Pause and Continue = " + sc.CanPauseAndContinue);
Console.WriteLine("Can ShutDown = " + sc.CanShutdown);
Console.WriteLine("Can Stop = " + sc.CanStop);
' Display properties for the Simple Service sample 
' from the ServiceBase example
Dim sc As New ServiceController("Simple Service")
Console.WriteLine("Status = " + sc.Status.ToString())
Console.WriteLine("Can Pause and Continue = " + _
    sc.CanPauseAndContinue.ToString())
Console.WriteLine("Can ShutDown = " + sc.CanShutdown.ToString())
Console.WriteLine("Can Stop = " + sc.CanStop.ToString())

Dotyczy