Condividi tramite


Proprietà Command.DTE

Ottiene l'oggetto di estensibilità di primo livello.

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

Sintassi

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

Valore proprietà

Tipo: EnvDTE.DTE
Un oggetto DTE.

Note

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

Esempi

public void CodeExample(DTE2 dte, AddIn addin)
{
    try
    {
        // Show number of commands in Commands collection.
        MessageBox.Show(dte.Commands.Count.ToString());
        // Return the Commands collection for the application.
        Commands cmdsColl = dte.Commands;
        // Return a Command object.
        Command cmdObj = cmdsColl.Item("File.NewFile", cmdsColl.Count);
        // Show the full name of Command object's application object.
        MessageBox.Show(cmdObj.DTE.FullName);
        // Display the Command object's name.
        MessageBox.Show(cmdObj.Name);
        // Display whether the Command object's containing collection
        // is the same as the application object's Commands collection.
        string message;
        if (cmdsColl.Equals(cmdObj.Collection))
            message = "Same collection!";
        else
            message = "Different collection!";
        MessageBox.Show(message);
    }
    catch(Exception ex)
    {
        MessageBox.Show(ex.Message);
    }
}

Sicurezza di .NET Framework

Vedere anche

Riferimenti

Command Interfaccia

Spazio dei nomi EnvDTE

Altre risorse

Procedura: compilare ed eseguire gli esempi di codice del modello a oggetti di automazione