Quantcast
Channel: Visual Studio Integrate forum
Viewing all articles
Browse latest Browse all 4410

How to get IServiceProvider inside ToolWindowPane

$
0
0

Hi

I am trying to get the IServiceProvider inside the toolwindow. I am showing the toolwindow from ViewModel class of mine where the service provider is available to me. However I do not know how to pass the same to ToolWindowPane as it uses the parameterless constructor. I am showing the toolwindow as below

IVsUIShell service = _serviceProvider.GetService(typeof(IVsUIShell)) as IVsUIShell;

if (service != null)
{
      IVsWindowFrame winFrame;
      var guidNo = new Guid(Common.GuidList.MY_TOOLWINDOW_GUID);
      if (service.FindToolWindowEx(0x80000, ref guidNo, 0, out winFrame) >= 0 && winFrame != null)
      {
                    winFrame.Show();
      }
}

I also know that ToolWindowPane already has IServiceProvider, but with that I am not able to get the SvsStatusBar service with the following code.

var statusBar = serviceProvider.GetService(typeof(SvsStatusBar) as IVsStatusBar;

Can someone let me know what I am doing wrong or if there is some better way. So in summary I need following

1. How to pass the IServiceProvider object to ToolWindow

2. Also, How to get the IServiceProvider inside ToolWindow


Viewing all articles
Browse latest Browse all 4410

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>