DebuggerEventsClass.OnContextChanged 事件
這個應用程式開發介面支援 .NET Framework 基礎結構,但您不可以直接在程式碼中使用它。
當目前處理序、程式、執行緒或堆疊已經透過使用者介面或 Automation 模型變更時便會引發。
命名空間: EnvDTE
組件: EnvDTE (在 EnvDTE.dll 中)
語法
'宣告
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 不支援事件。
實作
_dispDebuggerEvents_Event.OnContextChanged
範例
下列範例示範如何使用 OnContextChanged 事件。
若要測試這個事件:
開啟目標應用程式。
執行增益集。
觀察訊息方塊:「已附加事件」。
設定中斷點並在偵錯模式中執行目標應用程式。
當應用程式在中斷點停下,請停止偵錯工具。
觀察訊息方塊:「偵錯工具進入內容變更模式」。
// 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.");
}
.NET Framework 安全性
- 完全信任立即呼叫者。這個成員無法供部分信任的程式碼使用。如需詳細資訊,請參閱從部分受信任程式碼使用程式庫。