1

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.

2 Answers2

1

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 e.g. 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.

  • Hi friend, thanks for your sharing and please mark your reply as [self answer](https://stackoverflow.com/help/self-answer) and that will help other community members who easier search this useful information, it just a reminder :) – LoLance Oct 22 '19 at 08:15
0

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:

enter image description here

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 :)

LoLance
  • 25,666
  • 1
  • 39
  • 73
  • thank you for the reply! You are correct in what you wrote. You asked why I need to call it programatically: I do not have *to call* it programatically, but I have to somehow fill it with content from my application which I want to visualize. E.g. a polygon. So somehow I need to reference the ToolWindows viewModel to fill in said polygon to visualize it. E.g. I know that every window has a unique GUID, but I do not know how to use it to find the window. – Manuel Blattner Oct 21 '19 at 09:28