Bagikan melalui


AddInProcess.IsCurrentProcess Properti

Definisi

Mendapatkan nilai yang menunjukkan apakah objek saat ini AddInProcess mewakili proses aplikasi host.

public:
 property bool IsCurrentProcess { bool get(); };
public bool IsCurrentProcess { get; }
member this.IsCurrentProcess : bool
Public ReadOnly Property IsCurrentProcess As Boolean

Nilai Properti

trueAddInProcess jika objek sesuai dengan proses saat ini; jika tidak, false.

Contoh

Contoh berikut mengaktifkan add-in dalam proses eksternal dan menggunakan IsCurrentProcess properti untuk menentukan apakah add-in berada dalam proses yang sama dengan proses aplikasi host.

// Create an external process.
AddInProcess pExternal = new AddInProcess();

// Activate an add-in in the external process
// with a full trust security level.
Calculator CalcAddIn4 =
    selectedToken.Activate<Calculator>(pExternal,
    AddInSecurityLevel.FullTrust);

// Show that the add-in is an external process
// by verifying that it is not in the current (host's) process.
AddInController AddinCtl = AddInController.GetAddInController(CalcAddIn4);
Console.WriteLine("Add-in in host's process: {0}",
    AddinCtl.AddInEnvironment.Process.IsCurrentProcess);
' Create an external process.
Dim pExternal As New AddInProcess()

' Activate an add-in in the external process
' with a full trust security level.
Dim CalcAddIn4 As Calculator = _
    selectedToken.Activate(Of Calculator)(pExternal, _
        AddInSecurityLevel.FullTrust)

' Show that the add-in is an external process
' by verifying that it is not in the current (host's) process.
Dim AddinCtl As AddInController = AddInController.GetAddInController(CalcAddIn4)
Console.WriteLine("Add-in in host's process: {0}", _
 AddinCtl.AddInEnvironment.Process.IsCurrentProcess)

Keterangan

Jika nilai properti ini adalah true, add-in berjalan dalam proses dengan aplikasi host. Dalam hal ini, menggunakan Start metode atau Shutdown melempar InvalidOperationException.

Catatan

Properti AddInEnvironment.Process mengembalikan AddInProcess objek yang mewakili proses aplikasi host jika add-in berjalan dalam proses.

Berlaku untuk