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

📄 contactmanager.cs

📁 飞信的收发使用csharp进行开发
💻 CS
📖 第 1 页 / 共 2 页
字号:
                parent = (Form) this._frameworkWnd;
            }
            ControlHelper.ShowFormCenterOnParent(innerSendRequestFrom, parent);
        }

        public void ShowConditionalMatchWindow()
        {
            this._frameworkWnd.NavigateToTab("BuddyMatch", "status=2");
        }

        public void ShowContactDeleteWindow(IicUri iicUri)
        {
            new ContactDelete(this._frameworkWnd, iicUri.Raw).ShowDialog(this._frameworkWnd as Form);
        }

        public void ShowContactDetail(string contactUri)
        {
            this.ShowContactDetail(null, contactUri);
        }

        public void ShowContactDetail(IWin32Window owner, string contactUri)
        {
            FormClosedEventHandler handler = null;
            FormClosedEventHandler handler2 = null;
            IicUri uri = new IicUri(contactUri);
            if (uri.IsValid && uri.IsContact)
            {
                ProfileForm form;
                ProfileFormVodafone vodafone;
                string key = contactUri.ToLower();
                if (this.ProfileForms.TryGetValue(key, out form) && !form.IsHandleCreated)
                {
                    this.ProfileForms.Remove(key);
                    form = null;
                }
                if (this.ProfileFormsVodafone.TryGetValue(key, out vodafone) && !vodafone.IsHandleCreated)
                {
                    this.ProfileFormsVodafone.Remove(key);
                    vodafone = null;
                }
                if (uri.IsVodafoneUri)
                {
                    if (form != null)
                    {
                        form.Close();
                    }
                    if (vodafone == null)
                    {
                        Imps.Client.Core.Contact contact = this._user.ContactList.FindOrCreateContact(contactUri, null, false);
                        if (contact.Uri.IsVodafoneUri)
                        {
                            vodafone = new ProfileFormVodafone(this._frameworkWnd, contact);
                            if (handler == null)
                            {
                                handler = delegate (object sender, FormClosedEventArgs e) {
                                    ProfileFormVodafone vodafone = (ProfileFormVodafone) sender;
                                    foreach (KeyValuePair<string, ProfileFormVodafone> pair in this.ProfileFormsVodafone)
                                    {
                                        if (pair.Value == vodafone)
                                        {
                                            this.ProfileFormsVodafone.Remove(pair.Key);
                                            break;
                                        }
                                    }
                                };
                            }
                            vodafone.FormClosed += handler;
                            this.ProfileFormsVodafone.Add(key, vodafone);
                        }
                    }
                    if (vodafone.Visible)
                    {
                        vodafone.BringToFront();
                        vodafone.Activate();
                    }
                    else
                    {
                        Form form2 = owner as Form;
                        if (form2 == null)
                        {
                            form2 = (Form) this._frameworkWnd;
                        }
                        vodafone.ShowProfile(form2);
                    }
                }
                else
                {
                    if (vodafone != null)
                    {
                        vodafone.Close();
                    }
                    if (form == null)
                    {
                        Imps.Client.Core.Contact contact2 = this._user.ContactList.FindOrCreateContact(contactUri, null, false);
                        form = new ProfileForm(this._frameworkWnd, contact2);
                        if (handler2 == null)
                        {
                            handler2 = delegate (object sender, FormClosedEventArgs e) {
                                ProfileForm form = (ProfileForm) sender;
                                foreach (KeyValuePair<string, ProfileForm> pair in this.ProfileForms)
                                {
                                    if (pair.Value == form)
                                    {
                                        this.ProfileForms.Remove(pair.Key);
                                        break;
                                    }
                                }
                            };
                        }
                        form.FormClosed += handler2;
                        this.ProfileForms.Add(key, form);
                    }
                    if (form.Visible)
                    {
                        form.BringToFront();
                        form.Activate();
                    }
                    else
                    {
                        Form form3 = owner as Form;
                        if (form3 == null)
                        {
                            form3 = (Form) this._frameworkWnd;
                        }
                        form.ShowProfile(form3);
                    }
                }
            }
        }

        public void ShowContactPermission(IWin32Window owner, IicUri uri)
        {
            FormClosedEventHandler handler = null;
            if (uri.IsValid)
            {
                ProfileForm form;
                string key = uri.Raw.ToLower();
                if (this.ProfileForms.TryGetValue(key, out form) && !form.IsHandleCreated)
                {
                    this.ProfileForms.Remove(key);
                    form = null;
                }
                if (form == null)
                {
                    Imps.Client.Core.Contact contact = this._user.ContactList.FindOrCreateContact(uri.Raw, null, false);
                    form = new ProfileForm(this._frameworkWnd, contact);
                    if (handler == null)
                    {
                        handler = delegate (object sender, FormClosedEventArgs e) {
                            ProfileForm form = (ProfileForm) sender;
                            foreach (KeyValuePair<string, ProfileForm> pair in this.ProfileForms)
                            {
                                if (pair.Value == form)
                                {
                                    this.ProfileForms.Remove(pair.Key);
                                    break;
                                }
                            }
                        };
                    }
                    form.FormClosed += handler;
                    this.ProfileForms.Add(key, form);
                }
                form.ShowProfile(owner, StringTable.ContactProfile.KeyPermissionSettring);
                if (form.Visible)
                {
                    form.BringToFront();
                    form.Activate();
                }
                else
                {
                    Form form2 = owner as Form;
                    if (form2 == null)
                    {
                        form2 = (Form) this._frameworkWnd;
                    }
                    form.Location = form2.PointToScreen(form2.ClientRectangle.Location);
                    form.ShowProfile(form2);
                }
            }
        }

        public void ShowGroupCreateWindow(IWin32Window owner)
        {
            if (owner == null)
            {
                owner = this._frameworkWnd as Form;
            }
            AsyncBizOperation op = new AsyncBizOperation();
            ContactGroupForm form = new ContactGroupForm(this._frameworkWnd, null, op);
            op.ImpsError += delegate (object sender, ImpsErrorEventArgs e) {
                this._contactListControl.SetWizardForceDisplayGroup(true);
                UiErrorHelper.ShowImpsError(this._frameworkWnd, form, e);
            };
            op.Successed += delegate (object sender, EventArgs e) {
                this._contactListControl.SetWizardForceDisplayGroup(true);
            };
            form.StartPosition = FormStartPosition.CenterParent;
            form.ShowDialog(owner);
        }

        public void ShowGroupDeleteWindow(int? groupId)
        {
            if (groupId.HasValue)
            {
                Imps.Client.Core.ContactGroup group = this._user.ContactList.Groups[groupId] as Imps.Client.Core.ContactGroup;
                if (group != null)
                {
                    if (group.Contacts.Count > 0)
                    {
                        this._frameworkWnd.UnifiedMessageBox.ShowInfo(StringTable.ContactGroup.MsgCannotDelelte_HasContacts);
                    }
                    else if (((this._user.ContactList.Groups[-1] != null) && (this._user.ContactList.Groups.Count == 2)) || ((this._user.ContactList.Groups[-1] == null) && (this._user.ContactList.Groups.Count == 1)))
                    {
                        this._frameworkWnd.UnifiedMessageBox.ShowInfo(StringTable.ContactGroup.MsgCannotDelelte_OnlyOne);
                    }
                    else
                    {
                        group.AsyncDelete(new AsyncBizOperation());
                    }
                }
            }
        }

        public void ShowGroupEditWindow(int? groupId)
        {
            if (groupId.HasValue)
            {
                AsyncBizOperation op = new AsyncBizOperation();
                op.ImpsError += delegate (object sender, ImpsErrorEventArgs e) {
                    this._contactListControl.SetWizardForceDisplayGroup(true);
                };
                op.Successed += delegate (object sender, EventArgs e) {
                    this._contactListControl.SetWizardForceDisplayGroup(true);
                };
                ContactGroupForm form = new ContactGroupForm(this._frameworkWnd, groupId, op);
                form.StartPosition = FormStartPosition.CenterParent;
                form.ShowDialog(this._frameworkWnd as Form);
            }
        }

        public void ShowInviteIICWindow(string mobileNo)
        {
            InviteIICForm innerInviteIICFForm = this.GetInnerInviteIICFForm(mobileNo);
            innerInviteIICFForm.Location = (this._frameworkWnd as Form).PointToScreen((this._frameworkWnd as Form).ClientRectangle.Location);
            ControlHelper.ShowFormCenterOnParent(innerInviteIICFForm, this._frameworkWnd as Form);
        }

        public void ShowMatchWindow()
        {
            this._frameworkWnd.NavigateToTab("BuddyMatch", string.Empty);
        }

        public void ShowRadomMatchWindow()
        {
            this._frameworkWnd.NavigateToTab("BuddyMatch", "status=1");
        }

        public void ShowSendSmsToMeWindow()
        {
        }

        public bool TryAddContactGroup(string name, out int? groupId)
        {
            groupId = 1;
            return true;
        }

        public Control ContactListControl
        {
            get
            {
                if (this._contactListControl == null)
                {
                    this._contactListControl = new Imps.Client.Pc.UIContactList.ContactListControl(this._frameworkWnd);
                }
                return this._contactListControl;
            }
        }

        private SendRequestForm InnerSendRequestFrom
        {
            get
            {
                if ((this._sendRequestForm == null) || this._sendRequestForm.IsDisposed)
                {
                    this._sendRequestForm = new SendRequestForm(this._frameworkWnd);
                }
                return this._sendRequestForm;
            }
        }

        public ToolStripMenuItem MenuItem
        {
            get
            {
                return this._menuItem;
            }
        }

        public ToolStripItem[] OperationMenuItems
        {
            get
            {
                this.BuildOperationMenuItems();
                return this._menuItemsOperation;
            }
        }

        private Dictionary<string, ProfileForm> ProfileForms
        {
            get
            {
                if (this._profileForms == null)
                {
                    this._profileForms = new Dictionary<string, ProfileForm>();
                }
                return this._profileForms;
            }
        }

        private Dictionary<string, ProfileFormVodafone> ProfileFormsVodafone
        {
            get
            {
                if (this._profileFormsVodafone == null)
                {
                    this._profileFormsVodafone = new Dictionary<string, ProfileFormVodafone>();
                }
                return this._profileFormsVodafone;
            }
        }
    }
}

⌨️ 快捷键说明

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