Bagikan melalui


ServiceController.CanPauseAndContinue Properti

Definisi

Mendapatkan nilai yang menunjukkan apakah layanan dapat dijeda dan dilanjutkan.

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

Nilai Properti

true jika layanan dapat dijeda; jika tidak, false.

Atribut

Pengecualian

Terjadi kesalahan saat mengakses API sistem.

Layanan tidak ditemukan.

Contoh

Contoh berikut menunjukkan penggunaan CanPauseAndContinue properti untuk menentukan apakah layanan dapat menjeda dan melanjutkan. Contoh ini adalah bagian dari contoh yang lebih besar yang disediakan untuk ServiceController kelas .

// 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())

Berlaku untuk