Proprietà Macros.DTE
Ottiene l'oggetto estensibilità di primo livello.
Spazio dei nomi: EnvDTE
Assembly: EnvDTE (in EnvDTE.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
public void CodeExample(DTE2 dte, AddIn addin)
{
// INSTRUCTIONS: Run this code, open a solution, start
// recording a macro, then connect the addin containing this code.
try
{
Macros mac = dte.Macros;
if (mac.IsRecording)
{
mac.Pause();
if (!mac.IsRecording)
mac.Resume();
mac.EmitMacroCode("rem Code added by the EmitMacroCode method");
// Demonstrate these two properties return the same reference.
bool test = mac.DTE.Equals(mac.Parent);
if (test) MessageBox.Show("The DTE and Parent property refer to the same object.");
else MessageBox.Show("The DTE and Parent property do not refer to the same object.");
}
else MessageBox.Show("Start a macro recording session and reconnect addin");
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
}
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