zoukankan      html  css  js  c++  java
  • 01、获取计算机用户的信息

     引用命名空间: using Windows.System.UserProfile; 

    1、获取用户头像信息:

      

                // The small picture returned by GetAccountPicture() is 96x96 pixels in size.
                StorageFile image = UserInformation.GetAccountPicture(AccountPictureKind.SmallImage) as StorageFile;
                if (image != null)
                {
    try
                    {
                        IRandomAccessStream imageStream = await image.OpenReadAsync();
                        BitmapImage bitmapImage = new BitmapImage();
                        bitmapImage.SetSource(imageStream);
                        smallImage.Source = bitmapImage;
                    }
                    catch (Exception ex)
                    {
                        
    } }

     获取大头像只需把第一句改为:

      // The large picture returned by GetAccountPicture() is 448x448 pixels in size.
      StorageFile image = UserInformation.GetAccountPicture(AccountPictureKind.LargeImage) as StorageFile;

    获取用户的 mp4 用户视频:

    // The video returned from getAccountPicture is 448x448 pixels in size.
                StorageFile video = UserInformation.GetAccountPicture(AccountPictureKind.Video) as StorageFile;
                if (video != null)
                {
    try
                    {
                        IRandomAccessStream videoStream = await video.OpenAsync(FileAccessMode.Read);
    
                        mediaPlayer.SetSource(videoStream, "video/mp4");
                        mediaPlayer.Visibility = Visibility.Visible;
                    }
                    catch (Exception ex)
                    {
                       
    } }

     2、获取当前用户名:

     string displayName = await UserInformation.GetDisplayNameAsync();

    用户的 FirstName:

     string firstName = await UserInformation.GetFirstNameAsync();

    用户的 LastName:

     string lastName = await UserInformation.GetLastNameAsync();
  • 相关阅读:
    游戏修改器编写原理
    欲练 CSS ,必先宫 IE
    HTML结构化:CSS布局入门指南
    用css来定义table的样式
    HTML表格无空隙嵌套方法
    CSS布局学习笔记
    绽放最后的一丝美丽
    这种感觉真爽
    诗人,是否还有生存的空间
    提升人气的秘密武器
  • 原文地址:https://www.cnblogs.com/hebeiDGL/p/2684658.html
Copyright © 2011-2022 走看看