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

📄 contactlistcontrol.cs

📁 飞信的收发使用csharp进行开发
💻 CS
📖 第 1 页 / 共 4 页
字号:
        {
            try
            {
                if (this.CurrentUser.Status == UserAccountStatus.Logon)
                {
                    if (e.Type == ContactGroupEventType.NameChanged)
                    {
                        this.m_buddytree_widget.rename_group(e.ContactGroup, e.ContactGroup.DisplayName, true);
                    }
                    else if (e.Type == ContactGroupEventType.Added)
                    {
                        if (this._currentTreeGroupByType == ContactTreeGroupByType.Group)
                        {
                            this.m_buddytree_widget.add_group_sorted(e.ContactGroup, true);
                        }
                    }
                    else if (e.Type == ContactGroupEventType.Deleted)
                    {
                        this.m_buddytree_widget.remove_group(e.ContactGroup, true);
                    }
                }
            }
            catch (Exception exception)
            {
                this.m_buddytree_widget.sort_allitems(true);
                ClientLogger.WriteException(exception);
            }
        }

        private void ContactListControl_Load(object sender, EventArgs e)
        {
            this.InitBuddyTree();
            this.stbtnAddBuddy.Image = ImpsIcons.AddBuddy;
            this.tsddbDisplayMode.Image = ImpsIcons.DisplayMode;
            this._user_StatusChanged(this.CurrentUser, new UserSatusChangedEventArgs(UserAccountStatus.None, this.CurrentUser.Status));
        }

        private void contactNodes_Add(Imps.Client.Core.Contact contact)
        {
            try
            {
                if (contact == null)
                {
                    return;
                }
                if (!this.m_buddytree_widget.searching)
                {
                    switch (this._currentTreeGroupByType)
                    {
                        case ContactTreeGroupByType.Group:
                            break;

                        case ContactTreeGroupByType.Terminal:
                            foreach (SystemFixedContactGroup group3 in this.GroupsByTerminal)
                            {
                                if (group3.UpdateBelong(contact))
                                {
                                    this.m_buddytree_widget.add_buddy(group3, contact, false);
                                }
                            }
                            goto Label_0182;

                        case ContactTreeGroupByType.Presence:
                            foreach (SystemFixedContactGroup group2 in this.GroupsByPresence)
                            {
                                if (group2.UpdateBelong(contact))
                                {
                                    this.m_buddytree_widget.add_buddy(group2, contact, false);
                                }
                            }
                            goto Label_0182;

                        default:
                            goto Label_0182;
                    }
                    if (contact.BelongToGroups.Count > 0)
                    {
                        foreach (int num in contact.BelongToGroups)
                        {
                            Imps.Client.Core.ContactGroup group = this.ContactList.Groups[new int?(num)] as Imps.Client.Core.ContactGroup;
                            try
                            {
                                this.m_buddytree_widget.add_buddy(group, contact, false);
                                continue;
                            }
                            catch (Exception exception)
                            {
                                ClientLogger.WriteException("ContactNodes_Add Error", exception);
                                continue;
                            }
                        }
                    }
                    else
                    {
                        this.m_buddytree_widget.add_buddy(contact, false);
                    }
                }
                else if (contact.MatchSearch(this.tstbSearch.Text.Trim().ToLower()))
                {
                    this.m_buddytree_widget.add_buddy(contact, false);
                }
            Label_0182:
                if (this._isWizardVisible)
                {
                    this.setWizardUiOnNoneContact(false);
                }
            }
            catch (Exception exception2)
            {
                ClientLogger.WriteException(exception2);
            }
        }

        private void contactNodes_Delete(Imps.Client.Core.Contact contact)
        {
            this.m_buddytree_widget.remove_buddy(contact, true);
            if (this._forceDisplayGroup == false)
            {
                this.setWizardUiOnNoneContact(true);
            }
        }

        private void contactNodes_Update(Imps.Client.Core.Contact contact)
        {
            this.contactNodes_Delete(contact);
            this.contactNodes_Add(contact);
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void handleContactInfoChanged_Tick(object sender, EventArgs e)
        {
            lock (this._contactInfoChangedCol)
            {
                for (int i = this._contactInfoChangedCol.Count - 1; i >= 0; i--)
                {
                    Imps.Client.Core.Contact contact = this._contactInfoChangedCol[i];
                    if (contact.Type == ContactType.Stranger)
                    {
                        this._contactInfoChangedCol.RemoveAt(i);
                    }
                    else
                    {
                        if (!this.m_buddytree_widget.searching)
                        {
                            this.m_buddytree_widget.update_contact_info(contact, ContactEventType.PropertiesChanged, false, false);
                        }
                        else
                        {
                            bool flag = this._searchResult.Contains(contact);
                            bool flag2 = contact.MatchSearch(this.tstbSearch.Text.Trim().ToLower());
                            if (flag && !flag2)
                            {
                                this._searchResult.Remove(contact);
                                this.bindSearchResult();
                            }
                            else if (!flag && flag2)
                            {
                                this._searchResult.Add(contact);
                                this.bindSearchResult();
                            }
                        }
                        this._contactInfoChangedCol.RemoveAt(i);
                    }
                }
                if (this._contactInfoChangedCol.Count <= 0)
                {
                    GlobalTimer.Unregister(new EventHandler(this.handleContactInfoChanged_Tick));
                }
            }
            this.m_buddytree_widget.sort_allitems(true);
        }

        private void handleContactPresenceChanged_Tick(object sender, EventArgs e)
        {
            if (this.CurrentUser.Status == UserAccountStatus.Logon)
            {
                lock (this._contactPresenceChangedCol)
                {
                    for (int i = this._contactPresenceChangedCol.Count - 1; i >= 0; i--)
                    {
                        ContactChangedEventArgs args = this._contactPresenceChangedCol[i];
                        Imps.Client.Core.Contact contact = args.Contact;
                        if (contact.Type == ContactType.Stranger)
                        {
                            this._contactPresenceChangedCol.RemoveAt(i);
                        }
                        else
                        {
                            if (this._currentTreeGroupByType == ContactTreeGroupByType.Group)
                            {
                                this.m_buddytree_widget.update_contact_info(contact, args.ContactEventType, false, false);
                            }
                            else
                            {
                                if (this._currentTreeGroupByType == ContactTreeGroupByType.Presence)
                                {
                                    foreach (SystemFixedContactGroup group in this.GroupsByPresence)
                                    {
                                        group.UpdateBelong(contact);
                                    }
                                }
                                else if (this._currentTreeGroupByType == ContactTreeGroupByType.Terminal)
                                {
                                    foreach (SystemFixedContactGroup group2 in this.GroupsByTerminal)
                                    {
                                        group2.UpdateBelong(contact);
                                    }
                                }
                                this.contactNodes_Update(contact);
                                this.m_buddytree_widget.sort_allitems(true);
                            }
                            this._contactNotifyWindowManager.ContactPresenceChanged_NotifyWnd(contact, args.PresencePropertiesChangedEventArgs);
                            this._contactPresenceChangedCol.RemoveAt(i);
                        }
                    }
                    if (this._contactPresenceChangedCol.Count <= 0)
                    {
                        GlobalTimer.Unregister(new EventHandler(this.handleContactPresenceChanged_Tick));
                    }
                }
                this.m_buddytree_widget.sort_allitems(true);
            }
        }

        private void InitBuddyTree()
        {
            this.m_buddytree_widget.on_drop_contact_into_group += new buddytree_widget.drop_contact_into_group_handler(this.on_drop_contact_into_group);
            this.m_buddytree_widget.on_group_expand_changed += new buddytree_widget.group_expand_changed_handler(this.on_group_expand_changed);
            this.m_buddytree_widget.on_showdetail_change_cmd += new buddytree_widget.showstyle_change_cmd_handler(this.on_showdetail_change_cmd);
            this.m_buddytree_widget.on_showdetailtip_change_cmd += new buddytree_widget.showstyle_change_cmd_handler(this.on_showdetailtip_change_cmd);
            this.m_buddytree_widget.on_sortstyle_change_cmd += new buddytree_widget.sortstyle_change_cmd_handler(this.on_sortstyle_change_cmd);
        }

        private void InitializeComponent()
        {
            this.components = new Container();
            ComponentResourceManager manager = new ComponentResourceManager(typeof(ContactListControl));
            crystal_band_colors _colors = new crystal_band_colors();
            crystal_band_colors _colors2 = new crystal_band_colors();
            this.imageListDrag = new ImageList(this.components);
            this.imageListTree = new ImageList(this.components);
            this.panelEmpty = new Panel();
            this.pbInput = new PictureBox();
            this.lblImport = new LinkLabel();
            this.pbMatch = new PictureBox();
            this.lblMatch = new LinkLabel();
            this.label1 = new Label();
            this.pbAddBuddy = new PictureBox();
            this.lblAddBuddy = new LinkLabel();
            this.m_buddytree_vscroll_widget = new vscroll_widget();
            this.m_buddytree_widget = new buddytree_widget();
            this.xToolBarContactList = new SearchContactToolstrip();
            this.panelEmpty.SuspendLayout();
            ((ISupportInitialize) this.pbInput).BeginInit();
            ((ISupportInitialize) this.pbMatch).BeginInit();
            ((ISupportInitialize) this.pbAddBuddy).BeginInit();
            base.SuspendLayout();
            this.imageListDrag.ColorDepth = ColorDepth.Depth8Bit;
            this.imageListDrag.ImageSize = new Size(0x10, 0x10);
            this.imageListDrag.TransparentColor = Color.Transparent;
            this.imageListTree.ImageStream = (ImageListStreamer) manager.GetObject("imageListTree.ImageStream");
            this.imageListTree.TransparentColor = Color.Transparent;
            this.imageListTree.Images.SetKeyName(0, "java_16x16.gif");
            this.imageListTree.Images.SetKeyName(1, "女头像(灰度)_16x16.png");
            this.panelEmpty.BackColor = Color.Transparent;
            this.panelEmpty.Controls.Add(this.pbInput);
            this.panelEmpty.Controls.Add(this.lblImport);
            this.panelEmpty.Controls.Add(this.pbMatch);
            this.panelEmpty.Controls.Add(this.lblMatch);
            this.panelEmpty.Controls.Add(this.label1);
            this.panelEmpty.Controls.Add(this.pbAddBuddy);
            this.panelEmpty.Controls.Add(this.lblAddBuddy);
            this.panelEmpty.Location = new Point(14, 0x49);
            this.panelEmpty.Name = "panelEmpty";
            this.panelEmpty.Size = new Size(200, 0x8d);
            this.panelEmpty.TabIndex = 4;
            this.pbInput.ErrorImage = null;
            this.pbInput.Location = new Point(0x27, 0x66);
            this.pbInput.Name = "pbInput";
            this.pbInput.Size = new Size(0x18, 0x16);
            this.pbInput.TabIndex = 6;
            this.pbInput.TabStop = false;
            this.lblImport.AutoSize = true;
            this.lblImport.Font = new Font("SimSun", 11.25f, FontStyle.Regular, GraphicsUnit.Point, 0x86);
            this.lblImport.Location = new Point(0x45, 0x6b);
            this.lblImport.Name = "lblImport";
            this.lblImport.Size = new Size(0x43, 15);
            this.lblImport.TabIndex = 5;
            this.lblImport.TabStop = true;
            this.lblImport.Text = "导入好友";
            this.lblImport.Click += new EventHandler(this.lblImput_Click);
            this.pbMatch.ErrorImage = null;
            this.pbMatch.Location = new Point(0x27, 0x48);
            this.pbMatch.Name = "pbMatch";
            this.pbMatch.Size = new Size(0x18, 0x16);
            this.pbMatch.TabIndex = 4;
            this.pbMatch.TabStop = false;
            this.lblMatch.AutoSize = true;
            this.lblMatch.Font = new Font("SimSun", 11.25f, FontStyle.Regular, GraphicsUnit.Point, 0x86);
            this.lblMatch.Location = new Point(0x45, 0x4d);
            this.lblMatch.Name = "lblMatch";
            this.lblMatch.Size = new Size(0x43, 15);
            this.lblMatch.TabIndex = 3;
            this.lblMatch.TabStop = true;
            this.lblMatch.Text = "速配交友";
            this.lblMatch.Click += new EventHandler(this.lblMatch_Click);
            this.label1.AutoSize = true;
            this.label1.Font = new Font("SimSun", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 0x86);
            this.label1.Location = new Point(8, 10);
            this.label1.Name = "label1";
            this.label1.Size = new Size(0x6f, 13);
            this.label1.TabIndex = 2;
            this.label1.Text = "您现在还没有好友";
            this.pbAddBuddy.ErrorImage = null;
            this.pbAddBuddy.Location = new Point(0x27, 0x2a);
            this.pbAddBuddy.Name = "pbAddBuddy";

⌨️ 快捷键说明

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