I am trying to create an extension for visual studio with AsyncPackage
and ILanguageClient
.
I have created a DialogPage
named Config
.
When I launch my extension the page "Config" does exist but impossible to get its values from the OnLoadedAsync
I always obtain the default values.
But if I go directly to the settings InitializeAsync
is called and I got the correct values from 'Config'.
public class LanguageClient : AsyncPackage, ILanguageClient
{
public async Task<Connection> ActivateAsync(CancellationToken token)
{
...
}
public async Task OnLoadedAsync()
{
Config page = (Config)GetDialogPage(typeof(Config));//Default values....
_path = page.OptionPath;
if (_path != null && _path != "")
{
await StartAsync.InvokeAsync(this, EventArgs.Empty);
}
}
protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress<ServiceProgressData> progress)
{
.
Config page = (Config)GetDialogPage(typeof(Config)); //Good Values
await this.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);
}