Skip to content

Instantly share code, notes, and snippets.

@objectmethod
Created February 15, 2013 21:01
Show Gist options
  • Save objectmethod/4963506 to your computer and use it in GitHub Desktop.
Save objectmethod/4963506 to your computer and use it in GitHub Desktop.
private void GetAccountPicture()
{
var image = UserInformation.GetAccountPicture(AccountPictureKind.SmallImage) as StorageFile;
if (image != null)
{
try
{
IAsyncOperation<IRandomAccessStreamWithContentType> imageStream = image.OpenReadAsync();
var bitmapImage = new BitmapImage();
bitmapImage.SetSourceAsync(imageStream.GetResults());
accountPicture.Source = bitmapImage;
}
catch (Exception ex)
{
Debug.WriteLine("Error opening stream: " + ex);
}
}
else
{
Debug.WriteLine("Small Account Picture is not available");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment