private async void GetUserProfileBtn_Click(object sender, RoutedEventArgs e) { var controller = new GravatarController(); var profileResult = await controller.GetProfile(InputTextBox.Text); if (profileResult.Profile != null) { Image.Source = new BitmapImage(new Uri(GravatarController.GetImageUrl(InputTextBox.Text, (int)Image.Width))); IdTextBox.Text = profileResult.Profile.Id; HashTextBox.Text = profileResult.Profile.Hash; FullNameTextBox.Text = profileResult.Profile.FullName; UsernameTextBox.Text = profileResult.Profile.UserName; } else { MessageBox.Show(this, profileResult.ErrorMessage, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }
public static async Task UpdataAllClaims(ApplicationUser user, UserManager <ApplicationUser> userManager, SignInManager <ApplicationUser> signInManager, bool forceRefresh = false) { var shouldUpdate = false; var claims = await userManager.GetClaimsAsync(user); shouldUpdate = await UpdateClaims(user, userManager, claims, ClaimTypes.GivenName, user.FullName ?? user.UserName); shouldUpdate = await UpdateClaims(user, userManager, claims, ClaimTypes.UserData, GravatarController.GetImageUrl(user.Email ?? user.UserName)) && shouldUpdate; if (shouldUpdate || forceRefresh) { await signInManager.RefreshSignInAsync(user); } }