-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature - Tool window injection #14
Comments
Usage tested against local nuget feed built from fork https://github.com/tonyhallett/Community.VisualStudio.Toolkit.DependencyInjection |
Alternative
Add to
In InitializeAsync Community.VisualStudio.Toolkit.DependencyInjection/src/Core/Shared/DIToolkitPackage.cs Line 26 in 639e834
|
Reflection is another, lesser, alternative
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The Community Toolkit works as follows
Uses reflection to invoke the static Initialize method of
BaseToolWindow<T>
types.https://github.com/VsixCommunity/Community.VisualStudio.Toolkit/blob/5071b7e871e5ad3c585c858e35692f8debdb28f9/src/toolkit/Community.VisualStudio.Toolkit.Shared/ExtensionMethods/AsyncPackageExtensions.cs#L76
Which adds them ( as the internal IToolWindowProvider interface ) with the internal package AddToolWindow method.
https://github.com/VsixCommunity/Community.VisualStudio.Toolkit/blob/5071b7e871e5ad3c585c858e35692f8debdb28f9/src/toolkit/Community.VisualStudio.Toolkit.Shared/Windows/BaseToolWindow.cs#L70
https://github.com/VsixCommunity/Community.VisualStudio.Toolkit/blob/5071b7e871e5ad3c585c858e35692f8debdb28f9/src/toolkit/Community.VisualStudio.Toolkit.Shared/ToolkitPackage.cs#L19
You could reinvent all of the code of the base ToolkitPackage or...
Create a proxy derivation that used a public IToolWindowProvider obtained from the service provider.
Usage
We need to get to the specific service provider from the BaseDIToolWindowRegistration constructor. As mentioned in #13 the only current method, using the Vs service added DIToolkitPackage InitailizeAsync, is broken. The code above uses the quick and dirty workaround suggested in the issue.
The text was updated successfully, but these errors were encountered: