zoukankan      html  css  js  c++  java
  • 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/
    欢迎任何形式的转载,未经作者同意,请保留此段声明!

  • 相关阅读:
    Sql语句创建表
    刷新、关闭等误操作造成当前页面信息的丢失的解决方案
    asp.net文本框中只允许用户输入数字
    为每个用户创建文件夹,并实现图片上传
    在updatepanel中使用fileupload控件
    解决弹出提示框后字体变大的BUG
    SQL 2005新增的几个函数之学习
    .net实现单张图片的上传
    数据分页
    所谓三门问题
  • 原文地址:https://www.cnblogs.com/linlf03/p/2625255.html
Copyright © 2011-2022 走看看