使用的类:

1、UserInformation.GetDisplayNameAsync() 获得用户名

 

2、UserInformation.GetFirstNameAsync() 获得名

3、UserInformation.GetLastNameAsync() 获得姓

4、 StorageFile image = UserInformation.GetAccountPicture(AccountPictureKind.SmallImage) as StorageFile; 获得用户(小)图片

5、 StorageFile image = UserInformation.GetAccountPicture(AccountPictureKind.LargeImage) as StorageFile; 获得用户(大)图片

6、修改账户的图片

        private async void SetImage_Click(object sender, RoutedEventArgs e)
        {
            FileOpenPicker imagePicker = new FileOpenPicker
            {
                ViewMode = PickerViewMode.Thumbnail,
                SuggestedStartLocation = PickerLocationId.PicturesLibrary,
                FileTypeFilter = { ".jpg", ".jpeg", ".png", ".bmp" }
            };

            StorageFile imageFile = await imagePicker.PickSingleFileAsync();
            if (imageFile != null)
            {
                SetAccountPictureResult result = await UserInformation.SetAccountPicturesAsync(null, imageFile, null);
                if (result == SetAccountPictureResult.Success)
                {
                    //
                }
                else
                {
                   //
                }
            }
        }

 

 7、修改用户视频

        private async void SetVideo_Click(object sender, RoutedEventArgs e)
        {
            FileOpenPicker videoPicker = new FileOpenPicker
            {
                ViewMode = PickerViewMode.Thumbnail,
                SuggestedStartLocation = PickerLocationId.VideosLibrary,
                FileTypeFilter = { ".mp4", ".mpeg", ".wmv", ".mov" }
            };

            StorageFile videoFile = await videoPicker.PickSingleFileAsync();
            if (videoFile != null)
            {
                SetAccountPictureResult result = await UserInformation.SetAccountPicturesAsync(null, null, videoFile);
                if (result == SetAccountPictureResult.Success)
                {
                    //
                }
                else
                {
                    //
                }
            }
        }

 

 

 

 

详细请参考msdn中的AccountPictureName的Sample。

 

 

 

 

 

相关文章:

  • 2021-06-02
  • 2021-05-30
  • 2021-12-17
  • 2022-01-23
  • 2021-09-19
  • 2022-01-06
猜你喜欢
  • 2021-10-17
  • 2022-01-02
  • 2021-07-17
  • 2021-09-08
  • 2021-10-15
  • 2021-12-22
相关资源
相似解决方案