[英]How to display custom tool window at the first position, programmatically in visual studio
[英]How to adress/ call my custom tool window in Visual Studio
但是我找不到任何方法來填充它,因為我找不到引用它的方法。
我檢查了您在上面共享的 totorial 鏈接並找到了這個文檔: Writing A Custom Debugger Visualizer using WPF for the UI 。 So it seems that we can combine the Debugger Visualizer with WPF, and since the custom Tool window Item has similar functions like WPF UI, I think we can fill the logic into that xx.xaml and xx.xaml.cs files, see:
基本上,我們可以用我們可能在Debugger Vusualizer+WPF
中使用的邏輯來填充這兩個文件。 要調用一個自定義工具窗口,我們可以單擊相關命令(按鈕)或使用代碼打開自定義工具 window。 類似於這個問題的東西:
ToolWindowPane window = this.FindToolWindow(typeof(MyToolWindow), 0, true);
if ((null == window) || (null == window.Frame))
{
throw new NotSupportedException(Resources.CanNotCreateWindow);
}
IVsWindowFrame windowFrame = (IVsWindowFrame)window.Frame;
Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(windowFrame.Show());
我不確定您為什么需要以編程方式調用自定義 window,根據教程,我想您只需要View=>Windows
中的一個按鈕 ...希望它有所幫助,如果我有什么誤解,請隨時糾正我:)
我試圖想象我掙扎的地方。
編輯:取得了進展:
當一個在 vsix 擴展 package 內部時,可以通過查詢 dte object
using EnvDTE;
using EnvDTE80;
using System.ComponentModel.Composition;
DTE2 dte = (DTE2)ServiceProvider.GlobalProvider.GetService(typeof(DTE));
有了這個,可以訪問保存各種信息的調試器,例如在這種情況下它保存當前活動的字段等等。
因此,這是將數據從運行時傳輸到 ToolWindow 的方法。 問題是如何將 DebugVisualizer 帶入等式,因為它不是 package 的一部分,因此無法調用 dte。 但我很在意。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.