windows 8 获取用户账号信息

using Windows.UI.Xaml.Media.Imaging;
using Windows.System.UserProfile;

 

 

string.IsNullOrEmpty(lastName) 

获取第一名称

     string firstName = await UserInformation.GetFirstNameAsync();

获取用户第二名称

    string lastName = await UserInformation.GetLastNameAsync();

获取用户

   string displayName = await UserInformation.GetDisplayNameAsync();

设置用户 头像

                FileOpenPicker imagePicker = new FileOpenPicker                

             {                 

                         ViewMode = PickerViewMode.Thumbnail,                    

                         SuggestedStartLocation = PickerLocationId.PicturesLibrary,                   

                        FileTypeFilter = { ".jpg", ".jpeg", ".png", ".bmp" }                

             };

                StorageFile imageFile = await imagePicker.PickSingleFileAsync();                

              SetAccountPictureResult result = await UserInformation.SetAccountPicturesAsync(null, imageFile, null);                    

              if (result == SetAccountPictureResult.Success)

posted on 2012-11-09 17:16  Top@Gragon  阅读(202)  评论(0编辑  收藏  举报

导航