Ejemplo n.º 1
0
 public GroupEditWindowViewModel(Action close, List <string> memberIds, AntSdkGroupInfo groupInfo)
 {
     IsCreateGroup     = false;
     Title             = "邀请加入讨论组";
     this.GroupInfo    = groupInfo;
     OriginalMemberIds = memberIds;
     this.close        = close;
     ContactInfoViewModel.StateImageClickEvent += StateImageClickEvent;
     ContactListViewModel = new ContactListViewModel(GlobalVariable.ContactInfoViewContainer.GroupEditWindowViewLeft, this);
     LeftPartViewModel    = ContactListViewModel;
     foreach (string memberId in memberIds)
     {
         AntSdkContact_User user = AntSdkService.AntSdkListContactsEntity.users.Find(c => c.userId == memberId);
         if (user == null)//离职人员信息
         {
             user          = new AntSdkContact_User();
             user.picture  = "pack://application:,,,/AntennaChat;Component/Images/离职人员.png";
             user.userName = "******";
             user.userId   = memberId;
         }
         ContactInfoViewModel myselfVM = new ContactInfoViewModel(user, GlobalVariable.ContactInfoViewContainer.GroupEditWindowViewRight);
         if (myselfVM == null)
         {
             continue;
         }
         myselfVM.StateImageVisibility = Visibility.Collapsed;
         GroupMemberList.Add(myselfVM);
     }
     MemberCount = string.Format("已选择{0}个联系人", _GroupMemberList.Count());
     //GroupName = groupInfo.groupName;
     GroupNameWateMark   = groupInfo.groupName;
     GroupNameIsReadOnly = true;
 }
Ejemplo n.º 2
0
 public ContactInfoViewModel(AntSdkContact_User user, GlobalVariable.ContactInfoViewContainer container)
 {
     //if (!string.IsNullOrWhiteSpace(user?.picture))
     //{
     //    this.Photo = user.picture;
     //}
     //else
     //{
     //    this.Photo = "pack://application:,,,/AntennaChat;Component/Images/27-头像.png";
     //}
     this.Name     = user?.userNum + user?.userName;
     this.Position = user?.position;
     if (user == null)
     {
         user = new AntSdkContact_User();
     }
     this.User      = user;
     this.Container = container;
     if (container == GlobalVariable.ContactInfoViewContainer.GroupEditWindowViewLeft || Container == GlobalVariable.ContactInfoViewContainer.MultiContactsSelectLeft)
     {
         StateImageVisibility  = Visibility.Visible;
         StateImageSource      = "pack://application:,,,/AntennaChat;Component/Images/默认.png";
         ContextMenuVisibility = Visibility.Collapsed;
     }
     else if (container == GlobalVariable.ContactInfoViewContainer.GroupEditWindowViewRight || Container == GlobalVariable.ContactInfoViewContainer.MultiContactsSelectRight)
     {
         StateImageVisibility  = Visibility.Visible;
         StateImageSource      = "pack://application:,,,/AntennaChat;Component/Images/人员删除-1.png";
         ContextMenuVisibility = Visibility.Collapsed;
     }
     else
     {
         StateImageVisibility  = Visibility.Collapsed;
         ContextMenuVisibility = Visibility.Visible;
     }
     if (user.userId == AntSdkService.AntSdkLoginOutput.userId)
     {
         SendMsgVisibility = Visibility.Collapsed;
     }
     //if (!string.IsNullOrEmpty(user.state))
     //{
     //    var state = int.Parse(user.state);
     if (AntSdkService.AntSdkCurrentUserInfo.robotId == user.userId)
     {
         user.state = (int)GlobalVariable.OnLineStatus.OnLine;
     }
     if (!AntSdkService.AntSdkIsConnected)
     {
         UserOnlineStateIcon = "";
     }
     else if (user.state != (int)GlobalVariable.OnLineStatus.OffLine)
     {
         if (GlobalVariable.UserOnlineSataeInfo.UserOnlineStateMinIconDic.ContainsKey(user.state))
         {
             UserOnlineStateIcon = GlobalVariable.UserOnlineSataeInfo.UserOnlineStateMinIconDic[user.state];
         }
     }
     //}
     SetContactPhoto();
 }
Ejemplo n.º 3
0
 public RequestViewModel(Action close, AntSdkContact_User user, long modelId)
 {
     _close      = close;
     ModelId     = modelId;
     _targetUser = user;
     Title       = $"{_targetUser.userName}向您发送了一个语音电话请求...";
 }
Ejemplo n.º 4
0
        public ContactInfoView(AntSdkContact_User user, GlobalVariable.ContactInfoViewContainer container)
        {
            InitializeComponent();
            ContactInfoViewModel model = new ContactInfoViewModel(user, container);

            DataContext = model;
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 获取获取对应群员信息
        /// </summary>
        /// <param name="GroupMembers"></param>
        /// <returns></returns>
        public static AntSdkGroupMember getGroupMembersUser(List <AntSdkGroupMember> GroupMembers, SDK.AntSdk.AntModels.AntSdkChatMsg.ChatBase msg)
        {
            string pathImages = "";
            //获取接收者头像
            var listUser = GlobalVariable.ContactHeadImage.UserHeadImages.SingleOrDefault(m => m.UserID == msg.sendUserId);
            //var users = GroupMembers != null && GroupMembers.Count > 0 ? GroupMembers.SingleOrDefault(m => m.userId == msg.sendUserId) : null;
            var users = new AntSdkGroupMember();
            //if (users == null)
            //{
            AntSdkContact_User cuss = AntSdkService.AntSdkListContactsEntity.users.SingleOrDefault(m => m.userId == msg.sendUserId);

            if (cuss == null)
            {
                users          = new AntSdkGroupMember();
                pathImages     = "file:///" + (AppDomain.CurrentDomain.BaseDirectory + "Images/离职人员.png").Replace(@"\", @"/").Replace(" ", "%20");
                users.picture  = pathImages;
                users.userId   = msg.sendUserId;
                users.userName = "******";
            }
            else
            {
                users = new AntSdkGroupMember
                {
                    userId   = cuss.userId,
                    userName = cuss.status == 0 && cuss.state == 0 ? cuss.userName + "(停用)":cuss.userName,
                    userNum  = cuss.userNum,
                    picture  = cuss.picture,
                    position = cuss.position
                };
            }
            //}
            return(users);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 获取群聊个人头像
        /// </summary>
        /// <param name="GroupMembers"></param>
        /// <param name="msg"></param>
        /// <returns></returns>
        public static string getPathImage(List <AntSdkGroupMember> GroupMembers, SDK.AntSdk.AntModels.AntSdkChatMsg.ChatBase msg)
        {
            //获取接收者头像
            string pathImages = "";
            //获取接收者头像
            var listUser            = GlobalVariable.ContactHeadImage.UserHeadImages.SingleOrDefault(m => m.UserID == msg.sendUserId);
            AntSdkGroupMember users = GroupMembers != null && GroupMembers.Count > 0 ? GroupMembers.SingleOrDefault(m => m.userId == msg.sendUserId) : null;

            if (listUser == null)
            {
                if (users == null)
                {
                    AntSdkContact_User cuss = AntSdkService.AntSdkListContactsEntity.users.SingleOrDefault(m => m.userId == msg.sendUserId);
                    if (cuss == null)
                    {
                        //users = new AntSdkGroupMember();
                        pathImages = "file:///" + (AppDomain.CurrentDomain.BaseDirectory + "Images/离职人员.png").Replace(@"\", @"/").Replace(" ", "%20");
                        //users.picture = pathImages;
                        //users.userName = "******";
                    }
                    else
                    {
                        if (string.IsNullOrEmpty(cuss.picture + ""))
                        {
                            pathImages = "file:///" + (AppDomain.CurrentDomain.BaseDirectory + "Images/默认头像.png").Replace(@"\", @"/").Replace(" ", "%20");
                        }
                        else
                        {
                            pathImages = cuss.picture;
                        }
                    }
                }
                else
                {
                    if (string.IsNullOrEmpty(users.picture))
                    {
                        pathImages = "file:///" + (AppDomain.CurrentDomain.BaseDirectory + "Images/默认头像.png").Replace(@"\", @"/").Replace(" ", "%20");
                    }
                    else
                    {
                        pathImages = users.picture;
                    }
                }
            }
            else
            {
                if (string.IsNullOrEmpty(listUser.Url))
                {
                    pathImages = "file:///" + (AppDomain.CurrentDomain.BaseDirectory + "Images/默认头像.png").Replace(@"\", @"/").Replace(" ", "%20");
                }
                else
                {
                    pathImages = "file:///" + listUser.Url.Replace(@"\", @"/").Replace(" ", "%20");
                }
            }


            return(pathImages);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 公告列表查看时需调用的构造函数
        /// </summary>
        public NoticeReadViewModel(AntSdkGetNotificationsByIdOutput rData)
        {
            txtTitles   = rData.title;
            txtContent  = rData.content;
            noticeCount = "我知道了";
            AntSdkContact_User user = AntSdkService.AntSdkListContactsEntity.users.Find(c => c.userId == rData.createBy);

            if (user != null)
            {
                rData.createBy = user.userName;
            }
            btnRemarkText = rData.createBy + "  编辑于  " + DataConverter.FormatTimeByTimeStamp(rData.createTime);
            if (rData.attach != null)
            {
                UpdateAttachment(rData.notificationId);
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 加载公告详情数据
        /// </summary>
        /// <param name="lists"></param>
        public void LoadNoticeData(List <Notice_content> lists)
        {
            this.noticeList = lists;
            if (noticeList == null || noticeList.Count == 0)
            {
                return;
            }
            var    errorCode = 0;
            string errorMsg  = string.Empty;
            var    result    = AntSdkService.GetNotificationsById(noticeList[0].notificationId, ref errorCode, ref errorMsg);

            if (result != null)
            {
                txtContent = result.content;
            }
            txtTitles             = noticeList[0].title;
            NoticeDetailWinHeight = 300;
            AntSdkContact_User user = AntSdkService.AntSdkListContactsEntity.users.Find(c => c.userId == lists[0].createId);

            if (user != null)
            {
                createBy = user.userName;
            }
            //createBy = lists[0].createBy;
            IsReadStutes(noticeList[0].notificationId, noticeList[0].targetId);
            if (lists[0].hasAttach == 1)
            {
                SetGridStatus(true);
                UpdateAttachment(noticeList[0].notificationId);
                //isShowAttch = Visibility.Visible;
            }
            else
            {
                SetGridStatus(false);
                //isShowAttch = Visibility.Collapsed;
            }
            btnRemarkText = createBy + "  编辑于  " + DataConverter.FormatTimeByTimeStamp(noticeList[0].createTime);
            if (noticeList.Count() == 1)
            {
                noticeCount = "我知道了";
            }
            else
            {
                noticeCount = "下一条(" + Convert.ToInt32(noticeList.Count() - 1) + ")";
            }
        }
Ejemplo n.º 9
0
 /// <summary>
 /// 接收者头像
 /// </summary>
 /// <returns></returns>
 public static string HeadImgUrl()
 {
     #region 获取接收者头像
     string pathImages = "";
     //获取接收者头像
     var listUser = GlobalVariable.ContactHeadImage.UserHeadImages.SingleOrDefault(m => m.UserID == AntSdkService.AntSdkCurrentUserInfo.userId);
     if (listUser == null)
     {
         AntSdkContact_User cus = AntSdkService.AntSdkListContactsEntity.users.SingleOrDefault(m => m.userId == AntSdkService.AntSdkCurrentUserInfo.userId);
         if (cus != null)
         {
             if (string.IsNullOrEmpty(cus.picture + ""))
             {
                 pathImages = "file:///" +
                              (AppDomain.CurrentDomain.BaseDirectory + "Images/默认头像.png").Replace(@"\", @"/")
                              .Replace(" ", "%20");
             }
             else
             {
                 pathImages = cus.picture;
             }
         }
     }
     else
     {
         if (string.IsNullOrEmpty(listUser.Url))
         {
             pathImages = "file:///" + (AppDomain.CurrentDomain.BaseDirectory + "Images/默认头像.png").Replace(@"\", @"/").Replace(" ", "%20");
         }
         else
         {
             pathImages = "file:///" + listUser.Url.Replace(@"\", @"/").Replace(" ", "%20");
         }
     }
     #endregion
     return(pathImages);
 }
Ejemplo n.º 10
0
 public string sessionId    = string.Empty; //会话ID
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="user">目标</param>
 /// <param name="sendOrReceive">发送方or接收方</param>
 public AudioChatViewModel(AntSdkContact_User user, GlobalVariable.AudioSendOrReceive sendOrReceive, Action close)
 {
     _targetUser = user;
     _close      = close;
     InitAudio(sendOrReceive);
 }
Ejemplo n.º 11
0
 public ContactInfoViewModel(AntSdkContact_User user, GlobalVariable.ContactInfoViewContainer container, string word) : this(user, container)
 {
     this.keyWord = word;
 }
Ejemplo n.º 12
0
        public static void LeftShowPicAndTextMix(ChromiumWebBrowser cef, ChatBase msg, AntSdkContact_User user, List <string> imgId)
        {
            //显示内容解析
            List <MixMessage_content> receive = JsonConvert.DeserializeObject <List <MixMessage_content> >(msg.sourceContent);
            string        pathImage           = user.copyPicture;
            StringBuilder sbLeft = new StringBuilder();

            sbLeft.AppendLine("function myFunction()");

            sbLeft.AppendLine("{ var nodeFirst=document.createElement('div');");
            sbLeft.AppendLine("nodeFirst.className='leftd';");
            sbLeft.AppendLine("nodeFirst.id='" + msg.messageId + "';");

            //头像显示层
            sbLeft.AppendLine("var second=document.createElement('div');");
            sbLeft.AppendLine("second.className='leftimg';");
            sbLeft.AppendLine("var img = document.createElement('img');");
            sbLeft.AppendLine("img.src='" + pathImage + "';");
            sbLeft.AppendLine("img.className='divcss5Left';");
            sbLeft.AppendLine("img.id='" + user.userId + "';");
            sbLeft.AppendLine("img.addEventListener('click',clickImgCallUserId);");
            sbLeft.AppendLine("second.appendChild(img);");
            sbLeft.AppendLine("nodeFirst.appendChild(second);");

            //时间显示
            sbLeft.AppendLine("var timeshow = document.createElement('div');");
            sbLeft.AppendLine("timeshow.className='leftTimeText';");
            sbLeft.AppendLine("timeshow.innerHTML ='" + user.userNum + user.userName + "  " + PictureAndTextMixMethod.timeComparison(msg.sendTime) + "';");
            sbLeft.AppendLine("nodeFirst.appendChild(timeshow);");

            //图文混合展示层
            //sbLeft.AppendLine("var node = document.createElement('div');");
            string divid = "copy" + Guid.NewGuid().ToString().Replace("-", "");

            sbLeft.AppendLine(PublicTalkMothed.divLeftCopyContent(divid));
            sbLeft.AppendLine("node.id='" + divid + "';");
            sbLeft.AppendLine("node.className='speech left';");
            int i = 0;
            //图文混合内部构造
            StringBuilder sbInside = new StringBuilder();

            foreach (var list in receive)
            {
                switch (list.type)
                {
                //文本
                case "1001":
                    sbInside.Append(PublicTalkMothed.talkContentReplace(list.content?.ToString()));
                    break;

                case "1002":
                    PictureAndTextMixContentDto pictureAndTextMix = JsonConvert.DeserializeObject <PictureAndTextMixContentDto>(list.content?.ToString());
                    if (msg.IsSetImgLoadComplete)
                    {
                        sbInside.Append("<img id=\"" + imgId[i] + "\" src=\"" + pictureAndTextMix.picUrl + "\" class=\"imgLeftProportion\" onload=\"scrollToend(event)\" ondblclick=\"myFunctions(event)\"/>");
                    }
                    else
                    {
                        sbInside.Append("<img id=\"" + imgId[i] + "\" src=\"" + pictureAndTextMix.picUrl + "\" class=\"imgLeftProportion\"  ondblclick=\"myFunctions(event)\"/>");
                    }
                    i++;
                    break;

                case "0000":
                    sbInside.Append("<br/>");
                    break;
                }
            }
            sbLeft.AppendLine("node.innerHTML ='" + sbInside.ToString() + "';");
            sbLeft.AppendLine("nodeFirst.appendChild(node);");
            sbLeft.AppendLine("document.body.appendChild(nodeFirst);");
            sbLeft.AppendLine("}");
            sbLeft.AppendLine("myFunction();");
            cef.ExecuteScriptAsync(sbLeft.ToString());
        }
Ejemplo n.º 13
0
 public void OnHandlerAcceptRequest(AntSdkContact_User user, long channel_id)
 {
     HandlerAcceptRequest?.Invoke(user, channel_id);
 }
Ejemplo n.º 14
0
 public ContactInfoViewModel(AntSdkContact_User user, GlobalVariable.ContactInfoViewContainer container, string word,
                             string pinyin) : this(user, container, word)
 {
     pinYin = pinyin;
 }
Ejemplo n.º 15
0
        private void SetVoteData(AntSdkGetVoteInfoOutput output, VoteViewType type, int groupMemberCount, DateTime serverDateTime)
        {
            AntSdkContact_User contactUser = AntSdkService.AntSdkListContactsEntity.users.Find(c => c.userId == output.createdBy);

            if (contactUser != null)
            {
                if (!string.IsNullOrWhiteSpace(contactUser.picture) && publicMethod.IsUrlRegex(contactUser.picture))
                {
                    var userImage = GlobalVariable.ContactHeadImage.UserHeadImages.FirstOrDefault(
                        m => m.UserID == contactUser.userId);
                    this.InitiatorHeadPic = string.IsNullOrEmpty(userImage?.Url)
                        ? contactUser.picture
                        : userImage.Url;
                }
                else
                {
                    this.InitiatorHeadPic = GlobalVariable.DefaultImage.UserHeadDefaultImage;
                }
                this.InitiatorName = contactUser.userName;
            }
            InitiateDateTime    = DataConverter.FormatTimeByCreateTime(output.createdDate);
            VoteTitle           = output.title;
            VoteState           = DateTime.Compare(Convert.ToDateTime(output.expiryTime), serverDateTime) < 0;
            VoteType            = output.maxChoiceNumber > 1 ? "多选" : "单选" + (output.secret ? "(匿名)" : "");
            _isSingle           = output.maxChoiceNumber <= 1;
            IsDisplayDeleteVote = output.createdBy == AntSdkService.AntSdkCurrentUserInfo.userId;
            VoteEndDateTime     = Convert.ToDateTime(output.expiryTime).ToString("yyyy-MM-dd HH:mm");

            //TotalVotes = groupMemberCount;
            IsDisplayNoVotes = !output.secret;

            if (VoteState)
            {
                IsDisplayAtBtn   = !VoteState;
                IsDisplayNoVotes = !VoteState;
            }
            else
            {
                IsDisplayAtBtn = !output.secret;
            }
            if (groupMemberCount > 0)
            {
                var memberCount = groupMemberCount - output.voters;
                NoVotes = memberCount > 0 ? memberCount : 0;
            }

            if (NoVotes == 0)
            {
                IsDisplayAtBtn = false;
            }
            if (type == VoteViewType.VoteDetail)
            {
                if (output.options != null && output.options.Count > 0)
                {
                    foreach (var opition in output.options)
                    {
                        VoteOptionList.Add(new OptionContent
                        {
                            OptionId   = opition.id,
                            OptionName = opition.name
                        });
                    }
                }
            }
            else
            {
                if (output.options != null && output.options.Count > 0)
                {
                    foreach (var opition in output.options)
                    {
                        VoteOptionList.Add(new OptionContent
                        {
                            OptionId              = opition.id,
                            OptionName            = opition.name,
                            OptionVotes           = opition.total,
                            IsCurrentUserSelected = opition.voted
                        });
                    }
                    TotalVotes = VoteOptionList.Sum(m => m.OptionVotes);
                }
                else
                {
                    TotalVotes = output.voters;
                }
            }
        }
Ejemplo n.º 16
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;
         }
     });
 }
Ejemplo n.º 17
0
        public GroupMemberViewModel(AntSdkGroupMember user, string GroupAdminId, string groupId, GroupMemberListViewModel owner, string strKey, int adminCount = 0)
        {
            TalkGroupViewModel.isShowTransferAdminMenu += TalkGroupViewModel_isShowTransferAdminMenu;
            this.Owner   = owner;
            this.Member  = user;
            this.GroupId = groupId;
            AdminCount   = adminCount;
            keyword      = strKey;
            //if (!string.IsNullOrWhiteSpace(user.picture))
            //{
            //    this.Photo = user.picture;
            //}
            //else
            //{
            //    this.Photo = "pack://application:,,,/AntennaChat;Component/Images/27-头像.png";
            //}
            if (string.IsNullOrEmpty(user.userNum))
            {
                this.Name = user.userName;
            }
            else
            {
                this.Name = user.userNum + user.userName;
            }
            var cuss = AntSdkService.AntSdkListContactsEntity.users.FirstOrDefault(m => m.userId == user.userId);

            if (cuss != null && cuss.status == 0 && cuss.state == 0)
            {
                this.Name = this.Name + "(停用)";
            }
            else if (cuss == null)
            {
                this.Name = "离职人员";
            }
            this.Position      = user.position;
            this.PromptToolTip = string.Format("{0}({1})", this.Name, this.Position);
            if (GroupAdminId == AntSdkService.AntSdkLoginOutput.userId && user.userId != AntSdkService.AntSdkLoginOutput.userId)
            {
                if (cuss != null && cuss.status == 2)
                {
                    ChangeMangerVisibility = KickoutGroupVisibility = Visibility.Visible;
                    IsSetGroupManager      = true;
                }
            }
            if (GroupAdminId == user.userId && cuss != null && cuss.status == 2)
            {
                AdminImageVisibility = Visibility.Visible;
                IsSetGroupManager    = false;
            }
            if (user.userId == AntSdkService.AntSdkLoginOutput.userId)
            {
                SendMsgVisibility = Visibility.Collapsed;
            }
            if (Member.roleLevel == (int)GlobalVariable.GroupRoleLevel.Admin)
            {
                GroupMenuContent  = "解除管理员";
                IsGroupAdminImage = true;
                if (cuss != null && cuss.status == 0)
                {
                    IsSetGroupManager = true;
                }
            }
            if (AdminCount >= 4 && Member.roleLevel != (int)GlobalVariable.GroupRoleLevel.Admin)
            {
                IsSetGroupManager = false;
            }
            //if (AntSdkService.AntSdkCurrentUserInfo.robotId == Member?.userId)
            //{
            //    IsSetGroupManager = false;
            //    ChangeMangerVisibility = KickoutGroupVisibility = Visibility.Collapsed;

            //}
            //if (Member.roleLevel== (int) GlobalVariable.GroupRoleLevel.Admin &&
            //    user.userId != AntSdkService.AntSdkLoginOutput.userId)
            //{
            //    KickoutGroupVisibility = Visibility.Visible;
            //}
            var userinfo = AntSdkService.AntSdkListContactsEntity.users.FirstOrDefault(c => c.userId == user.userId);

            if (userinfo != null)
            {
                contactUser = userinfo;
                if (AntSdkService.AntSdkCurrentUserInfo.robotId == userinfo.userId)
                {
                    IsSetGroupManager      = false;
                    ChangeMangerVisibility = KickoutGroupVisibility = Visibility.Collapsed;
                    userinfo.state         = (int)GlobalVariable.OnLineStatus.OnLine;
                    Name               = userinfo.userName;
                    Position           = userinfo.position;
                    this.PromptToolTip = string.Format("{0}({1})", this.Name, this.Position);
                    //    IsOfflineState = !AntSdkService.AntSdkIsConnected;
                }
                SetContactPhoto();
                //else
                //{
                //    if (!AntSdkService.AntSdkIsConnected)
                //    {
                //        IsOfflineState = true;
                //    }
                //    else
                //    {
                //        IsOfflineState = userinfo.state == (int)GlobalVariable.OnLineStatus.OffLine;
                //    }

                //}
                //if (!string.IsNullOrEmpty(userinfo?.state))
                //{
                //    var state = int.Parse(userinfo.state);
                if (!AntSdkService.AntSdkIsConnected)
                {
                    UserOnlineStateIcon = "";
                }
                else if (!IsOfflineState)
                {
                    if (GlobalVariable.UserOnlineSataeInfo.UserOnlineStateMinIconDic.ContainsKey(userinfo.state))
                    {
                        UserOnlineStateIcon = GlobalVariable.UserOnlineSataeInfo.UserOnlineStateMinIconDic[userinfo.state];
                    }
                }


                if (AntSdkService.AntSdkCurrentUserInfo.robotId == contactUser?.userId)
                {
                    IsOfflineState = !AntSdkService.AntSdkIsConnected;
                }
                else
                {
                    if (!AntSdkService.AntSdkIsConnected)
                    {
                        IsOfflineState = true;
                    }
                    else
                    {
                        IsOfflineState = contactUser?.state == (int)GlobalVariable.OnLineStatus.OffLine;
                    }
                }
                //}
            }
        }
Ejemplo n.º 18
0
        public VoteListViewModel(string groupId)
        {
            _groupId      = groupId;
            _voteInfoList = new ObservableCollection <VoteInfoModel>();
            var errCode = 0;
            var errMsg  = string.Empty;
            AntSdkQuerySystemDateOuput serverResult = AntSdkService.AntSdkGetCurrentSysTime(ref errCode, ref errMsg);
            DateTime serverDateTime = DateTime.Now;

            if (serverResult != null)
            {
                serverDateTime = PublicTalkMothed.ConvertStringToDateTime(serverResult.systemCurrentTime);
            }
            var voteList = AntSdkService.GetGroupVotes(groupId, ref errCode, ref errMsg, _page, _size, AntSdkService.AntSdkCurrentUserInfo.userId);

            if (voteList?.content != null && voteList.content.Count > 0)
            {
                foreach (var voteInfo in voteList.content)
                {
                    var tempInfoModel = new VoteInfoModel();
                    tempInfoModel.IsHaveVoted = voteInfo.voted;
                    if (voteInfo.createdBy == AntSdkService.AntSdkCurrentUserInfo.userId)
                    {
                        tempInfoModel.IsbtnDeleteVisibility = true;
                    }
                    tempInfoModel.VoteId    = voteInfo.id;
                    tempInfoModel.VoteSate  = DateTime.Compare(Convert.ToDateTime(voteInfo.expiryTime), serverDateTime) < 0;
                    tempInfoModel.VoteTitle = voteInfo.title + (voteInfo.secret ? "(匿名)" : "");
                    tempInfoModel.UserID    = voteInfo.createdBy;
                    AntSdkContact_User user = AntSdkService.AntSdkListContactsEntity.users.Find(c => c.userId == voteInfo.createdBy);
                    if (user != null)
                    {
                        tempInfoModel.Explain = user.userNum + user.userName + "  编辑于  " +
                                                DataConverter.FormatTimeByCreateTime(voteInfo.createdDate);
                        if (!string.IsNullOrWhiteSpace(user.picture) && publicMethod.IsUrlRegex(user.picture))
                        {
                            var    index         = user.picture.LastIndexOf("/", StringComparison.Ordinal) + 1;
                            var    fileNameIndex = user.picture.LastIndexOf(".", StringComparison.Ordinal);
                            var    fileName      = user.picture.Substring(index, fileNameIndex - index);
                            string strUrl        = user.picture.Replace(fileName, fileName + "_35x35");
                            var    userImage     =
                                GlobalVariable.ContactHeadImage.UserHeadImages.FirstOrDefault(
                                    m => m.UserID == user.userId);
                            tempInfoModel.UserHeadUrl = string.IsNullOrEmpty(userImage?.Url) ? strUrl : userImage.Url;
                        }
                        else
                        {
                            tempInfoModel.UserHeadUrl = GlobalVariable.DefaultImage.UserHeadDefaultImage;
                        }
                    }
                    //tempInfoModel.UserHeadUrl=
                    _voteInfoList.Add(tempInfoModel);
                }
                _isFirst = voteList.first;
                _isLast  = voteList.last;
                IsPaging = !_isLast;
            }
            else
            {
                IsVoteData = true;
                IsPaging   = false;
            }
        }
Ejemplo n.º 19
0
 /// <summary>
 /// 点对点聊天消息
 /// </summary>
 public SessionInfoViewModel(AntSdkContact_User antsdkcontact_User, SessionInfoModel model, AntSdkMsgType msgType = AntSdkMsgType.ChatMsgText)
 {
     isPointOrGroup          = true;
     _SessionType            = SessionType.SingleChat;
     this.AntSdkContact_User = antsdkcontact_User;
     this.SessionId          = model.SessionId;
     this.MsgType            = msgType;
     //if (!string.IsNullOrWhiteSpace(model.photo))
     //{
     //    this.Photo = model.photo;
     //}
     //else
     //{
     //    this.Photo = "pack://application:,,,/AntennaChat;Component/Images/27-头像.png";
     //}
     this.Name = model.name;
     if (AntSdkContact_User.status == 0 && AntSdkContact_User.state == 0)
     {
         this.Name = model.name + "(停用)";
     }
     this.LastMessage   = model.lastMessage;
     this.LastChatIndex = model.lastChatIndex;
     SetUnreadCount(model.unreadCount);
     this.TopIndex = model.topIndex;
     if (string.IsNullOrWhiteSpace(model.lastTime))
     {
         this.LastTime = string.Empty;
     }
     else
     {
         try
         {
             this.LastTime         = DataConverter.FormatTimeByTimeStamp(model.lastTime);//从消息来的为时间戳
             this.LastMsgTimeStamp = model.lastTime;
         }
         catch
         {
             //this.LastTime = model.lastTime;//从Sqlite来的为时间格式
         }
     }
     //if (!string.IsNullOrEmpty(antsdkcontact_User.state))
     //{
     //    var state = int.Parse(antsdkcontact_User.state);
     if (AntSdkService.AntSdkCurrentUserInfo.robotId == AntSdkContact_User?.userId)
     {
         antsdkcontact_User.state = (int)GlobalVariable.OnLineStatus.OnLine;
     }
     if (!AntSdkService.AntSdkIsConnected)
     {
         UserOnlineStateIcon = "";
     }
     else if (antsdkcontact_User.state != (int)GlobalVariable.OnLineStatus.OffLine)
     {
         if (UserOnlineSataeInfo.UserOnlineStateIconDic.ContainsKey(antsdkcontact_User.state))
         {
             UserOnlineStateIcon = UserOnlineSataeInfo.UserOnlineStateIconDic[antsdkcontact_User.state];
         }
     }
     //}
     SetContactPhoto();
 }
Ejemplo n.º 20
0
        /// <summary>
        /// 全部清空
        /// </summary>
        /// <param name="t"></param>
        /// <returns></returns>
        public int AllDelete(AntSdkContact_User t = null)
        {
            var deleteStr = "delete from C_DEPARTMENT";

            return(AntSdkSqliteHelper.ExecuteNonQuery(deleteStr, AntSdkService.AntSdkConfigInfo.AntSdkCompanyCode, AntSdkService.AntSdkLoginOutput.userId));
        }
Ejemplo n.º 21
0
        /// <summary>
        /// 分页查询投票数据
        /// </summary>
        private void LoadVotesData()
        {
            DateTime serverDateTime = DateTime.Now;

            AsyncHandler.CallFuncWithUI(System.Windows.Application.Current.Dispatcher,
                                        () =>
            {
                var errCode = 0;
                var errMsg  = string.Empty;
                AntSdkQuerySystemDateOuput serverResult = AntSdkService.AntSdkGetCurrentSysTime(ref errCode, ref errMsg);
                if (serverResult != null)
                {
                    serverDateTime = PublicTalkMothed.ConvertStringToDateTime(serverResult.systemCurrentTime);
                }
                var voteList = AntSdkService.GetGroupVotes(_groupId, ref errCode, ref errMsg, _page, _size,
                                                           AntSdkService.AntSdkCurrentUserInfo.userId);
                return(voteList);
            },
                                        (ex, datas) =>
            {
                VoteInfoList.Clear();
                if (datas?.content != null && datas.content.Count > 0)
                {
                    foreach (var voteInfo in datas.content)
                    {
                        var tempInfoModel         = new VoteInfoModel();
                        tempInfoModel.IsHaveVoted = voteInfo.voted;
                        if (voteInfo.createdBy == AntSdkService.AntSdkCurrentUserInfo.userId)
                        {
                            tempInfoModel.IsbtnDeleteVisibility = true;
                        }
                        tempInfoModel.VoteId   = voteInfo.id;
                        tempInfoModel.VoteSate =
                            DateTime.Compare(Convert.ToDateTime(voteInfo.expiryTime), serverDateTime) < 0;
                        tempInfoModel.VoteTitle = voteInfo.title + (voteInfo.secret ? "(匿名)" : "");
                        tempInfoModel.UserID    = voteInfo.createdBy;
                        AntSdkContact_User user = AntSdkService.AntSdkListContactsEntity.users.Find(c => c.userId == voteInfo.createdBy);
                        if (user != null)
                        {
                            tempInfoModel.Explain = user.userNum + user.userName + "  编辑于  " +
                                                    DataConverter.FormatTimeByCreateTime(voteInfo.createdDate);
                            if (!string.IsNullOrWhiteSpace(user.picture) && publicMethod.IsUrlRegex(user.picture))
                            {
                                var userImage =
                                    GlobalVariable.ContactHeadImage.UserHeadImages.FirstOrDefault(
                                        m => m.UserID == user.userId);
                                tempInfoModel.UserHeadUrl = string.IsNullOrEmpty(userImage?.Url) ? user.picture : userImage.Url;
                            }
                            else
                            {
                                tempInfoModel.UserHeadUrl = GlobalVariable.DefaultImage.UserHeadDefaultImage;
                            }
                        }
                        //tempInfoModel.UserHeadUrl=
                        _voteInfoList.Add(tempInfoModel);
                    }
                }
                if (datas != null)
                {
                    _isFirst = datas.first;
                    _isLast  = datas.last;
                }
            });
        }
        public NoticeWindowListsViewModel(bool isAdminId, string groupId)
        {
            _isAdminId = isAdminId;
            if (!_isAdminId)
            {
                isShowBtnAddAttachment = "Collapsed";
            }
            //加载数据
            //inFindNoticeList inData = new inFindNoticeList();
            //inData.token = AntSdkService.AntSdkLoginOutput.token;
            //inData.userId = AntSdkService.AntSdkCurrentUserInfo.userId;
            //inData.version = "";
            //inData.targetId = groupId;
            //ReturnNoticeList rDto = new ReturnNoticeList();
            var    errorCode = 0;
            string errorMsg  = "";
            //TODO:AntSdk_Modify
            //DONE:AntSdk_Modify
            var resultNotices = AntSdkService.GetGroupNotifications(AntSdkService.AntSdkCurrentUserInfo.userId, groupId, ref errorCode, ref errorMsg);

            //bool b = false;//new HttpService().SearchNoticeList(inData, ref rDto, ref errorMsg);
            if (resultNotices != null && resultNotices.Length > 0)
            {
                NoticeModel nAdd = null;
                foreach (var notice in resultNotices)
                {
                    AntSdkContact_User user = AntSdkService.AntSdkListContactsEntity.users.Find(c => c.userId == notice.createBy);
                    if (user != null)
                    {
                        notice.createBy = user.userName;
                    }
                    if (!_isAdminId)
                    {
                        nAdd = new NoticeModel();
                        //id = Guid.NewGuid().ToString().Replace("-", "");
                        nAdd.NotificationId = notice.notificationId;

                        if (notice.hasAttach == "1")
                        {
                            isShowAttch          = "Visible";
                            nAdd.IsAdjunctNotice = true;
                        }
                        else
                        {
                            isShowAttch          = "Collapsed";
                            nAdd.IsAdjunctNotice = false;
                        }

                        nAdd.NoticeTitle = notice.title;
                        //nAdd.NoticeContent = notice.;

                        nAdd.Explain = notice.createBy + "  编辑于  " + DataConverter.FormatTimeByTimeStamp(notice.createTime);
                        _noticeList.Add(nAdd);
                    }
                    else
                    {
                        nAdd = new NoticeModel();
                        if (notice.hasAttach == "1")
                        {
                            isShowAttch          = "Visible";
                            nAdd.IsAdjunctNotice = true;
                        }
                        else
                        {
                            isShowAttch          = "Collapsed";
                            nAdd.IsAdjunctNotice = false;
                        }

                        nAdd.NotificationId        = notice.notificationId;
                        nAdd.IsbtnDeleteVisibility = true;
                        nAdd.NoticeTitle           = notice.title;
                        //nAdd.NoticeContent = notice.content;
                        nAdd.Explain = notice.createBy + "  编辑于  " + DataConverter.FormatTimeByTimeStamp(notice.createTime);
                        _noticeList.Add(nAdd);
                    }
                }
            }
            else
            {
                if (!string.IsNullOrEmpty(errorMsg))
                {
                    Application.Current.Dispatcher.Invoke(new Action(() => MessageBoxWindow.Show("公告加载失败!", GlobalVariable.WarnOrSuccess.Warn)));
                }
                else
                {
                    NoticeNoWindowViewModelVisibility = Visibility.Visible;
                }
            }
        }
Ejemplo n.º 23
0
        /// <summary>
        /// 分页查询投票数据
        /// </summary>
        private void LoadVotesData()
        {
            AsyncHandler.CallFuncWithUI(System.Windows.Application.Current.Dispatcher,
                                        () =>
            {
                var errCode = 0;
                var errMsg  = string.Empty;
                AntSdkGetGroupActivitysInput intput = new AntSdkGetGroupActivitysInput
                {
                    groupId        = _groupId,
                    activityStatus = 0,
                    pageNum        = _page,
                    pageSize       = _size,
                    userId         = AntSdkService.AntSdkCurrentUserInfo.userId
                };
                var activityList = AntSdkService.GetGroupActivitys(intput, ref errCode, ref errMsg);
                return(activityList);
            },
                                        (ex, datas) =>
            {
                ActivityInfoList.Clear();
                if (datas?.list != null && datas.list.Count > 0)
                {
                    foreach (var activityInfo in datas.list)
                    {
                        var tempInfoModel            = new ActivityInfoModel();
                        tempInfoModel.IsHaveActivity = activityInfo.voteFlag;
                        if (activityInfo.userId == AntSdkService.AntSdkCurrentUserInfo.userId)
                        {
                            tempInfoModel.IsbtnDeleteVisibility = true;
                        }
                        tempInfoModel.ActivityId = activityInfo.activityId;

                        tempInfoModel.ActivitySate  = activityInfo.activityStatus == 2;
                        tempInfoModel.ActivityTitle = activityInfo.theme;

                        AntSdkContact_User user = AntSdkService.AntSdkListContactsEntity.users.Find(c => c.userId == activityInfo.userId);
                        if (user != null)
                        {
                            if (!string.IsNullOrEmpty(activityInfo.picture))
                            {
                                BitmapImage image = new BitmapImage();

                                image.BeginInit();

                                image.UriSource = new System.Uri(activityInfo.picture);

                                image.DecodePixelWidth = 800;

                                image.EndInit();

                                image.Freeze();
                                tempInfoModel.ActivityThemePicture = image;
                            }
                            tempInfoModel.ActivityAddress     = activityInfo.address;
                            tempInfoModel.CreatedActivityDate = activityInfo.createTime;
                            if (!string.IsNullOrEmpty(activityInfo.startTime))
                            {
                                tempInfoModel.ActivityDate = Convert.ToDateTime(activityInfo.startTime).ToString("yyyy-MM-dd HH:mm");
                            }
                        }
                        //tempInfoModel.UserHeadUrl=
                        _activityInfoList.Add(tempInfoModel);
                    }
                }
                if (datas != null)
                {
                    _isFirst = datas.isFirstPage;
                    _isLast  = datas.isLastPage;
                }
            });
        }