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)

你可能感兴趣的:(windows)