Freigeben über


Breakpoint2.Enabled-Eigenschaft

Legt den aktivierten Zustand des Haltepunkts fest bzw. gibt ihn zurück.

Namespace:  EnvDTE80
Assembly:  EnvDTE80 (in EnvDTE80.dll)

Syntax

'Declaration
Property Enabled As Boolean
    Get
    Set
bool Enabled { get; set; }
property bool Enabled {
    bool get ();
    void set (bool value);
}
abstract Enabled : bool with get, set
function get Enabled () : boolean
function set Enabled (value : boolean)

Eigenschaftswert

Typ: System.Boolean
Ein boolescher Wert, der true ist, wenn der Haltepunkt aktiviert ist; andernfalls false.

Implementiert

Breakpoint.Enabled

Beispiele

Im folgenden Beispiel wird veranschaulicht, wie die Enabled-Eigenschaft verwendet wird.

So testen Sie diese Eigenschaft

  1. Legen Sie einen Haltepunkt in der Zielanwendung fest.

  2. Führen Sie das Add-In aus.

    Der Haltepunktzustand ist aktiviert.

  3. Deaktivieren Sie den Haltepunkt, indem Sie mit der rechten Maustaste klicken.

  4. Führen Sie das Add-In aus.

    Der Haltepunktzustand ist deaktiviert.

public static void Enabled(EnvDTE80.DTE2 dte)
{
    // Setup debug Output window.
    Window w = (Window)dte.Windows.Item(EnvDTE.Constants.vsWindowKindOutput);
    w.Visible = true;
    OutputWindow ow = (OutputWindow)w.Object;
    OutputWindowPane owp = ow.OutputWindowPanes.Add("Enabled property: ");
    owp.Activate();

    // dte is a reference to the DTE2 object passed to you by the
    // OnConnection method that you implement when you create an Add-in.
    EnvDTE80.Debugger2 debugger = (EnvDTE80.Debugger2)dte.Debugger;
    owp.OutputString("Breakpoint in the file " + debugger.Breakpoints.Item(1).File);
    owp.OutputString(" on line " +
                     debugger.Breakpoints.Item(1).FileLine.ToString() + " column ");
    owp.OutputString(debugger.Breakpoints.Item(1).FileColumn.ToString() + " is ");
    owp.OutputString(debugger.Breakpoints.Item(1).Enabled ? "enabled." : "disabled.");
    owp.OutputString("\nThis breakpoint is in the function: " +
                     debugger.Breakpoints.Item(1).FunctionName);
}
Sub EnabledSamplesVB(ByVal dte As DTE2)

    If MsgBox("Disable all breakpoints?", MsgBoxStyle.YesNo) _
        = MsgBoxResult.Yes Then
        Dim bp As Breakpoint
        For Each bp In dte.Debugger.Breakpoints
            bp.Enabled = False
        Next
    End If

End Sub

.NET Framework-Sicherheit

Siehe auch

Referenz

Breakpoint2 Schnittstelle

Enabled-Überladung

EnvDTE80-Namespace

Weitere Ressourcen

Gewusst wie: Kompilieren und Ausführen der Codebeispiele für das Automatisierungsobjektmodell