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

📄 contactmanager.cs

📁 破解的飞信源代码
💻 CS
📖 第 1 页 / 共 3 页
字号:
namespace Imps.Client.Pc
{
    using Imps.Client;
    using Imps.Client.Core;
    using Imps.Client.Pc.BizControls;
    using Imps.Client.Pc.Controls;
    using Imps.Client.Pc.Options;
    using Imps.Client.Pc.UIContactList;
    using Imps.Client.Pc.UIContactList.AddBuddy;
    using Imps.Client.Resource;
    using Imps.Client.Utils;
    using Imps.Common;
    using System;
    using System.Collections.Generic;
    using System.Runtime.InteropServices;
    using System.Windows.Forms;

    public class ContactManager : IContactManager
    {
        private Imps.Client.Pc.UIContactList.ContactListControl _contactListControl;
        private IFrameworkWindow _frameworkWnd;
        private InviteIICForm _inviteIICFForm;
        private ToolStripMenuItem _menuItem;
        private ToolStripItem[] _menuItemsOperation;
        private ToolStripMenuItem _miAddContact;
        private ToolStripMenuItem _miAddGroup;
        private ToolStripMenuItem _miBlackList;
        private ToolStripMenuItem _miBlockBuddy;
        private ToolStripMenuItem _miExport;
        private ToolStripMenuItem _miImport;
        private ToolStripMenuItem _miInviteIIC;
        private ToolStripMenuItem _miSort;
        private Dictionary<string, ProfileForm> _profileForms;
        private Dictionary<string, ProfileFormVodafone> _profileFormsVodafone;
        private SendRequestForm _sendRequestForm;
        private ToolStripItem _tiMobilemail;
        private BListControlToolbar _toolbar;
        private Imps.Client.Core.User _user;

        public ContactManager(IFrameworkWindow framework)
        {
            this._frameworkWnd = framework;
            this._user = this._frameworkWnd.AccountManager.CurrentUser;
            this.buildMenuItem();
        }

        private void _menuItem_DropDownOpening(object sender, EventArgs e)
        {
            try
            {
                if ((this._miSort.get_DropDown() == null) || (this._miSort.get_DropDown().get_Items().get_Count() == 0))
                {
                    this._miSort.set_DropDown(((Imps.Client.Pc.UIContactList.ContactListControl) this.ContactListControl).DisplayMenu);
                }
                bool flag = this._user.Status == UserAccountStatus.Logon;
                this._miAddContact.set_Enabled(flag);
                this._miInviteIIC.set_Enabled(flag);
                this._miAddGroup.set_Enabled((flag && (this._contactListControl != null)) && (this._contactListControl.CurrentTreeGroupByType == ContactTreeGroupByType.Group));
                this._miSort.set_Enabled(flag);
                this._miImport.set_Enabled(flag);
                this._miExport.set_Enabled(true);
                this._miBlockBuddy.set_Enabled(flag);
                this._miBlackList.set_Enabled(flag);
            }
            catch (Exception exception)
            {
                this._frameworkWnd.UnifiedMessageBox.ShowException(exception);
            }
        }

        private void _miBlackList_Click(object sender, EventArgs e)
        {
            UiErrorHelper.HandEventSafely(this._frameworkWnd, delegate {
                this._frameworkWnd.ShowOptions("PsBlackList");
            });
        }

        private void _miBlockBuddy_Click(object sender, EventArgs e)
        {
        }

        public void AddBuddyByMobileNo(string mobileNo, string domain, int? targetGroupId, string localName, string desc, bool sendRequestAgain, bool copyWhenExist, bool? invite, AsyncBizOperation op)
        {
            Imps.Client.Core.ContactList.AddBuddyExtraData extraData = new Imps.Client.Core.ContactList.AddBuddyExtraData();
            extraData.WhoAmI = desc;
            this._user.ContactList.AsyncAddBuddy(true, mobileNo, domain, targetGroupId, localName, extraData, sendRequestAgain, copyWhenExist, invite, op);
        }

        public void AddBuddyBySid(long sid, string domain, int? targetGroupId, string localName, string desc, bool sendRequestAgain, bool copyWhenExist, AsyncBizOperation op)
        {
            Imps.Client.Core.ContactList.AddBuddyExtraData extraData = new Imps.Client.Core.ContactList.AddBuddyExtraData();
            extraData.WhoAmI = desc;
            this._user.ContactList.AsyncAddBuddy(false, sid.ToString(), domain, targetGroupId, localName, extraData, sendRequestAgain, copyWhenExist, null, op);
        }

        public void AddBuddyByUri(string uri, int? targetGroupId, string localName, string desc, bool sendRequestAgain, bool copyWhenExist, bool? invite, AsyncBizOperation op)
        {
            IicUri uri2 = new IicUri(uri);
            if (uri2.Belongs(IicUriType.Tel))
            {
                this.AddBuddyByMobileNo(uri2.MobileNo, uri2.Domain, targetGroupId, localName, desc, sendRequestAgain, copyWhenExist, invite, op);
            }
            else if (uri2.Belongs(IicUriType.Sip))
            {
                this.AddBuddyBySid(uri2.Sid, uri2.Domain, targetGroupId, localName, desc, sendRequestAgain, copyWhenExist, op);
            }
        }

        public void AddToBlackList(IicUri uri, AsyncBizOperation op)
        {
            if (uri.IsValid)
            {
                this._user.ContactList.AsyncAddToBlackList(uri, op);
            }
        }

        private void buildMenuItem()
        {
            this._menuItem = new ToolStripMenuItem(StringTable.MI_ContactList);
            this._miSort = new ToolStripMenuItem(StringTable.MI_CL_Sort);
            this._miAddContact = new ToolStripMenuItem(StringTable.MI_CL_AddContact, ImpsIcons.AddBuddy, new EventHandler(this.miAddContact_Click));
            this._miAddGroup = new ToolStripMenuItem(StringTable.MI_CL_AddGroup, null, new EventHandler(this.miAddGroup_Click));
            this._miImport = new ToolStripMenuItem(StringTable.MI_CL_Import, ImpsResources.GetImage("Images.Import.png"), new EventHandler(this.miImport_Click));
            this._miExport = new ToolStripMenuItem(StringTable.MI_CL_Export, ImpsResources.GetImage("Images.Export.png"), new EventHandler(this.miExport_Click));
            this._miInviteIIC = new ToolStripMenuItem(StringTable.MI_CL_InviteIIC, null, new EventHandler(this.miInviteIIC_Click));
            this._miBlockBuddy = new ToolStripMenuItem("加入黑名单(&B)...", ImpsPresenceIcons.Instance.BlockIcon, new EventHandler(this._miBlockBuddy_Click));
            this._miBlackList = new ToolStripMenuItem("黑名单管理(&L)...", null, new EventHandler(this._miBlackList_Click));
            this._menuItem.set_DropDown(new menu_widget(this._frameworkWnd.ComponentContainer));
            this._menuItem.add_DropDownOpening(new EventHandler(this._menuItem_DropDownOpening));
            ToolStripSeparator separator = new ToolStripSeparator();
            separator.set_Enabled(false);
            ToolStripSeparator separator2 = new ToolStripSeparator();
            separator2.set_Enabled(false);
            this._menuItem.get_DropDown().get_Items().AddRange(new ToolStripItem[] { this._miAddContact, this._miInviteIIC, this._miAddGroup, this._miBlackList, separator, this._miSort, separator2, this._miImport, this._miExport });
        }

        private void BuildOperationMenuItems()
        {
            bool matchingEnabled = this._frameworkWnd.AccountManager.CurrentUser.Configuration.SystemSetting.ServerUriSetting.MatchingEnabled;
            List<ToolStripItem> list = new List<ToolStripItem>();
            ToolStripItem item = new ToolStripMenuItem(StringTable.MI_IM_Contacts, ImpsResources.GetImage("Images.Chat.png"), new EventHandler(this.mi_Conversion_Click));
            list.Add(item);
            item = new ToolStripMenuItem(StringTable.MI_SMS_Contacts, ImpsResources.GetImage("Images.Sms.png"), new EventHandler(this.mi_Sms_Click));
            list.Add(item);
            item = new ToolStripMenuItem(StringTable.MI_Ivr_Contacts, ImpsResources.GetImage("Images.Ivr.png"), new EventHandler(this.mi_Ivr_Click));
            list.Add(item);
            item = new ToolStripMenuItem(StringTable.MI_File_Contacts, ImpsResources.GetImage("Images.FileShare.png"), new EventHandler(this.mi_File_Click));
            list.Add(item);
            ToolStripSeparator separator = new ToolStripSeparator();
            separator.set_Enabled(false);
            list.Add(separator);
            item = new ToolStripMenuItem(StringTable.MI_Group_Create, null, delegate {
                this._frameworkWnd.PersonalGroupManager.CreatePersonalGroup(this._frameworkWnd.MainWindow);
            });
            list.Add(item);
            item = new ToolStripMenuItem(StringTable.MI_Group_Search, null, delegate {
                this._frameworkWnd.PersonalGroupManager.SearchGroup(this._frameworkWnd.MainWindow);
            });
            list.Add(item);
            ToolStripSeparator separator2 = new ToolStripSeparator();
            separator2.set_Enabled(false);
            list.Add(separator2);
            item = new ToolStripMenuItem(StringTable.MI_SendSmsToMe, null, new EventHandler(this.mi_SendSmsToMe_Click));
            list.Add(item);
            item = new ToolStripMenuItem(StringTable.MI_SendFileToMe, null, new EventHandler(this.mi_SendFileToMe_Click));
            list.Add(item);
            this._tiMobilemail = new ToolStripMenuItem("手机邮箱(&M)...", ImpsIcons.Mail, new EventHandler(this.mi_MobileMail_Click));
            list.Add(this._tiMobilemail);
            if (matchingEnabled)
            {
                ToolStripSeparator separator3 = new ToolStripSeparator();
                separator3.set_Enabled(false);
                list.Add(separator3);
                item = new ToolStripMenuItem(StringTable.MI_Match_R, null, new EventHandler(this.mi_RMatch_Click));
                list.Add(item);
                item = new ToolStripMenuItem(StringTable.MI_Match_C, null, new EventHandler(this.mi_CMatch_Click));
                list.Add(item);
            }
            this._menuItemsOperation = list.ToArray();
        }

        public void ExportContacts()
        {
        }

        private InviteIICForm GetInnerInviteIICFForm(string mobileNo)
        {
            EventHandler handler = null;
            if ((this._inviteIICFForm == null) || this._inviteIICFForm.IsDisposed)
            {
                this._inviteIICFForm = new InviteIICForm(this._frameworkWnd, mobileNo);
                if (handler == null)
                {
                    handler = delegate {
                        this._inviteIICFForm = null;
                    };
                }
                this._inviteIICFForm.Disposed += handler;
            }
            else
            {
                this._inviteIICFForm.MobileNo = mobileNo;
            }
            return this._inviteIICFForm;
        }

        public void ImportContacts()
        {
        }

        void IContactManager.OnOperationMenuItemsOpening(ToolStripMenuItem operationMenuItem)
        {
            bool flag = this._user.Status == UserAccountStatus.Logon;
            foreach (ToolStripItem item in this._menuItemsOperation)
            {
                if (item is ToolStripSeparator)
                {
                    item.set_Enabled(false);
                }
                else
                {
                    item.set_Enabled(flag);
                }
            }
            if (FuncLimitedSetting.MobileEmailFuncLimited)
            {
                this._tiMobilemail.set_Visible(false);
            }
            else
            {
                this._tiMobilemail.set_Visible(true);
                this._tiMobilemail.set_Enabled(this._user.MobileMailInfo.IsInRunningProvince.get_HasValue());
            }
        }

        private void mi_CMatch_Click(object sender, EventArgs e)
        {
            this._frameworkWnd.ContactManager.ShowConditionalMatchWindow();
        }

        private void mi_Conversion_Click(object sender, EventArgs e)
        {
            try
            {

⌨️ 快捷键说明

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