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

📄 tree_widget_buddy.cs

📁 破解的飞信源代码
💻 CS
📖 第 1 页 / 共 3 页
字号:
                fmt.Alignment = StringAlignment.Near;
                fmt.LineAlignment = StringAlignment.Center;
                fmt.FormatFlags |= StringFormatFlags.NoWrap;
                fmt.Trimming = StringTrimming.EllipsisCharacter;
                int left = rect.Right + this.m_inner_space;
                int right = rc.Right - this.m_inner_space;
                Rectangle rectangle2 = Rectangle.FromLTRB(left, rc.Top + this.m_Singleinner_space, right, rc.Bottom);
                this.m_rich_name.Draw(g, base.host.Font, Color.Black, rectangle2, fmt, ref left);
                if (this.m_rich_name.MeasureText(g, base.host.Font).Width < rectangle2.Width)
                {
                    if (this.m_contact.RelationStatusIsAgree)
                    {
                        Rectangle rectangle3 = Rectangle.FromLTRB(left + this.m_inner_space, rectangle2.Top, right, rectangle2.Bottom);
                        this.m_rich_personal_message.Draw(g, base.host.Font, Color.Gray, rectangle3, fmt, ref left);
                        if (this.m_rich_personal_message.MeasureText(g, base.host.Font).Width >= rectangle3.Width)
                        {
                            return;
                        }
                        left += this.m_inner_space;
                        if (left >= right)
                        {
                            return;
                        }
                        using (Brush brush = new SolidBrush(Color.Silver))
                        {
                            if (this.m_status_changed)
                            {
                                SizeF ef3 = g.MeasureString(this.m_status, base.host.Font);
                                this.m_status_size = new Size(((int) ef3.Width) + 2, ((int) ef3.Height) + 2);
                                this.m_status_changed = false;
                            }
                            Rectangle layoutRectangle = Rectangle.FromLTRB(left, rectangle2.Top, ((left + this.m_status_size.Width) > right) ? right : (left + this.m_status_size.Width), rectangle2.Bottom);
                            g.DrawString(this.m_status, base.host.Font, brush, layoutRectangle, fmt);
                            return;
                        }
                    }
                    using (Brush brush2 = new SolidBrush(Color.Silver))
                    {
                        if (left < right)
                        {
                            string postfixReject = string.Empty;
                            int? nullable = this.relation_status;
                            if ((2 == nullable.GetValueOrDefault()) && nullable.get_HasValue())
                            {
                                postfixReject = StringTable.Buddy.PostfixReject;
                            }
                            else
                            {
                                int? nullable2 = this.relation_status;
                                if ((nullable2.GetValueOrDefault() == 0) && nullable2.get_HasValue())
                                {
                                    postfixReject = StringTable.Buddy.PostfixWaiting;
                                }
                            }
                            if (this.m_relation_status_changed)
                            {
                                SizeF ef4 = g.MeasureString(postfixReject, base.host.Font);
                                this.m_relation_status_size = new Size(((int) ef4.Width) + 2, ((int) ef4.Height) + 2);
                                this.m_relation_status_changed = false;
                            }
                            Rectangle rectangle5 = Rectangle.FromLTRB(left, rectangle2.Top, ((left + this.m_relation_status_size.Width) > right) ? right : (left + this.m_relation_status_size.Width), rectangle2.Bottom);
                            g.DrawString(postfixReject, base.host.Font, brush2, rectangle5, fmt);
                            left += this.m_relation_status_size.Width;
                        }
                    }
                }
            }
        }

        internal override void on_after_edit(string strNewText, object context)
        {
            if (!(context is bool))
            {
                throw new ArgumentException("context is not bool type");
            }
            if ((bool) context)
            {
                this.m_contact.PersonalInfo.Name.UserSetDataProposedValue = strNewText.Trim();
                AsyncBizOperation op = new AsyncBizOperation();
                this.m_contact.PersonalInfo.CommitChanges(op);
            }
        }

        internal override void on_before_edit(object initParam, ref Rectangle rcEdit, ref string strInitText, ref object context, ref bool fCancel)
        {
            if (base.host != null)
            {
                base.on_before_edit(initParam, ref rcEdit, ref strInitText, ref context, ref fCancel);
                if (!this.m_contact.EnableEditUserSetProfile)
                {
                    fCancel = true;
                }
                else
                {
                    Rectangle rectangle;
                    int preferedWidth = this.m_rich_name.PreferedWidth;
                    switch (((buddytree_widget) base.host).DisplayMode)
                    {
                        case BuddyTreeDisplayMode.SingleLine:
                            rectangle = Rectangle.FromLTRB((rcEdit.Left + 0x10) + this.m_inner_space, rcEdit.Top, ((rcEdit.Left + 0x10) + this.m_inner_space) + preferedWidth, rcEdit.Bottom - this.m_inner_space);
                            break;

                        case BuddyTreeDisplayMode.DoubleLine:
                            rectangle = Rectangle.FromLTRB(((rcEdit.Left + rcEdit.Height) + 0x10) + this.m_inner_space, rcEdit.Top + this.m_inner_space, (((rcEdit.Left + rcEdit.Height) + 0x10) + this.m_inner_space) + preferedWidth, rcEdit.Top + (rcEdit.Height / 2));
                            break;

                        case BuddyTreeDisplayMode.LargeIcon:
                            rectangle = Rectangle.FromLTRB(rcEdit.Left + 11, rcEdit.Bottom - 0x18, (rcEdit.Right - 0x10) - 11, rcEdit.Bottom - 8);
                            break;

                        default:
                            rectangle = Rectangle.FromLTRB(rcEdit.Left + 7, rcEdit.Bottom - 0x15, rcEdit.Right - 5, rcEdit.Bottom - 5);
                            break;
                    }
                    strInitText = this.name;
                    context = true;
                    if (rectangle.Right > (base.bounds.Right - this.m_inner_space))
                    {
                        rectangle.Width = (base.bounds.Right - this.m_inner_space) - rectangle.Left;
                    }
                    rcEdit = rectangle;
                }
            }
        }

        internal override void on_before_edit(Rectangle rcItem, System.Drawing.Point ptClick, ref Rectangle rcEdit, ref string strInitText, ref object context, ref bool fCancel)
        {
            base.on_before_edit(rcItem, ptClick, ref rcEdit, ref strInitText, ref context, ref fCancel);
            fCancel = true;
        }

        private void on_left_click(MouseEventArgs args, Rectangle rcItem, area_type area)
        {
            try
            {
                IFrameworkWindowAgency agency = (base.host as buddytree_widget).iframework_wnd_agency;
                IFrameworkWindow window = agency.iframework_wnd;
                switch (area)
                {
                    case area_type.icon:
                    {
                        agency.contact_manager.ShowContactDetail(window.MainWindow, this.contact.Uri.Raw);
                        contact_tip_widget _widget = contact_tip_builder.create((base.host as buddytree_widget).iframework_wnd);
                        if (_widget != null)
                        {
                            _widget.Hide();
                        }
                        return;
                    }
                    case area_type.name:
                        return;

                    case area_type.crbt_to_me:
                        if (this.crbt_to_me.IsValid())
                        {
                            Rectangle rectangle2 = base.host.RectangleToScreen(rcItem);
                            rectangle2.X -= rcItem.Left - base.host.ClientRectangle.Left;
                            rectangle2.Width += rcItem.Left - base.host.ClientRectangle.Left;
                            contact_tip_widget _widget3 = contact_tip_builder.create((base.host as buddytree_widget).iframework_wnd);
                            if (_widget3 != null)
                            {
                                _widget3.owner = base.host;
                                _widget3.show_crbt(this.contact, rectangle2, true);
                            }
                        }
                        return;

                    case area_type.crbt_to_buddy:
                        if (this.crbt_to_contact.IsValid())
                        {
                            Rectangle rectangle = base.host.RectangleToScreen(rcItem);
                            rectangle.X -= rcItem.Left - base.host.ClientRectangle.Left;
                            rectangle.Width += rcItem.Left - base.host.ClientRectangle.Left;
                            contact_tip_widget _widget2 = contact_tip_builder.create((base.host as buddytree_widget).iframework_wnd);
                            if (_widget2 != null)
                            {
                                _widget2.owner = base.host;
                                _widget2.show_crbt(this.contact, rectangle, false);
                            }
                        }
                        return;
                }
            }
            catch (Exception exception)
            {
                ClientLogger.WriteException(exception);
            }
        }

        private void on_left_dbclick(MouseEventArgs args, Rectangle rcItem, area_type area)
        {
            try
            {
                IFrameworkWindowAgency agency = (base.host as buddytree_widget).iframework_wnd_agency;
                IFrameworkWindow window = agency.iframework_wnd;
                switch (area)
                {
                    case area_type.outside:
                    case area_type.normal:
                    case area_type.name:
                        if (agency.current_user.Status != UserAccountStatus.OfflineLogon)
                        {
                            break;
                        }
                        agency.contact_manager.ShowContactDetail(window.MainWindow, this.contact.Uri.Raw);
                        return;

                    case area_type.icon:
                        return;

                    default:
                        return;
                }
                agency.conversation_manager.StartConversation(window.MainWindow, ConversationOperation.ImChat, new string[] { this.contact.Uri.Raw });
            }
            catch (Exception exception)
            {
                ClientLogger.WriteException(exception);
            }
        }

        internal override void on_mousedoubleclick(MouseEventArgs args, Rectangle rcItem)
        {
            base.on_mousedoubleclick(args, rcItem);
            if (MouseButtons.Left == args.Button)
            {
                this.on_left_dbclick(args, rcItem, this.test_area(args.get_Location(), rcItem));
            }
        }

        internal override void on_mousedown(MouseEventArgs args, Rectangle rcItem)
        {
            base.on_mousedown(args, rcItem);
            if (MouseButtons.Left == args.Button)
            {
                this.last_leftdown_area = this.test_area(args.get_Location(), rcItem);
            }
            else
            {
                this.last_leftdown_area = area_type.outside;
            }
        }

        internal override void on_mousemove(MouseEventArgs args, Rectangle rc)
        {
            base.on_mousemove(args, rc);
            this.mouse_location_area = this.test_area(args.get_Location(), rc);
        }

        internal override bool on_mouseup(MouseEventArgs args, Rectangle rcItem)
        {
            base.on_mouseup(args, rcItem);
            if ((MouseButtons.Left != args.Button) || (this.test_area(args.get_Location(), rcItem) != this.last_leftdown_area))
            {
                return false;
            }
            this.on_left_click(args, rcItem, this.m_last_leftdown_area);
            if ((this.m_last_leftdown_area != area_type.crbt_to_buddy) && (this.m_last_leftdown_area != area_type.crbt_to_me))
            {
                return (this.m_last_leftdown_area == area_type.icon);
            }
            return true;
        }

        private area_type test_area(System.Drawing.Point location, Rectangle rcItem)
        {
            BuddyTreeDisplayMode displayMode = ((buddytree_widget) base.host).DisplayMode;
            if ((displayMode == BuddyTreeDisplayMode.SingleLine) || (displayMode == BuddyTreeDisplayMode.DoubleLine))
            {
                Rectangle empty = Rectangle.Empty;
                switch (displayMode)
                {
                    case BuddyTreeDisplayMode.DoubleLine:
                    {
                        empty = Rectangle.FromLTRB(rcItem.Left + this.m_inner_space, rcItem.Top + this.m_inner_space, (rcItem.Left + rcItem.Height) - this.m_inner_space, rcItem.Bottom - this.m_inner_space);
                    }
                }
                if (empty.Contains(location))
                {
                    return area_type.icon;
                }
                Rectangle rectangle2 = Rectangle.Empty;
                int preferedWidth = this.m_rich_name.PreferedWidth;
                int left = 0;
                switch (displayMode)
                {
                    case BuddyTreeDisplayMode.SingleLine:
                        left = (rcItem.Left + 0x10) + this.m_inner_space;
                        rectangle2 = Rectangle.FromLTRB(left, rcItem.Top + this.m_inner_space, left + preferedWidth, rcItem.Top + rcItem.Height);
                        break;

                    case BuddyTreeDisplayMode.DoubleLine:
                        left = ((rcItem.Left + rcItem.Height) + 0x10) + this.m_inner_space;
                        rectangle2 = Rectangle.FromLTRB(left, rcItem.Top + this.m_inner_space, left + preferedWidth, rcItem.Top + (rcItem.Height / 2));
                        break;
                }
                if (rectangle2.Contains(location))
                {
                    return area_type.name;
                }
                if ((displayMode == BuddyTreeDisplayMode.DoubleLine) && (location.Y >= ((rcItem.Top + (rcItem.Height / 2)) + this.m_inner_space)))
                {
                    int num3 = ((rcItem.Left + rcItem.Height) + 0x10) + this.m_inner_space;
                    if (this.crbt_to_me.IsValid())
                    {
                        int width = 0;
                        width = ((rcItem.Right - num3) - 0x10) - this.m_inner_space;
                        if (width > this.m_crbt_to_me_size.Width)
                        {
                            width = this.m_crbt_to_me_size.Width;
                        }
                        if (0 > width)
                        {
                            width = 0;
                        }
                        if (((location.X <= ((num3 + 0x10) + width)) && (location.X >= num3)) && ((location.Y <= (rcItem.Bottom - this.m_inner_space)) && (location.Y >= ((rcItem.Top + (rcItem.Height / 2)) + this.m_inner_space))))
                        {
                            return area_type.crbt_to_me;
                        }
                        num3 += (width + 0x10) + this.m_inner_space;
                    }
                }
            }
            if (rcItem.Contains(location))
            {
                return area_type.normal;
            }
            return area_type.outside;

⌨️ 快捷键说明

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