AzureIoTHubConnectedService.AccountPickerViewModel.OnSubscriptionsChanged C# (CSharp) Method

OnSubscriptionsChanged() private method

private OnSubscriptionsChanged ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
return void
        private async void OnSubscriptionsChanged(object sender, EventArgs e)
        {
            // Bug 1136383 - When a new account is added via the AccountPicker control the AuthenticationChanged
            // event will get raised.  This triggers core connected services to invoke the grid's EnumerateServiceInstancesAsync
            // method which enumerates the subscriptions.  The issue is that sometimes CAT hasn't responded
            // the new account being added and created a mirror of the account in the IAzureAuthenticationManager.UserAccounts
            // collection.  Because of this no subscriptions will be returned for the new account.  To work around this
            // issue the AuthenticationChanged event is also raised as a result of AzureSubscriptionsChanged so
            // that core will call the grid's EnumerateServiceInstancesAsync.

            // ensure we are in sync with the current VS Account
            this.accountInitialized = false;
            Account currentVSAccount = await this.GetAccountAsync();
            Debug.Assert(AccountKey.KeyComparer.Equals(this.accountKey, currentVSAccount), "Calling GetAccountAsync with accountInitialized should have set this.accountKey");

            this.OnAuthenticationChanged();
        }