Proprietà EditPoint2.DTE

Restituisce 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

Sub DTEExample(ByVal dte As DTE2)

    Dim msg As String = _
        "The current Output Window object belongs to the "
    Dim output As OutputWindow = dte.ToolWindows.OutputWindow

    If IsMacrosIDE(output.DTE) Then
        MsgBox(msg & "macros IDE.")
    Else
        MsgBox(msg & "main IDE.")
    End If

    output = CType(dte.MacrosIDE, DTE2).ToolWindows.OutputWindow

    If IsMacrosIDE(output.DTE) Then
        MsgBox(msg & "macros IDE.")
    Else
        MsgBox(msg & "main IDE.")
    End If

End Sub

Function IsMacrosIDE(ByVal ide As DTE) As Boolean

    Dim val As Boolean = True

    Try
        ' The MacrosIDE property will throw an exception if ide 
        ' is not the main DTE object.
        If IsNothing(ide.MacrosIDE) = False Then
            val = False
        End If

    Catch ex As Exception
    End Try

    Return val

End Function
public void DTEExample(DTE2 dte)
{
    string msg = "The current Output Window object belongs to the ";
    OutputWindow output = dte.ToolWindows.OutputWindow;

    if (IsMacrosIDE(output.DTE))
        MessageBox.Show(msg + "macros IDE.");
    else
        MessageBox.Show(msg + "main IDE.");

    output = ((DTE2)dte.MacrosIDE).ToolWindows.OutputWindow;

    if (IsMacrosIDE(output.DTE))
        MessageBox.Show(msg + "macros IDE.");
    else
        MessageBox.Show(msg + "main IDE.");
}

bool IsMacrosIDE(DTE ide)
{
    bool val = true;

    try
    {
        // The MacrosIDE property will throw an exception if ide 
        // is not the main DTE object.
        if (ide.MacrosIDE != null)
            val = false;
    }
    catch (Exception ex)
    {
    }

    return val;
}

Sicurezza di .NET Framework

Vedere anche

Riferimenti

EditPoint2 Interfaccia

Overload DTE

Spazio dei nomi EnvDTE80

Altre risorse

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