Breakpoints.DTE 屬性
傳回最上層擴充性物件。
命名空間: EnvDTE
組件: EnvDTE (在 EnvDTE.dll 中)
語法
'宣告
ReadOnly Property DTE As DTE
Get
DTE DTE { get; }
property DTE^ DTE {
DTE^ get ();
}
abstract DTE : DTE
function get DTE () : DTE
屬性值
型別:EnvDTE.DTE
DTE 物件。
備註
在 Visual Studio 中,DTE 物件為 Automation 模型的根物件,在其他物件模型中經常稱為「應用程式」。
範例
下列範例示範如何使用 DTE 屬性。
若要測試這個屬性:
- 開啟目標專案並執行增益集。
public static void DTE(DTE 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("DTE Property Test: ");
owp.Activate();
// dte is a reference to the DTE object passed to you by the
// OnConnection method that you implement when you create an add-in.
EnvDTE.Debugger debugger = (EnvDTE.Debugger)dte.Debugger;
debugger.Breakpoints.Add("","Target001.cs", 13, 1, "",
EnvDTE.dbgBreakpointConditionType.dbgBreakpointConditionTypeWhenTrue,
"C#","", 0, "", 0, EnvDTE.dbgHitCountType.dbgHitCountTypeNone);
debugger.Breakpoints.Add("","Target001.cs", 15, 1, "",
EnvDTE.dbgBreakpointConditionType.dbgBreakpointConditionTypeWhenTrue,
"C#","", 0, "", 0, EnvDTE.dbgHitCountType.dbgHitCountTypeNone);
owp.OutputString("\nNumber of Breakpoints: " + debugger.Breakpoints.Count);
owp.OutputString("\nEdition of the environment: " +
debugger.Breakpoints.DTE.Edition);
owp.OutputString("\nParent's Current Mode: " +
debugger.Breakpoints.Parent.CurrentMode);
owp.OutputString("\nFirst breakpoint is on line " +
debugger.Breakpoints.Item(1).FileLine + ".");
owp.OutputString("\nSecond breakpoint is on line " +
debugger.Breakpoints.Item(2).FileLine + ".");
}
Shared Sub DTE(ByRef dte As EnvDTE.DTE)
Dim str As String
dte.Debugger.Breakpoints.Add("", "Target001.cs", 13, 1, "", _
EnvDTE.dbgBreakpointConditionType.dbgBreakpointConditionTypeWhenTrue, _
"C#", "", 0, "", 0, EnvDTE.dbgHitCountType.dbgHitCountTypeNone)
dte.Debugger.Breakpoints.Add("", "Target001.cs", 15, 1, "", _
EnvDTE.dbgBreakpointConditionType.dbgBreakpointConditionTypeWhenTrue, _
"C#", "", 0, "", 0, EnvDTE.dbgHitCountType.dbgHitCountTypeNone)
str = "Number of Breakpoints: " + dte.Debugger.Breakpoints.Count.ToString() + vbCrLf
str += "Edition of the environment: " + dte.Debugger.Breakpoints.DTE.Edition + vbCrLf
str += "Parent's Current Mode: " + dte.Debugger.Breakpoints.Parent.CurrentMode.ToString() + vbCrLf
str += "First breakpoint is on line " + dte.Debugger.Breakpoints.Item(1).FileLine.ToString() + "." + vbCrLf
str += "Second breakpoint is on line " + dte.Debugger.Breakpoints.Item(2).FileLine.ToString() + "." + vbCrLf
MessageBox.Show(str, "DTE Property Test")
End Sub
.NET Framework 安全性
- 完全信任立即呼叫者。這個成員無法供部分信任的程式碼使用。如需詳細資訊,請參閱從部分受信任程式碼使用程式庫。