Condividi tramite


Evento DebuggerEventsClass.OnContextChanged

Questa API supporta l'infrastruttura .NET Framework e non deve essere utilizzata direttamente dal codice.

Viene generato ogni volta che il processo, il programma, il thread o lo stack corrente viene modificato tramite l'interfaccia utente o il modello di automazione.

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

Sintassi

'Dichiarazione
Public Overridable Event OnContextChanged As _dispDebuggerEvents_OnContextChangedEventHandler
public virtual event _dispDebuggerEvents_OnContextChangedEventHandler OnContextChanged
public:
virtual   event _dispDebuggerEvents_OnContextChangedEventHandler^ OnContextChanged {
    void add (_dispDebuggerEvents_OnContextChangedEventHandler^ value);
    void remove (_dispDebuggerEvents_OnContextChangedEventHandler^ value);
}
abstract OnContextChanged : IEvent<_dispDebuggerEvents_OnContextChangedEventHandler,
    EventArgs>
override OnContextChanged : IEvent<_dispDebuggerEvents_OnContextChangedEventHandler,
    EventArgs>
JScript non supporta gli eventi.

Implementa

_dispDebuggerEvents_Event.OnContextChanged

Esempi

Nell'esempio riportato di seguito viene illustrato come utilizzare l'evento OnContextChanged.

Per verificare l'evento:

  1. Aprire l'applicazione di destinazione.

  2. Eseguire il componente aggiuntivo.

    Osservare la finestra di messaggio: "Events are attached".

  3. Impostare un punto di interruzione ed eseguire l'applicazione di destinazione nella modalità di debug.

  4. Quando l'applicazione si interrompe al punto di interruzione, interrompere il debugger.

    Osservare la finestra di messaggio: "Debugger enters context changed mode".

// Place the following code in the Exec method of the add-in:
EnvDTE.DebuggerEvents debugEvents = applicationObject.Events.DebuggerEvents;
debugEvents.OnContextChanged += 
new _dispDebuggerEvents_OnContextChangedEventHandler(DebuggerEvents.ContextHandler);

// Place the following Event handler code in the add-in:
// Needed to activate event handlers in Connect.Exec.
public static void StartEvents(DTE dte)
{
    System.Windows.Forms.MessageBox.Show("Events are attached.");
}

public static void ContextHandler(EnvDTE.Process newProc, 
    EnvDTE.Program newProg, EnvDTE.Thread newThread, EnvDTE.StackFrame newStkFrame)
{
    System.Windows.Forms.MessageBox.Show("Debugger enters context changed mode.");
}

Sicurezza di .NET Framework

Vedere anche

Riferimenti

DebuggerEventsClass Classe

Spazio dei nomi EnvDTE