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

📄 recivemessagenotifyform.cs

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

    public class ReciveMessageNotifyForm : NotifyWindowTemplateBase
    {
        private Imps.Client.Core.Contact _contact;
        private string _content;
        private IContainer components;
        protected NotifyWindowLabel contentLabel;
        protected string contentText = "";
        protected Image portraitImage;

        public event NotifyWindowEventHandler ContentClick;

        public ReciveMessageNotifyForm(Imps.Client.Core.Contact contact, string content)
        {
            this._contact = contact;
            this._content = content;
            this.contentText = this.GetContentText();
            this.portraitImage = contact.PersonalInfo.Portrait;
            contact.PersonalInfo.PropertiesChanged += new EventHandler<PropertiesChangedEventArgs>(this, (IntPtr) this.PersonalInfo_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);
        }

        protected override void Dispose(bool disposing)
        {
            this.ContentClick = null;
            if (this._contact != null)
            {
                this._contact.PersonalInfo.PropertiesChanged -= new EventHandler<PropertiesChangedEventArgs>(this, (IntPtr) this.PersonalInfo_PropertiesChanged);
            }
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        protected string GenerateTitle(long sid)
        {
            return string.Format("{0}号: {1}", AppDictionary.ShortEnglishName, sid.ToString());
        }

        private string GetContentText()
        {
            string text = "";
            float num = 125f;
            float num2 = 0f;
            List<object> list = EmoticonParser.ParseString(null, this._contact.DisplayName);
            rich_string _string = new rich_string(this._contact.DisplayName);
            Graphics g = Graphics.FromHdc(InnerWin32.GetWindowDC(base.Handle));
            if (_string.MeasureText(g, this.Font).Width > num)
            {
                num -= g.MeasureString("...", this.Font).Width - 10f;
            }
            List<object>.Enumerator enumerator = list.GetEnumerator();
            try
            {
            Label_0147:
                while (enumerator.MoveNext())
                {
                    object obj2 = enumerator.get_Current();
                    if (obj2 is Emoticon)
                    {
                        if ((num2 + 16f) >= num)
                        {
                            goto Label_0163;
                        }
                        text = text + ((Emoticon) obj2).Key;
                        num2 += 17f;
                    }
                    else if (obj2 is string)
                    {
                        string text2 = (string) obj2;
                        SizeF empty = SizeF.Empty;
                        for (int i = text2.Length; i > 0; i--)
                        {
                            string text3 = text2.Substring(0, i);
                            empty = g.MeasureString(text3, this.Font);
                            if ((num2 + empty.Width) <= num)
                            {
                                text = text + text3;
                                num2 += empty.Width + 1f;
                                goto Label_0147;
                            }
                        }
                    }
                }
            }
            finally
            {
                enumerator.Dispose();
            }
        Label_0163:
            if (num < 125f)
            {
                text = text + "...";
            }
            string text4 = "{0}";
            if (this._content.StartsWith(text4))
            {
                return (text + this._content.Substring(text4.Length, this._content.Length - text4.Length));
            }
            return string.Format(this._content, text);
        }

        private void InitializeComponent()
        {
            base.SuspendLayout();
            base.set_AutoScaleDimensions(new SizeF(6f, 13f));
            base.set_AutoScaleMode(1);
            base.ClientSize = new Size(0x143, 0xe1);
            base.Name = "ReciveMessageNotifyForm";
            this.Text = "ReciveMessageNotifyForm";
            base.ResumeLayout(false);
        }

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

        private void PersonalInfo_PropertiesChanged(object sender, PropertiesChangedEventArgs e)
        {
            if (!base.IsDisposed)
            {
                this.contentText = this.GetContentText();
            }
        }
    }
}

⌨️ 快捷键说明

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