Grazie alla classe UserInformation, presente nel namespace Windows.System.UserProfile, possiamo recuperare alcune informazioni dell'account usato dall'utente, come il nome e la sua foto di profilo.
var data = new StringBuilder(); data.AppendLine(await UserInformation.GetDisplayNameAsync()); data.AppendLine(await UserInformation.GetFirstNameAsync()); data.AppendLine(await UserInformation.GetLastNameAsync()); UserData.Text = data.ToString(); var kind = AccountPictureKind.LargeImage; IRandomAccessStream imageStream = await UserInformation.GetAccountPicture(kind).OpenReadAsync(); var UserBmp = new BitmapImage(); UserBmp.SetSource(imageStream); UserImage.Source = UserBmp;
Con il metodo GetAccountPicture recuperiamo lo stream dell'immagine delle dimensioni specificate con un valore dell'enum AccountPictureKind.




Commenti
Accedi per commentare
Per partecipare alla conversazione, accedi o crea un account gratuito.