lixiaojun
2024-07-11 8d8cd298ab46aee191baf53ff320fd3290d1ec9a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
namespace Yw.WinFrmUI
{
    /// <summary>
    /// 用于右下角弹窗提示
    /// </summary>
    public static class AlertToolHelper
    {
        //
        private static AlertControl Alert
        {
            get
            {
                if (_alert == null)
                {
                    lock (_locker)
                    {
                        if (_alert == null)
                        {
                            _alert = new AlertControl();
                            _alert.AutoFormDelay = 3000;
                            _alert.AutoHeight = false;
                            //_alert.FormMaxCount = 1;
                        }
                    }
                }
                return _alert;
            }
        }
        private static AlertControl _alert = null;
        private static object _locker = new();
 
        /// <summary>
        /// 显示右下角弹窗
        /// </summary>
        /// <param name="owner"></param>
        /// <param name="caption"></param>
        /// <param name="text"></param>
        public static void ShowAlertInfo(this Form owner, string caption, string text)
        {
            AlertInfo info = new(caption, text);
            Alert.Show(owner, info);
        }
 
 
    }
}