private async void InjectAccountPickerAsync() { IVsAccountManagementService vsAccountManagementService = ServiceProvider.GlobalProvider.GetService(typeof(SVsAccountManagementService)) as IVsAccountManagementService; if (vsAccountManagementService == null) { return; } AccountPickerOptions options = new AccountPickerOptions(Window.GetWindow(this), "VS Azure Tooling") { IsCompactHeight = false, UseWindowsPresentationFoundationStyle = false, IsAuthenticationStateUIEnabled = true }; EnsureRMAuthenticationManager(); _accountPicker = await vsAccountManagementService.CreateWpfAccountPickerAsync(options); AccountPickerHostControl.Content = _accountPicker.Control; _accountPicker.PropertyChanged += OnAccountPickerPropertyChanged; _accountPicker.SelectedAccount = await AzureAuthenticationManager.GetCurrentVSAccountAsync(); UpdateSettings(); }
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; } }