Metro style App AccountPicture Summary

简介:

使用的类:

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。

 



本文转自Work Hard Work Smart博客园博客,原文链接:http://www.cnblogs.com/linlf03/archive/2012/08/06/2625255.html,如需转载请自行联系原作者

目录
相关文章
|
2月前
|
人工智能 文字识别 小程序
旅游社用什么工具收报名 + 资料?不开发 App 也能自动收集信息
本文探讨了旅游行业中报名信息收集的常见痛点及解决方案,重点介绍了二维码表单工具在提升信息收集效率、简化操作流程方面的优势。通过对比多种工具,分析其适用场景与实际应用逻辑,为一线旅游从业者提供高效、低成本的执行参考。
|
3月前
|
容器
HarmonyOS NEXT仓颉开发语言实战案例:外卖App
仓颉语言实战分享,教你如何用仓颉开发外卖App界面。内容包括页面布局、导航栏自定义、搜索框实现、列表模块构建等,附完整代码示例。轻松掌握Scroll、List等组件使用技巧,提升HarmonyOS应用开发能力。

热门文章

最新文章