Condividi tramite


Proprietà ToolWindows.DTE

Ottiene l'oggetto estensibilità di primo livello.

Spazio dei nomi:  EnvDTE80
Assembly:  EnvDTE80 (in EnvDTE80.dll)

Sintassi

'Dichiarazione
ReadOnly Property DTE As DTE
DTE DTE { get; }
property DTE^ DTE {
    DTE^ get ();
}
abstract DTE : DTE with get
function get DTE () : DTE

Valore proprietà

Tipo: DTE
Oggetto DTE.

Note

In Visual Studio l'oggetto DTE è l'oggetto radice del modello di automazione. In altri modelli a oggetti viene spesso chiamato "Applicazione".

Esempi

Nell'esempio riportato di seguito viene illustrato come raggiungere l'oggetto DTE padre mediante l'oggetto TollWindows. Per ulteriori informazioni sulla modalità di esecuzione di questo esempio come componente aggiuntivo, vedere Procedura: compilare ed eseguire gli esempi di codice del modello a oggetti di automazione.

Imports EnvDTE
Imports EnvDTE80
Public Sub OnConnection(ByVal application As Object, _
 ByVal connectMode As ext_ConnectMode, ByVal addInInst As Object, _
 ByRef custom As Array) Implements IDTExtensibility2.OnConnection
    _applicationObject = CType(application, DTE2)
    _addInInstance = CType(addInInst, AddIn)
    CommandWindowManip(_applicationObject)
End Sub
Public Sub CommandWindowManip(ByVal dte As DTE2)
    Dim myCmd As CommandWindow
    myCmd = _applicationObject.ToolWindows.CommandWindow
    MsgBox("The command count, obtained through the parent DTE object _
    , is : " & myCmd.DTE.Commands.Count)
End Sub
using EnvDTE;
using EnvDTE80;
using System.Windows.Forms;
public void OnConnection(object application,
 ext_ConnectMode connectMode, object addInInst, ref Array custom)
{
    _applicationObject = (DTE2)application;
    _addInInstance = (AddIn)addInInst;
    CommandWindowManip(_applicationObject);
}
public void CommandWindowManip (DTE2 dte)
{
    CommandWindow myCmd;
    myCmd = _applicationObject.ToolWindows.CommandWindow;
    MessageBox.Show("The command count, obtained through the parent
 DTE object, is : " + myCmd.DTE.Commands.Count);
}

Sicurezza di .NET Framework

Vedere anche

Riferimenti

ToolWindows Interfaccia

Spazio dei nomi EnvDTE80