AddInProcess.IsCurrentProcess Tulajdonság

Definíció

Beolvas egy értéket, amely jelzi, hogy az aktuális AddInProcess objektum a gazdaalkalmazás folyamatát képviseli-e.

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

Tulajdonság értéke

true ha az AddInProcess objektum megfelel az aktuális folyamatnak; falseellenkező esetben.

Példák

Az alábbi példa egy bővítményt aktivál egy külső folyamatban, és a IsCurrentProcess tulajdonság használatával állapítja meg, hogy a bővítmény ugyanabban a folyamatban van-e, mint a gazdaalkalmazás folyamata.

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

Megjegyzések

Ha ennek a tulajdonságnak az értéke, truea bővítmény folyamatban fut a gazdaalkalmazással. Ebben az esetben a metódus vagy Shutdown a Start metódus használatával egy InvalidOperationException.

Note

A AddInEnvironment.Process tulajdonság egy AddInProcess objektumot ad vissza, amely a gazdaalkalmazás folyamatát jelöli, ha a bővítmény folyamatban fut.

A következőre érvényes: