Ejemplo n.º 1
0
 /// <summary>
 /// 加载活动参与者
 /// </summary>
 private void LoadActivityParticipators()
 {
     AsyncHandler.CallFuncWithUI(System.Windows.Application.Current.Dispatcher,
                                 () =>
     {
         var errCode = 0;
         var errMsg  = string.Empty;
         AntSdkGetGroupActivityParticipatorInput participatorInput =
             new AntSdkGetGroupActivityParticipatorInput
         {
             groupId    = _groupId,
             activityId = _activityId,
             pageNum    = pageNum,
             pageSize   = pageSize
         };
         try
         {
             return(AntSdkService.GetGroupActivityParticipators(participatorInput, ref errCode,
                                                                ref errMsg));
         }
         catch (Exception ex)
         {
             LogHelper.WriteError("活动参与者接口异常:" + ex.Message + ex.Source +
                                  ex.StackTrace);
             return(null);
         }
     },
                                 (ex, datas) =>
     {
         if (datas == null)
         {
             return;
         }
         if (datas.list.Count > 0)
         {
             ActivityParticipators.Clear();
             foreach (var participatorInfo in datas.list)
             {
                 AntSdkContact_User contactUser =
                     AntSdkService.AntSdkListContactsEntity.users.Find(
                         c => c.userId == participatorInfo.userId);
                 var activityParticipatorInfo = new ActivityParticipator();
                 if (contactUser != null)
                 {
                     activityParticipatorInfo.ParticipatorId   = contactUser.userId;
                     activityParticipatorInfo.ParticipatorName = contactUser.userNum + contactUser.userName;
                     if (!string.IsNullOrWhiteSpace(contactUser.picture) &&
                         publicMethod.IsUrlRegex(contactUser.picture))
                     {
                         var userImage = GlobalVariable.ContactHeadImage.UserHeadImages.FirstOrDefault(
                             m => m.UserID == contactUser.userId);
                         activityParticipatorInfo.ParticipatorHeadPic = string.IsNullOrEmpty(userImage?.Url)
                                 ? contactUser.picture
                                 : userImage.Url;
                     }
                     else
                     {
                         activityParticipatorInfo.ParticipatorHeadPic =
                             GlobalVariable.DefaultImage.UserHeadDefaultImage;
                     }
                 }
                 else
                 {
                     activityParticipatorInfo.ParticipatorId      = participatorInfo.userId;
                     activityParticipatorInfo.ParticipatorHeadPic =
                         !string.IsNullOrEmpty(participatorInfo.picture)
                                 ? participatorInfo.picture
                                 : GlobalVariable.DefaultImage.UserHeadDefaultImage;
                     activityParticipatorInfo.ParticipatorName = participatorInfo.userNum +
                                                                 participatorInfo.userName;
                 }
                 ActivityParticipators.Add(activityParticipatorInfo);
             }
             ParticipatorsCount = ActivityParticipators.Count;
         }
     });
 }