Proprietà Windows2.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
function get DTE () : DTE
Valore proprietà
Tipo: EnvDTE.DTE
In DTE oggetto.
Note
in Visual Studio, DTE l'oggetto è la radice del modello di automazione, che altri modelli a oggetti spesso chiamano “applicazione„.
Esempi
In questo esempio viene eseguito l'accesso a DTE oggetto con un oggetto Windows2 oggetto per visualizzare il nome dell'IDE.
Per ulteriori informazioni su come eseguire questo esempio viene illustrato 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)
ReachDTE(_applicationObject)
End Sub
Sub ReachDTE(ByVal dte As DTE2)
Dim win As Windows2
win = CType(_applicationObject.Windows, EnvDTE80.Windows2)
MsgBox("The DTE name, reached through the Window2 object, is: " _
& vbCr & win.DTE.Name)
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;
ReachDTE(_applicationObject);
}
public void ReachDTE(DTE2 dte)
{
Windows2 win;
win = (EnvDTE80.Windows2)_applicationObject.Windows;
MessageBox.Show("The DTE name, reached through the Window2 object,
is: " + "\n" + win.DTE.Name);
}
Sicurezza di .NET Framework
- Attendibilità totale per il chiamante immediato. Impossibile utilizzare questo membro in codice parzialmente attendibile. Per ulteriori informazioni, vedere Utilizzo di librerie da codice parzialmente attendibile.
Vedere anche
Riferimenti
Altre risorse
Procedura: compilare ed eseguire gli esempi di codice del modello a oggetti di automazione