Code's like below, similar to the built-in Custom Tool Window code template. To load the package I have to find the ToolWindow button (Command) and press it. When I open up a folder this package is not loaded. However this extension depends on evnets provided by some services (IVsFileChangeEx, .etc), and they needed to be loaded by AsyncPackage.GetServiceAsync. What should I do?
[PackageRegistration(UseManagedResourcesOnly = true, AllowsBackgroundLoading = true)]
[Guid(Guids.packageGuidStr)]
[ProvideMenuResource("Menus.ctmenu", 1)]
[ProvideToolWindow(typeof(ToolWindow))]
public sealed class ExuedPackage : AsyncPackage
{
protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress<ServiceProgressData> progress)
{
await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);
"Init Package".Log();
.... Get some services and store them ...
.... Register callbacks to them ....
await ToolWindowCommand.InitializeAsync(this);
}
}