简体   繁体   中英

How to adress/ call my custom tool window in Visual Studio

Through this simple MSDN tutorial I build my own CustomToolWindow. But I cannot find any way to fill it with something because I cannot find a way to reference it.

The goal is to combine it with this tutorial with which I was able to build a CustomDebuggerVisualizer. Meaning I would like my CustomDebuggerVisualizer to show up as content of my CustomToolWindow.

I know if this method , but I cannot reference it either and I think you cannot call it from outside of an Extension itself.

It seems to me that I do not have a grasp on the "runtime world" I am accustomed to, and the "visual studio extension/SDK" World here.

But I cannot find any way to fill it with something because I cannot find a way to reference it.

I checked that totorial link you shared above and find this document: 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:

在此处输入图像描述

Basically, we could fill these two files with the logic we may use in Debugger Vusualizer+WPF . And to call one custom toolwindow, we can either click the related command(button) or use code to open custom tool window. Something similar to this issue :

            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());

I'm not sure why you need to programatically call the custom window,according to the toturial, I guess you only need a button in View=>Windows ... Hope it makes some help, and if I misunderstand anything, feel free to correct me:)

I tried to visualize the point where I struggle.

Visualization

edit: Progress was made:

When one is inside a vsix extension package, one can query the dte object through

using EnvDTE;
using EnvDTE80;  
using System.ComponentModel.Composition; 

DTE2 dte = (DTE2)ServiceProvider.GlobalProvider.GetService(typeof(DTE));

With this, the debugger can be accessed which holds all kinds of information eg in this case it holds the currently active fields and so on.

Therefore this is the mean to transfer data from the runtime to the ToolWindow. Problem is how to bring the DebugVisualizer into the equation, as it is not part of a package and therefore no call to dte is possible. But I'm onto it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM