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

📄 notifywindowgroupmessage.cs

📁 破解的飞信源代码
💻 CS
字号:
namespace Imps.Client.Pc.BizControls.NotifyWindows.Templates
{
    using Imps.Client;
    using Imps.Client.Core;
    using Imps.Client.Pc.BizControls.NotifyWindows;
    using Imps.Client.Resource;
    using Imps.Client.Utils;
    using Imps.Utils;
    using System;
    using System.Drawing;
    using System.Runtime.CompilerServices;
    using System.Windows.Forms;

    public class NotifyWindowGroupMessage : NotifyWindowTemplateBase
    {
        private Imps.Client.Core.Contact _contact;
        private PersonalGroup _group;
        protected NotifyWindowLabel contentLabel;
        protected string contentText = "";
        private const int MAXLENGTH = 11;
        protected Image portraitImage;

        public event NotifyWindowEventHandler ContentClick;

        public NotifyWindowGroupMessage(PersonalGroup group, Imps.Client.Core.Contact contact, MessageType type)
        {
            if (type != MessageType.None)
            {
                this._group = group;
                this._contact = contact;
                switch (type)
                {
                    case MessageType.InviteJoinGroup:
                        base.title = "邀请你加入群";
                        this.contentText = string.Format("您收到来自{0}({1})的群邀请!", StringHelper.GetPaddingStringEndEllipsis(this._contact.DisplayName, 11), this._contact.Uri.Id);
                        break;

                    case MessageType.WebJoinGroup:
                        base.title = "Web加入群";
                        this.contentText = string.Format("您申请加入群 {0}({1})!", StringHelper.GetPaddingStringEndEllipsis(this._group.GroupInfo.Name.Value, 11), this._group.Uri.Id);
                        break;
                }
                try
                {
                    this.portraitImage = this._group.GroupInfo.Portrait.Value;
                }
                catch
                {
                    this.portraitImage = ImpsPortrait.GetDefaultGroupPortrait(0x60, 0x60);
                }
                this._group.GroupInfo.PropertiesChanged += new EventHandler<PropertiesChangedEventArgs>(this, (IntPtr) this.GroupInfo_PropertiesChanged);
                base.InitContent();
            }
        }

        private void contentLabel_Click(object sender, NotifyWindowEventArgs e)
        {
            this.OnContentClick(e);
        }

        protected override void CreateContent(NotifyWindowContent content)
        {
            Rectangle textRectangle = new Rectangle(content.Rectangle.X + 0x49, content.Rectangle.Y + ((content.Rectangle.Height - 60) / 2), 0x88, 60);
            this.contentLabel = new NotifyWindowLabel(this.contentText, textRectangle);
            this.contentLabel.Clickable = true;
            this.contentLabel.Click += new NotifyWindowEventHandler(this.contentLabel_Click);
            content.Elements.Add(this.contentLabel);
            Rectangle rectangle = new Rectangle(content.Rectangle.X + 8, content.Rectangle.Y + ((content.Rectangle.Height - 60) / 2), 60, 60);
            Bitmap bitmap = (Bitmap) ImpsResources.GetImage("Images.48.png");
            using (Graphics graphics = Graphics.FromImage(bitmap))
            {
                graphics.DrawImage(this.portraitImage, 8, 8, 0x30, 0x30);
            }
            NotifyWindowImage image = new NotifyWindowImage(rectangle, bitmap);
            content.Elements.Add(image);
        }

        private void GroupInfo_PropertiesChanged(object sender, PropertiesChangedEventArgs e)
        {
            try
            {
                this.portraitImage = this._group.GroupInfo.Portrait.Value;
                base.Invalidate(true);
            }
            catch (Exception exception)
            {
                ClientLogger.WriteException(exception);
            }
        }

        public void OnContentClick(NotifyWindowEventArgs e)
        {
            if (this.ContentClick != null)
            {
                this.ContentClick(this, e);
            }
        }

        protected override void OnFormClosed(FormClosedEventArgs e)
        {
            base.OnFormClosed(e);
            try
            {
                this._group.GroupInfo.PropertiesChanged -= new EventHandler<PropertiesChangedEventArgs>(this, (IntPtr) this.GroupInfo_PropertiesChanged);
            }
            catch
            {
            }
        }

        public enum MessageType
        {
            None,
            InviteJoinGroup,
            WebJoinGroup
        }
    }
}

⌨️ 快捷键说明

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