⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 personalgroupmanager.cs

📁 破解的飞信源代码
💻 CS
📖 第 1 页 / 共 4 页
字号:
                {
                    AsyncBizOperation op = new AsyncBizOperation(owner);
                    if (handler == null)
                    {
                        handler = new EventHandler<ImpsErrorEventArgs>(this, (IntPtr) this.<DeleteGroupMember>b__a);
                    }
                    op.ImpsError += handler;
                    this.CurrentUser.PersonalGroupManager.AsyncDeleteGroupMember(member, op);
                }
            }
            catch (Exception exception)
            {
                ClientLogger.WriteException(exception);
            }
        }

        public void ExitGroup(PersonalGroup group)
        {
            EventHandler<ImpsErrorEventArgs> handler = null;
            EventHandler handler2 = null;
            try
            {
                if (((UserIdentity) group.UserInfo.GroupUserIdentity.Value) == UserIdentity.SuperManager)
                {
                    this._framework.UnifiedMessageBox.ShowWarning("超级管理员不允许退出群,请先转让超级管理员身份,再退出群!");
                }
                else if (this._framework.UnifiedMessageBox.ShowConfirmation(string.Format("确认要退出群:{0}({1})吗?", group.GroupInfo.Name, group.GroupInfo.Id)) == DialogResult.Yes)
                {
                    AsyncBizOperation op = new AsyncBizOperation(group);
                    if (handler == null)
                    {
                        handler = new EventHandler<ImpsErrorEventArgs>(this, (IntPtr) this.<ExitGroup>b__10);
                    }
                    op.ImpsError += handler;
                    if (handler2 == null)
                    {
                        handler2 = delegate (object sender, EventArgs e) {
                            try
                            {
                                PersonalGroup group = (sender as AsyncBizOperation).ContextForUi as PersonalGroup;
                                this._framework.UnifiedMessageBox.ShowInfo(string.Format("您已经退出{0} ({1})。", group.GroupInfo.Name, group.GroupInfo.Id));
                            }
                            catch (Exception exception)
                            {
                                ClientLogger.WriteException(exception);
                            }
                        };
                    }
                    op.Successed += handler2;
                    this.CurrentUser.PersonalGroupManager.AsyncExitGroup(group, op);
                }
            }
            catch (Exception exception)
            {
                ClientLogger.WriteException(exception);
            }
        }

        private GroupConversationForm FindConversationForm(PersonalGroup group)
        {
            List<GroupConversationForm>.Enumerator enumerator = this.ConvForms.GetEnumerator();
            try
            {
                while (enumerator.MoveNext())
                {
                    GroupConversationForm form = enumerator.get_Current();
                    if (form.Group == group)
                    {
                        return form;
                    }
                }
            }
            finally
            {
                enumerator.Dispose();
            }
            return null;
        }

        private void form_Activated(object sender, EventArgs e)
        {
            try
            {
                (sender as GroupConversationForm).BeActivated = true;
            }
            catch (Exception exception)
            {
                ClientLogger.WriteException(exception);
            }
        }

        private void form_Deactivate(object sender, EventArgs e)
        {
            try
            {
                (sender as GroupConversationForm).BeActivated = false;
            }
            catch (Exception exception)
            {
                ClientLogger.WriteException(exception);
            }
        }

        private void form_FormClosed(object sender, FormClosedEventArgs e)
        {
            try
            {
                if (this.ConvForms.Contains(sender as GroupConversationForm))
                {
                    this.ConvForms.Remove(sender as GroupConversationForm);
                }
            }
            catch (Exception exception)
            {
                ClientLogger.WriteException(exception);
            }
        }

        private void InitImCoreEvent()
        {
            this.CurrentUser.PersonalGroupManager.ApplyJoinGroup += new EventHandler<ApplyJoinGroupEventArgs>(this, (IntPtr) this.PersonalGroupManager_ApplyJoinGroup);
            this.CurrentUser.PersonalGroupManager.ReplyResult += new EventHandler<PersonalGroupReplyResultEventArgs>(this, (IntPtr) this.PersonalGroupManager_ReplyResult);
            this.CurrentUser.PersonalGroupManager.GroupDeleted += new EventHandler<PersonalGroupEventArgs>(this, (IntPtr) this.PersonalGroupManager_GroupDeleted);
            this.CurrentUser.PersonalGroupManager.MemberDestroyed += new EventHandler<MemberDestroyedEventArgs>(this, (IntPtr) this.PersonalGroupManager_MemberDestroyed);
            this.CurrentUser.PersonalGroupManager.MeIdentityChanged += new EventHandler<GroupMemberIdentifyEventArgs>(this, (IntPtr) this.PersonalGroupManager_MeIdentityChanged);
            this.CurrentUser.PersonalGroupManager.MemberExited += new EventHandler<PersonalGroupMemberEventArgs>(this, (IntPtr) this.PersonalGroupManager_MemberExited);
            this.CurrentUser.PersonalGroupManager.InviteJoinGroup += new EventHandler<InviteJoinGroupEventArgs>(this, (IntPtr) this.PersonalGroupManager_InviteJoinGroup);
            this.CurrentUser.PersonalGroupManager.MeBeDeleted += new EventHandler<PersonalGroupEventArgs>(this, (IntPtr) this.PersonalGroupManager_MeBeDeleted);
            this.CurrentUser.PersonalGroupManager.WebJoinGroup += new EventHandler<PersonalGroupEventArgs>(this, (IntPtr) this.PersonalGroupManager_WebJoinGroup);
        }

        public void PersonalGroupManager_ApplyJoinGroup(object sender, ApplyJoinGroupEventArgs e)
        {
            Contact contact = this.CurrentUser.ContactList.FindOrCreateContact(e.MemberUri, new AsyncBizOperation());
            ApplyJoinGroupForm form = new ApplyJoinGroupForm(this._framework, contact, e.Name, e.Group, e.Description);
            form.WindowState = FormWindowState.Minimized;
            form.Show(this._framework.MainWindow);
            ControlHelper.FlashWindow(form);
            if (!this.CurrentUser.Presence.IsBusy)
            {
                try
                {
                    string content = string.Format("用户{0}({1})申请加入群{2}({3})", new object[] { contact.DisplayName, contact.Uri.Sid.ToString(), e.Group.GroupInfo.Name.Value, e.Group.GroupInfo.Id });
                    SystemInfoNotify _notifyWnd = new SystemInfoNotify("系统消息", content);
                    _notifyWnd.Click += delegate {
                        form.Activate();
                        form.WindowState = FormWindowState.Normal;
                        _notifyWnd.Close();
                    };
                    NotifyWindowManager.Add(_notifyWnd);
                }
                catch (Exception exception)
                {
                    ClientLogger.WriteException(exception);
                }
            }
        }

        private void PersonalGroupManager_GroupDeleted(object sender, PersonalGroupEventArgs e)
        {
            string details = string.Format("您所在的群{0}({1})已经被超级管理员删除!", e.PersonalGroup.GroupInfo.Name, e.PersonalGroup.GroupInfo.Id);
            ImpsMessageBox form = new ImpsMessageBox(this._framework.MainWindow, details, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            form.ShowInTaskbar = true;
            form.WindowState = FormWindowState.Minimized;
            form.Show();
            ControlHelper.FlashWindow(form);
            if (!this.CurrentUser.Presence.IsBusy)
            {
                try
                {
                    SystemInfoNotify _notifyWnd = new SystemInfoNotify("系统消息", details);
                    _notifyWnd.Click += delegate {
                        form.Activate();
                        form.WindowState = FormWindowState.Normal;
                        _notifyWnd.Close();
                    };
                    NotifyWindowManager.Add(_notifyWnd);
                }
                catch (Exception exception)
                {
                    ClientLogger.WriteException(exception);
                }
            }
        }

        private void PersonalGroupManager_InviteJoinGroup(object sender, InviteJoinGroupEventArgs e)
        {
            if ((e.Inviter != null) && (e.Group != null))
            {
                string.Format("您收到来自{0}({1})的群邀请!", e.Inviter.DisplayName, e.Inviter.Uri.Id);
                BeInvitedForm form = new BeInvitedForm(this._framework, e.Group, e.Inviter);
                form.ShowInTaskbar = true;
                form.WindowState = FormWindowState.Minimized;
                form.Show();
                ControlHelper.FlashWindow(form);
                if (!this.CurrentUser.Presence.IsBusy)
                {
                    try
                    {
                        NotifyWindowGroupMessage _notifyWnd = new NotifyWindowGroupMessage(e.Group, e.Inviter, NotifyWindowGroupMessage.MessageType.InviteJoinGroup);
                        _notifyWnd.Click += delegate {
                            form.Activate();
                            form.WindowState = FormWindowState.Normal;
                            _notifyWnd.Close();
                        };
                        NotifyWindowManager.Add(_notifyWnd);
                    }
                    catch (Exception exception)
                    {
                        ClientLogger.WriteException(exception);
                    }
                }
            }
        }

        private void PersonalGroupManager_MeBeDeleted(object sender, PersonalGroupEventArgs e)
        {
            string details = string.Format("您已被从群{0}({1})删除!", e.PersonalGroup.GroupInfo.Name, e.PersonalGroup.GroupInfo.Id);
            ImpsMessageBox form = new ImpsMessageBox(this._framework.MainWindow, details, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            form.ShowInTaskbar = true;
            form.WindowState = FormWindowState.Minimized;
            form.Show();
            ControlHelper.FlashWindow(form);
            if (!this.CurrentUser.Presence.IsBusy)
            {
                try
                {
                    SystemInfoNotify _notifyWnd = new SystemInfoNotify("系统消息", details);
                    _notifyWnd.Click += delegate {
                        form.Activate();
                        form.WindowState = FormWindowState.Normal;
                        _notifyWnd.Close();
                    };
                    NotifyWindowManager.Add(_notifyWnd);
                }
                catch (Exception exception)
                {
                    ClientLogger.WriteException(exception);
                }
            }
        }

        private void PersonalGroupManager_MeIdentityChanged(object sender, GroupMemberIdentifyEventArgs e)
        {
            string description = null;
            int num = 0;
            if (e.PersonalGroup.UserInfo.GroupUserIdentity == 2)
            {
                description = string.Format("您被指定为群{0}({1})的管理员!", e.PersonalGroup.GroupInfo.Name, e.PersonalGroup.GroupInfo.Id);
                num = 1;
            }
            else if (e.PersonalGroup.UserInfo.GroupUserIdentity == 1)
            {
                description = string.Format("您被指定为群{0}({1})的超级管理员!", e.PersonalGroup.GroupInfo.Name, e.PersonalGroup.GroupInfo.Id);
                num = 1;
            }
            else if (e.PersonalGroup.UserInfo.GroupUserIdentity == 3)
            {
                if (e.OriginalIdentity == UserIdentity.SuperManager)
                {
                    description = string.Format("您的群{0}({1})超级管理员转让成功!", e.PersonalGroup.GroupInfo.Name, e.PersonalGroup.GroupInfo.Id);
                }
                else
                {
                    description = string.Format("您被取消群{0}({1})的管理员!", e.PersonalGroup.GroupInfo.Name, e.PersonalGroup.GroupInfo.Id);
                }
                num = -1;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -