private async void AccountPickerHost_Loaded(object sender, RoutedEventArgs e)
{
if (this.picker == null)
{
IVsAccountManagementService accountManagementService = Package.GetGlobalService(typeof(SVsAccountManagementService)) as IVsAccountManagementService;
if (accountManagementService == null)
{
Debug.Fail("Could not retrieve an IVsAccountManagementService.");
return;
}
AccountPickerOptions accountPickerOptions = new AccountPickerOptions(
Window.GetWindow(this),
this.viewModel.HostId);
this.picker = await accountManagementService.CreateWpfAccountPickerAsync(accountPickerOptions);
this.picker.SelectedAccount = await this.viewModel.GetAccountAsync();
this.picker.PropertyChanged += this.Picker_PropertyChanged;
this.AccountPickerHost.Content = this.picker.Control;
}
}