systeminfonotify.cs

来自「飞信的收发使用csharp进行开发」· CS 代码 · 共 78 行

CS
78
字号
namespace Imps.Client.Pc
{
    using Imps.Client.Pc.BizControls.NotifyWindows;
    using Imps.Client.Pc.BizControls.NotifyWindows.Templates;
    using Imps.Client.Resource;
    using Imps.Client.Utils;
    using System;
    using System.Drawing;

    public class SystemInfoNotify : NotifyWindowTemplateBase
    {
        private Imps.Client.Pc.SystemMessage _msg;
        protected NotifyWindowLabel contentLabel;
        protected NotifyWindowLabel linkLabel;
        protected NotifyWindowLabel titleLabel;

        public SystemInfoNotify(string title, Imps.Client.Pc.SystemMessage msg)
        {
            base.title = title;
            base.iconImage = ImpsTrayIcons.SysMsg.ToBitmap();
            this._msg = msg;
            base.InitContent();
        }

        public SystemInfoNotify(string title, string content) : this(string.Empty, new Imps.Client.Pc.SystemMessage(string.Empty, content, string.Empty, string.Empty))
        {
        }

        private void contentLabel_Click(object sender, NotifyWindowEventArgs e)
        {
            if (!string.IsNullOrEmpty(this._msg._link))
            {
                ShellHelper.StartUrl(this._msg._link);
                base.Close();
            }
        }

        protected override void CreateContent(NotifyWindowContent content)
        {
            if (!string.IsNullOrEmpty(this._msg._link))
            {
                Rectangle rectangle = new Rectangle(12, 30, 180, 60);
                this.contentLabel = new NotifyWindowLabel(this._msg._content, rectangle);
                content.Elements.Add(this.contentLabel);
                Rectangle rectangle2 = new Rectangle(110, 0x62, 180, 20);
                this.linkLabel = new NotifyWindowLabel("更多详细信息", rectangle2);
                this.linkLabel.TextFont = new Font(new FontFamily("宋体"), 12f, FontStyle.Underline, GraphicsUnit.Pixel);
                this.linkLabel.TextColor = Color.Blue;
                this.linkLabel.Clickable = true;
                this.linkLabel.Click += new NotifyWindowEventHandler(this.contentLabel_Click);
                content.Elements.Add(this.linkLabel);
            }
            else
            {
                Rectangle rectangle3 = new Rectangle(12, 30, 180, 80);
                this.contentLabel = new NotifyWindowLabel(this._msg._content, rectangle3);
                content.Elements.Add(this.contentLabel);
            }
            Rectangle textRectangle = new Rectangle(0x42, 4, 100, 20);
            this.titleLabel = new NotifyWindowLabel(base.title, textRectangle);
            this.titleLabel.TextFont = new Font(new FontFamily("宋体"), 12f, FontStyle.Bold, GraphicsUnit.Pixel);
            this.titleLabel.TextColor = Color.FromArgb(0x71, 0x7d, 0xab);
            this.titleLabel.HoverTextFont = new Font(new FontFamily("宋体"), 12f, FontStyle.Bold, GraphicsUnit.Pixel);
            this.titleLabel.HoverTextColor = Color.FromArgb(0x71, 0x7d, 0xab);
            content.Elements.Add(this.titleLabel);
        }

        public Imps.Client.Pc.SystemMessage SystemMessage
        {
            get
            {
                return this._msg;
            }
        }
    }
}

⌨️ 快捷键说明

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