Beispiel #1
0
        private async Task <UserInfo> TryGetUserInfoAsync(IActivatedEventArgsWithUser argsWithUser)
        {
            if (argsWithUser != null)
            {
                var user     = argsWithUser.User;
                var userInfo = new UserInfo
                {
                    AccountName = await user.GetPropertyAsync(KnownUserProperties.AccountName) as String,
                    FirstName   = await user.GetPropertyAsync(KnownUserProperties.FirstName) as String,
                    LastName    = await user.GetPropertyAsync(KnownUserProperties.LastName) as String
                };
                if (!userInfo.IsEmpty)
                {
                    if (String.IsNullOrEmpty(userInfo.AccountName))
                    {
                        userInfo.AccountName = $"{userInfo.FirstName} {userInfo.LastName}";
                    }
                    var pictureStream = await user.GetPictureAsync(UserPictureSize.Size64x64);

                    if (pictureStream != null)
                    {
                        userInfo.PictureSource = await BitmapTools.LoadBitmapAsync(pictureStream);
                    }
                    return(userInfo);
                }
            }
            return(UserInfo.Default);
        }
Beispiel #2
0
 private async Task <UserInfoModel> TryGetUserInfoAsync(IActivatedEventArgsWithUser argsWithUser)
 {
     if (argsWithUser != null)
     {
         var user     = argsWithUser.User;
         var userInfo = new UserInfoModel
         {
             UserName  = await user.GetPropertyAsync(KnownUserProperties.AccountName) as String,
             loginName = await user.GetPropertyAsync(KnownUserProperties.FirstName) as String
         };
         if (!userInfo.IsEmpty)
         {
             return(userInfo);
         }
     }
     return(null);
 }
 private async Task <UserInfo> TryGetUserInfoAsync(IActivatedEventArgsWithUser argsWithUser)
 {
     if (argsWithUser != null)
     {
         var user     = argsWithUser.User;
         var userInfo = new UserInfo
         {
             AccountName = await user.GetPropertyAsync(KnownUserProperties.AccountName) as String,
             FirstName   = await user.GetPropertyAsync(KnownUserProperties.FirstName) as String,
             LastName    = await user.GetPropertyAsync(KnownUserProperties.LastName) as String
         };
         if (!userInfo.IsEmpty)
         {
             if (String.IsNullOrEmpty(userInfo.AccountName))
             {
                 userInfo.AccountName = $"{userInfo.FirstName} {userInfo.LastName}";
             }
         }
     }
     return(UserInfo.Default);
 }