WinFormsPopupAlerts/AlertManager.cs

(开头部分) 7KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using System.ComponentModel.Design;

namespace WinFormsPopupAlerts
{
    /// <summary>
    /// The component that provide control of alert windows queue.
    /// </summary>
    [ToolboxBitmapAttribute(typeof(AlertManager))]
    public class AlertManager : Component
    {
        private class HiddenAlertCollection
        {

            public const int MaxCount = 50;

            public void Add(Alert alert)
            {
                if (items.Count > MaxCount)
                {
                    Alert first = items.First.Value;
                    first.Invoke(new CloseAlertDelegate(CloseAlert), first);
                    first.Close();
                    items.RemoveFirst();
                }
                items.AddLast(alert);
            }

            private delegate void CloseAlertDelegate(object obj);

            private static void CloseAlert(object obj)
            {
                Alert alert = (Alert)obj;
                if (!alert.IsDisposed)
                {
                    alert.Close();
                }
            }

            public bool Contains(Alert alert)
            {
                return items.Contains(alert);
            }

            LinkedList<Alert> items = new LinkedList<Alert>();
        }


        internal delegate void Proc(IAsyncResult prevAsyncRes);

        private const int DefaultVGap = 5;
        private const int DefaultHGap = 5;
        private const int DefaultAlertsMaxCount = 10;
        private const AlertAlignment DefaultAlertAlignment = AlertAlignment.BottomRight;

后面还有 177 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。