コード例 #1
0
ファイル: MainForm.cs プロジェクト: xydoublez/GGTalk-V5.5
        void do_globalUserCache_GroupInfoChanged(GGGroup group, GroupChangedType type, string userID)
        {
            this.groupListBox.GroupInfoChanged(group, type, userID);

            if (type == GroupChangedType.GroupDeleted)
            {
                GroupChatForm form = this.groupChatFormManager.GetForm(group.ID);
                if (form != null)
                {
                    form.Close();
                }

                if (userID != null) //为null 表示更改了自己的部门资料
                {
                    MessageBoxEx.Show(string.Format("群{0}({1})已经被解散。", group.ID, group.Name));
                }
                return;
            }

            GroupChatForm form2 = this.groupChatFormManager.GetForm(group.ID);

            if (form2 != null)
            {
                form2.OnGroupInfoChanged(type, userID);
            }
        }
コード例 #2
0
ファイル: GroupListBox.cs プロジェクト: liweizl/GGTalk-1
        public void GroupInfoChanged(IGroup group, GroupChangedType type, string userID)
        {
            ChatListSubItem[] subItems = this.chatListBox_group.GetSubItemsById(group.ID);
            if (type == GroupChangedType.GroupDeleted)
            {
                if (subItems == null || subItems.Length == 0)
                {
                    return;
                }

                this.chatListBox_group.Items[0].SubItems.Remove(subItems[0]);
                return;
            }


            if (type == GroupChangedType.GroupInfoChanged)
            {
                if (subItems == null || subItems.Length == 0)
                {
                    return;
                }
                this.chatListBox_group.GetSubItemsById(group.ID)[0].DisplayName = group.Name;


                return;
            }



            if (subItems == null || subItems.Length == 0)
            {
                ChatListSubItem subItem = new ChatListSubItem(group.ID, "", group.Name, string.Format("{0}人", group.MemberList.Count), ChatListSubItem.UserStatus.Online, this.imageList1.Images[0]);
                subItem.Tag = group;
#if !Org
                this.chatListBox_group.Items[0].SubItems.Add(subItem);
#else
                if (group.ID == this.companyGroupID)
                {
                    this.chatListBox_group.Items[0].SubItems.Insert(0, subItem);
                }
                else
                {
                    this.chatListBox_group.Items[0].SubItems.Add(subItem);
                }
#endif

                return;
            }
            else
            {
                subItems[0].Tag         = group;
                subItems[0].PersonalMsg = string.Format("{0}人", group.MemberList.Count);
            }
        }
コード例 #3
0
        public void OnGroupInfoChanged(GroupChangedType type, string userID)
        {
            if (type == GroupChangedType.GroupInfoChanged)
            {
                this.Text = string.Format("{0}({1})", this.currentGroup.Name, this.currentGroup.GroupID);
                this.labelGroupName.Text = this.currentGroup.Name;
                this.label_announce.Text = this.currentGroup.Announce;
                return;
            }

            if (type == GroupChangedType.MemberInfoChanged)
            {
                GGUser user = this.globalUserCache.GetUser(userID);
                this.OnUserInfoChanged(user);
                return;
            }

            if (type == GroupChangedType.SomeoneJoin)
            {
                GGUser user = this.globalUserCache.GetUser(userID);
                this.AddUserItem(user);
                this.AppendSysMessage(string.Format("{0}({1})加入了该群!", user.Name, user.UserID));
                return;
            }

            if (type == GroupChangedType.SomeoneQuit)
            {
                GGUser            user  = this.globalUserCache.GetUser(userID);
                ChatListSubItem[] items = this.chatListBox1.GetSubItemsByNicName(userID);
                if (items == null || items.Length == 0)
                {
                    return;
                }
                ChatListSubItem item = items[0];
                this.chatListBox1.Items[0].SubItems.Remove(item);
                this.chatListBox1.Invalidate();
                this.AppendSysMessage(string.Format("{0}({1})退出了该群!", user.Name, user.UserID));
                return;
            }
        }
コード例 #4
0
ファイル: GroupListBox.cs プロジェクト: GamesDesignArt/GGTalk
        public void GroupInfoChanged(IGroup group, GroupChangedType type, string userID)
        {
            ChatListSubItem[] subItems = this.chatListBox_group.GetSubItemsById(group.ID);
            if (type == GroupChangedType.GroupDeleted)
            {
                if (subItems == null || subItems.Length == 0)
                {
                    return;
                }

                this.chatListBox_group.Items[0].SubItems.Remove(subItems[0]);
                return;
            }

            if (subItems == null || subItems.Length == 0)
            {
                ChatListSubItem subItem = new ChatListSubItem(group.ID, "", group.Name, string.Format("{0}人", group.MemberList.Count), ChatListSubItem.UserStatus.Online, this.imageList1.Images[0]);
                subItem.Tag = group;
            #if !Org
                this.chatListBox_group.Items[0].SubItems.Add(subItem);
            #else
                if (group.ID == this.companyGroupID)
                {
                    this.chatListBox_group.Items[0].SubItems.Insert(0, subItem);
                }
                else
                {
                    this.chatListBox_group.Items[0].SubItems.Add(subItem);
                }
            #endif

                return;
            }
            else
            {
                subItems[0].Tag = group;
                subItems[0].PersonalMsg = string.Format("{0}人", group.MemberList.Count);
            }
        }
コード例 #5
0
ファイル: MainForm.cs プロジェクト: xydoublez/GGTalk-V5.5
 void globalUserCache_GroupInfoChanged(GGGroup group, GroupChangedType type, string userID)
 {
     GlobalResourceManager.UiSafeInvoker.ActionOnUI <GGGroup, GroupChangedType, string>(this.do_globalUserCache_GroupInfoChanged, group, type, userID);
 }
コード例 #6
0
ファイル: MainForm.cs プロジェクト: GamesDesignArt/GGTalk
 void globalUserCache_GroupInfoChanged(GGGroup group, GroupChangedType type, string userID)
 {
     GlobalResourceManager.UiSafeInvoker.ActionOnUI<GGGroup, GroupChangedType, string>(this.do_globalUserCache_GroupInfoChanged, group, type, userID);
 }
コード例 #7
0
ファイル: MainForm.cs プロジェクト: GamesDesignArt/GGTalk
        void do_globalUserCache_GroupInfoChanged(GGGroup group, GroupChangedType type, string userID)
        {
            this.groupListBox.GroupInfoChanged(group, type, userID);

            if (type == GroupChangedType.GroupDeleted)
            {
                GroupChatForm form = this.groupChatFormManager.GetForm(group.ID);
                if (form != null)
                {
                    form.Close();
                }

                if (userID != null) //为null 表示更改了自己的部门资料
                {
                    MessageBoxEx.Show(string.Format("群{0}({1})已经被解散。", group.ID, group.Name));
                }
                return;
            }

            GroupChatForm form2 = this.groupChatFormManager.GetForm(group.ID);
            if (form2 != null)
            {
                form2.OnGroupInfoChanged(type, userID);
            }
        }
コード例 #8
0
        public void OnGroupInfoChanged(GroupChangedType type, string userID)
        {
            if (type == GroupChangedType.GroupInfoChanged)
            {
                this.Text = string.Format("{0}({1})", this.currentGroup.Name, this.currentGroup.GroupID);
                this.labelGroupName.Text = this.currentGroup.Name;
                this.label_announce.Text = this.currentGroup.Announce;
                return;
            }

            if (type == GroupChangedType.MemberInfoChanged)
            {
                GGUser user = this.globalUserCache.GetUser(userID);
                this.OnUserInfoChanged(user);
                return;
            }

            if (type == GroupChangedType.SomeoneJoin)
            {
                GGUser user = this.globalUserCache.GetUser(userID);
                this.AddUserItem(user);
                this.AppendSysMessage(string.Format("{0}({1})加入了该群!", user.Name, user.UserID));
                return;
            }

            if (type == GroupChangedType.SomeoneAdd)
            {
                GGUser user = this.globalUserCache.GetUser(userID);
                this.AddUserItem(user);
                this.AppendSysMessage(string.Format("{0}({1})加入了该群!", user.Name, user.UserID));
                return;
            }


            if (type == GroupChangedType.SomeoneQuit)
            {
                GGUser            user  = this.globalUserCache.GetUser(userID);
                ChatListSubItem[] items = this.chatListBox1.GetSubItemsByNicName(userID);
                if (items == null || items.Length == 0)
                {
                    return;
                }
                ChatListSubItem item = items[0];
                this.chatListBox1.Items[0].SubItems.Remove(item);
                this.chatListBox1.Invalidate();
                this.AppendSysMessage(string.Format("{0}({1})退出了该群!", user.Name, user.UserID));

                return;
            }

            if (type == GroupChangedType.SomeoneRemove)
            {
                GGUser            user  = this.globalUserCache.GetUser(userID);
                ChatListSubItem[] items = this.chatListBox1.GetSubItemsByNicName(userID);
                if (items == null || items.Length == 0)
                {
                    return;
                }
                ChatListSubItem item = items[0];
                this.chatListBox1.Items[0].SubItems.Remove(item);
                this.chatListBox1.Invalidate();
                this.AppendSysMessage(string.Format("{0}({1})被踢出该群!", user.Name, user.UserID));

                return;
            }



            if (type == GroupChangedType.SomeoneNoSpeak)
            {
                GGUser user = this.globalUserCache.GetUser(userID);
                // this.AddUserItem(user);
                this.AppendSysMessage(string.Format("{0}({1})被管理员禁止发言!", user.Name, user.UserID));
                this.globalUserCache.GetGroup(currentGroup.ID).AddNoSpeak(user.ID);
                return;
            }
            if (type == GroupChangedType.SomeoneAllowSpeak)
            {
                GGUser user = this.globalUserCache.GetUser(userID);
                // this.AddUserItem(user);
                this.AppendSysMessage(string.Format("管理员允许{0}({1})发言!", user.Name, user.UserID));
                this.globalUserCache.GetGroup(currentGroup.ID).RemoveNoSpeak(user.ID);
                return;
            }

            if (type == GroupChangedType.SomeoneAddManagers)
            {
                GGUser user = this.globalUserCache.GetUser(userID);
                // this.AddUserItem(user);
                this.AppendSysMessage(string.Format("{0}({1})被设为管理员!", user.Name, user.UserID));
                this.globalUserCache.GetGroup(currentGroup.ID).AddManager(user.ID);

                if (user.ID == this.mine.ID)
                {
                    btn_adduser.Visible = true;
                }

                return;
            }
            if (type == GroupChangedType.SomeoneRemoveManagers)
            {
                GGUser user = this.globalUserCache.GetUser(userID);
                // this.AddUserItem(user);
                this.AppendSysMessage(string.Format(" {0}({1})被卸任管理员!", user.Name, user.UserID));
                this.globalUserCache.GetGroup(currentGroup.ID).RemoveManager(user.ID);
                if (user.ID == this.mine.ID)
                {
                    btn_adduser.Visible = false;
                }

                return;
            }
        }