AzureIoTHubConnectedService.AccountPicker.AccountPickerHost_Loaded C# (CSharp) Method

AccountPickerHost_Loaded() private method

private AccountPickerHost_Loaded ( object sender, RoutedEventArgs e ) : void
sender object
e System.Windows.RoutedEventArgs
return void
        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;
            }
        }