Partager via


Breakpoint2.Enabled, propriété

Définit ou retourne l'état activé du point d'arrêt.

Espace de noms :  EnvDTE80
Assembly :  EnvDTE80 (dans EnvDTE80.dll)

Syntaxe

'Déclaration
Property Enabled As Boolean
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)

Valeur de propriété

Type : Boolean
Valeur booléenne qui est true si le point d'arrêt est activé, sinon false.

Exemples

L'exemple suivant illustre l'utilisation de la propriété Enabled.

Pour tester cette propriété :

  1. Définissez un point d'arrêt dans l'application cible.

  2. Exécutez le complément.

    L'état du point d'arrêt est activé.

  3. Désactivez le point d'arrêt à l'aide d'un clic avec le bouton droit de la souris.

  4. Exécutez le complément.

    L'état du point d'arrêt est désactivé.

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

Sécurité .NET Framework

Voir aussi

Référence

Breakpoint2 Interface

EnvDTE80, espace de noms

Autres ressources

Comment : compiler et exécuter les exemples de code du modèle objet Automation