示例#1
0
        /// <summary>
        /// 加载详情数据(公司、部门、个人)
        /// </summary>
        public void InitDetails(DetailType type, object obj, List <AntSdkContact_User> contactUsers = null)
        {
            _type = type;
            _info = obj;
            _groupInfoViewModel = null;
            if (contactUsers != null)
            {
                _contactUsers = contactUsers;
            }
            switch (type)
            {
            case DetailType.Company:
                CompanyDetail(_info);
                break;

            case DetailType.Department:
                DepartmentDetail(_info);
                break;

            case DetailType.Personal:
                PersonalDetail(_info);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(type), type, null);
            }
        }
示例#2
0
 /// <summary>
 /// 被移出讨论组时调用
 /// </summary>
 /// <param name="groupId"></param>
 public void DropOutGroup(string groupId)
 {
     AsyncHandler.AsyncCall(System.Windows.Application.Current.Dispatcher, () =>
     {
         GroupInfoViewModel vm = GroupInfoList.FirstOrDefault(c => c.GroupInfo.groupId == groupId);
         if (vm == null)
         {
             return;
         }
         GroupIds.Remove(vm.GroupInfo.groupId);
         //GroupInfoList.Remove(vm);
         GroupInfoList.Remove(vm);
         GroupInfos.Remove(vm.GroupInfo);
         if (ManageGroupInfoList.Contains(vm))
         {
             ManageGroupInfoList.Remove(vm);
         }
         if (JoinGroupInfoList.Contains(vm))
         {
             JoinGroupInfoList.Remove(vm);
         }
         ManageGroupCount = ManageGroupInfoList.Count;
         JoinGroupCount   = JoinGroupInfoList.Count;
         if (ManageGroupCount == 0)
         {
             IsManageGroup = false;
         }
         if (JoinGroupCount == 0)
         {
             IsJoinGroup = false;
         }
         List <string> topics = new List <string>();
         topics.Add(vm.GroupInfo.groupId);
     });
 }
示例#3
0
        /// <summary>
        /// 更新讨论组免打扰设置
        /// </summary>
        /// <param name="groupId"></param>
        /// <param name="state"></param>
        public void UpdateMsgRemind(string groupId, int state)
        {
            GroupInfoViewModel vm = GroupInfoList.FirstOrDefault(c => c.GroupInfo.groupId == groupId);

            if (state == (int)GlobalVariable.MsgRemind.NoRemind)
            {
                if (vm == null)
                {
                    return;
                }
                vm.MessageHideIsChecked    = true;
                vm.ImageNoRemindVisibility = Visibility.Visible;
                vm.MessageNoticeIsChecked  = false;
                //CurrentSelectedGroupInfoVM?.StructureDetailsVM?.SetMsgRemindState(GlobalVariable.MsgRemind.NoRemind);
            }
            else
            {
                if (vm == null)
                {
                    return;
                }
                vm.MessageHideIsChecked    = false;
                vm.ImageNoRemindVisibility = Visibility.Collapsed;
                vm.MessageNoticeIsChecked  = true;
                //CurrentSelectedGroupInfoVM?.StructureDetailsVM?.SetMsgRemindState(GlobalVariable.MsgRemind.Remind);
            }
        }
示例#4
0
 private void GroupMemberViewModel_DismissGroupHandlerHidden(object sender, EventArgs e)
 {
     if (GroupInfoList != null && GroupInfoList.Any())
     {
         GroupInfoViewModel groupInfo =
             GroupInfoList.SingleOrDefault(m => m.GroupInfo.groupId == sender as string);
         if (groupInfo != null)
         {
             groupInfo.DeleteGroupVisibility = Visibility.Collapsed;
             groupInfo.GroupClassify         = 2;
             //groupInfo.GroupClassifyName = "我加入的";
             ManageGroupInfoList.Remove(groupInfo);
             JoinGroupInfoList.Insert(0, groupInfo);
             GroupInfoList.Remove(groupInfo);
             GroupInfoList.Add(groupInfo);
             //CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(GroupInfoList);
             //if (view != null)
             //{
             //    view.GroupDescriptions.Clear();
             //    PropertyGroupDescription groupDescription = new PropertyGroupDescription("GroupClassifyName");
             //    view.GroupDescriptions.Add(groupDescription);
             //}
         }
     }
 }
示例#5
0
        /// <summary>
        /// 退出讨论组时调用
        /// </summary>
        /// <param name="viewModel"></param>
        /// <param name="args"></param>
        private void DropOutGroup(object viewModel, EventArgs args)
        {
            GroupInfoViewModel vm = viewModel as GroupInfoViewModel;

            if (vm == null)
            {
                return;
            }
            GroupIds.Remove(vm.GroupInfo.groupId);
            GroupInfoList.Remove(vm);
            GroupInfos.Remove(vm.GroupInfo);
            if (ManageGroupInfoList.Contains(vm))
            {
                ManageGroupInfoList.Remove(vm);
            }
            if (JoinGroupInfoList.Contains(vm))
            {
                JoinGroupInfoList.Remove(vm);
            }
            ManageGroupCount = ManageGroupInfoList.Count;
            JoinGroupCount   = JoinGroupInfoList.Count;
            if (ManageGroupCount == 0)
            {
                IsManageGroup = false;
            }
            if (JoinGroupCount == 0)
            {
                IsJoinGroup = false;
            }
            List <string> topics = new List <string>();

            topics.Add(vm.GroupInfo.groupId);
        }
示例#6
0
        /// <summary>
        /// 讨论组信息被修改时调用
        /// </summary>
        /// <param name="sysMsg"></param>
        public void UpdateGroupInfo(AntSdkReceivedGroupMsg.Modify sysMsg)
        {
            GroupInfoViewModel vm = GroupInfoList.FirstOrDefault(c => c.GroupInfo.groupId == sysMsg.sessionId);

            if (vm == null)
            {
                return;
            }
            vm.UpdateGroupInfo(sysMsg);
            GroupInfoListUpdate(vm);
        }
示例#7
0
        /// <summary>
        /// 群组展示
        /// </summary>
        public void ResetGroupList()
        {
            if (GroupInfos == null)
            {
                return;
            }
            //List<string> topics = new List<string>();
            List <QueryMsgInput_Group> queryMsgInput_Groups = new List <QueryMsgInput_Group>();

            AsyncHandler.AsyncCall(System.Windows.Application.Current.Dispatcher, () =>
            {
                //System.Diagnostics.Stopwatch stopWatch = new System.Diagnostics.Stopwatch();
                foreach (AntSdkGroupInfo info in GroupInfos)
                {
                    //stopWatch.Start();
                    //int unreadCount = 0;
                    ////删除取消消息免打扰功能的记录
                    //if (noRemindGroupList != null
                    //    && noRemindGroupList.Count > 0)
                    //{
                    //    T_NoRemindGroup noRemindGroup = noRemindGroupList.FirstOrDefault(c => c.GroupId == info.groupId);
                    //    if (noRemindGroup != null)
                    //    {
                    //        if (info.state == (int)GlobalVariable.MsgRemind.Remind)
                    //        {
                    //            ThreadPool.QueueUserWorkItem(m => T_NoRemindGroupBll.Delete(noRemindGroup));
                    //        }
                    //        else
                    //        {
                    //            unreadCount = noRemindGroup.UnreadCount;
                    //            //T_NoRemindGroupBll.GetModelByKey(info.groupId);
                    //        }
                    //    }
                    //}
                    GroupIds.Add(info.groupId);
                    GroupInfoViewModel groupInfoVM = new GroupInfoViewModel(info);

                    _GroupInfoList.Add(groupInfoVM);
                    //topics.Add(info.groupId);

                    QueryMsgInput_Group queryMsgInput_Group = new QueryMsgInput_Group();
                    //queryMsgInput_Group.companyCode = GlobalVariable.CompanyCode;
                    queryMsgInput_Group.sessionId = info.groupId;
                    //queryMsgInput_Group.sendUserId = AntSdkService.AntSdkLoginOutput.userId;
                    queryMsgInput_Group.chatIndex = string.Empty; //chatIndex为空,服务端返回100条消息
                    queryMsgInput_Groups.Add(queryMsgInput_Group);
                    //stopWatch.Stop();
                    //LogHelper.WriteDebug(string.Format("[LoadAction_GroupInfoViewModel({0}毫秒)]", stopWatch.Elapsed.TotalMilliseconds));
                }
            }, DispatcherPriority.Background);
        }
        /// <summary>
        /// 主界面上的直接查询(群组部分的实例化)
        /// </summary>
        /// <param name="groupInfo"></param>
        /// <param name="container"></param>
        /// <param name="word"></param>
        public ContactInfoViewModel(GroupInfoViewModel groupInfoVM, GlobalVariable.ContactInfoViewContainer container, string word)
        {
            this.keyWord = word;
            this.Name    = groupInfoVM.GroupInfo.groupName;
            //this.Photo = !string.IsNullOrWhiteSpace(groupInfoVM.GroupInfo.groupPicture) ? groupInfoVM.GroupInfo.groupPicture : "pack://application:,,,/AntennaChat;Component/Images/27-头像.png";

            this.Container      = container;
            this.IsGroupContact = true;
            GroupInfoVM         = groupInfoVM;
            SetContactPhoto(true);
            ColumnNameWidth       = double.NaN;
            StateImageVisibility  = Visibility.Collapsed;
            ContextMenuVisibility = Visibility.Visible;
        }
示例#9
0
        /// <summary>
        /// 讨论组成员信息被修改时调用(比如:被转让为管理员角色)
        /// </summary>
        /// <param name="groupId"></param>
        /// <param name="members"></param>
        public void UpdateGroupMemeber(string groupId, List <AntSdkGroupMember> members)
        {
            GroupInfoViewModel vm = GroupInfoList.FirstOrDefault(c => c.GroupInfo.groupId == groupId);

            if (vm == null)
            {
                return;
            }
            if (members != null)
            {
                vm.UpdateMembers(members);
            }
            GroupInfoListUpdate(vm);
            CurrentSelectedGroupInfoVM?.StructureDetailsVM?.InitDetails(DetailType.Group, vm, vm.Members, false);
        }
示例#10
0
        /// <summary>
        /// 讨论组成员信息修改后刷新列表
        /// </summary>
        /// <param name="vm"></param>
        private void GroupInfoListUpdate(GroupInfoViewModel vm)
        {
            if (vm.Members == null)
            {
                return;
            }
            var tempUser = vm.Members.Find(c => c.userId == AntSdkService.AntSdkLoginOutput.userId &&
                                           (c.roleLevel == (int)GlobalVariable.GroupRoleLevel.GroupOwner || c.roleLevel == (int)GlobalVariable.GroupRoleLevel.Admin));

            if (tempUser != null)
            {
                if (JoinGroupInfoList.Contains(vm))
                {
                    JoinGroupInfoList.Remove(vm);
                }
                if (!ManageGroupInfoList.Contains(vm))
                {
                    vm.GroupClassify         = 1;
                    vm.DeleteGroupVisibility = Visibility.Visible;
                    ManageGroupInfoList.Insert(0, vm);
                }
            }
            else
            {
                if (ManageGroupInfoList.Contains(vm))
                {
                    ManageGroupInfoList.Remove(vm);
                }
                if (!JoinGroupInfoList.Contains(vm))
                {
                    vm.GroupClassify         = 2;
                    vm.DeleteGroupVisibility = Visibility.Collapsed;
                    JoinGroupInfoList.Insert(0, vm);
                }
            }
            ManageGroupCount = ManageGroupInfoList.Count;
            JoinGroupCount   = JoinGroupInfoList.Count;
            IsManageGroup    = ManageGroupCount != 0;
            IsJoinGroup      = JoinGroupCount != 0;
        }
示例#11
0
 /// <summary>
 /// 加载详情数据(群组)
 /// </summary>
 /// <param name="type"></param>
 /// <param name="groupInfo"></param>
 /// <param name="groupMembers"></param>
 public void InitDetails(DetailType type, GroupInfoViewModel groupInfo, List <AntSdkGroupMember> groupMembers, bool isFirst = true)
 {
     _contactUsers = null;
     if (groupInfo != null)
     {
         _groupInfoViewModel = groupInfo;
     }
     _type   = type;
     IsGroup = true;
     GroupDetail();
     if (!isFirst)
     {
         if (!IsShowMembers)
         {
             return;
         }
         LoadGroupMeberData();
     }
     else
     {
         IsShowMembers = false;
     }
 }
示例#12
0
        private void AddGroupMember(string groupId, string picture, List <AntSdkContact_User> newGroupMemberList)
        {
            GroupInfoViewModel vm = GroupInfoList.FirstOrDefault(c => c.GroupInfo.groupId == groupId);

            vm?.AddNewMember(picture, newGroupMemberList);
        }
示例#13
0
        public void AddGroupAndClick(AntSdkCreateGroupOutput group)
        {
            GroupInfoViewModel vm = AddGroup(group);

            vm?.OnMouseDoubleClickEvent();
        }
示例#14
0
        /// <summary>
        /// 新增群组model组装
        /// </summary>
        /// <param name="newGroup"></param>
        /// <returns></returns>
        private GroupInfoViewModel AddGroupInfoModel(AntSdkGroupInfo newGroup)
        {
            //if (GroupInfoList.FirstOrDefault(c => c.GroupInfo.groupId == group.groupId) != null) return;
            if (GroupIds.Contains(newGroup.groupId))
            {
                var tempGroupInfoVm = GroupInfoList.FirstOrDefault(c => c.GroupInfo.groupId == newGroup.groupId);
                if (tempGroupInfoVm != null)
                {
                    if (tempGroupInfoVm.GroupPicture != newGroup.groupPicture)
                    {
                        tempGroupInfoVm.GroupPicture = newGroup.groupPicture;
                    }
                    var classify = newGroup.groupOwnerId == AntSdkService.AntSdkCurrentUserInfo.userId ||
                                   (newGroup.managerIds != null && newGroup.managerIds.Contains(AntSdkService.AntSdkCurrentUserInfo.userId)) ? 1 : 2;
                    if (tempGroupInfoVm.GroupClassify != classify)
                    {
                        tempGroupInfoVm.GroupClassify = classify;
                        if (ManageGroupInfoList.Contains(tempGroupInfoVm))
                        {
                            ManageGroupInfoList.Remove(tempGroupInfoVm);
                        }
                        if (JoinGroupInfoList.Contains(tempGroupInfoVm))
                        {
                            JoinGroupInfoList.Remove(tempGroupInfoVm);
                        }
                        if (tempGroupInfoVm.GroupClassify == 1)
                        {
                            ManageGroupInfoList.Insert(0, tempGroupInfoVm);
                        }
                        else
                        {
                            JoinGroupInfoList.Insert(0, tempGroupInfoVm);
                        }
                        ManageGroupCount = ManageGroupInfoList.Count;
                        JoinGroupCount   = JoinGroupInfoList.Count;
                    }
                }
                //tempGroupInfoVm = groupInfoVM;
                return(tempGroupInfoVm);
            }
            GroupInfoViewModel groupInfoVM = new GroupInfoViewModel(newGroup);

            if (GroupInfos == null)
            {
                GroupInfos = new List <AntSdkGroupInfo>();
            }
            GroupInfos.Add(newGroup);
            GroupIds.Add(newGroup.groupId);
            GroupInfoList.Add(groupInfoVM);
            if (groupInfoVM.GroupClassify == 1)
            {
                ManageGroupInfoList.Insert(0, groupInfoVM);
            }
            else
            {
                JoinGroupInfoList.Insert(0, groupInfoVM);
            }
            ManageGroupCount = ManageGroupInfoList.Count;
            JoinGroupCount   = JoinGroupInfoList.Count;
            if (ManageGroupCount > 0)
            {
                IsManageGroup = true;
            }
            if (JoinGroupCount > 0)
            {
                IsJoinGroup = true;
            }
            //if (GroupInfoList != null && GroupInfoList.Any())
            //{
            //    CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(GroupInfoList);
            //    if (view != null)
            //    {
            //        view.GroupDescriptions.Clear();
            //        PropertyGroupDescription groupDescription = new PropertyGroupDescription("GroupClassify");
            //        view.GroupDescriptions.Add(groupDescription);
            //    }
            //}
            List <string> topics = new List <string>();

            topics.Add(newGroup.groupId);
            return(groupInfoVM);
        }
示例#15
0
 public ContactInfoViewModel(GroupInfoViewModel groupInfoVM, GlobalVariable.ContactInfoViewContainer container,
                             string word, string pinyin) : this(groupInfoVM, container, word)
 {
     this.pinYin = pinyin;
 }