duheng
2025-03-24 6e1dd6f75cd7265f549a8b9e4d77ff5d88da9651
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
47
48
49
50
51
namespace Yw.WinFrmUI
{
    /// <summary>
    /// 
    /// </summary>
    public static class VmoExceptionAlertHelper
    {
        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>
        public static void ShowAlertInfo(this Form owner, Yw.Vmo.VException ex)
        {
            var info = new AlertInfo(ex.ErrorCode, ex.ErrorMsg, HttpStatusImageHelper.ImgC.Images[ex.ErrorStatus]);
            Alert.Show(owner, info);
        }
 
        /// <summary>
        /// 显示右下角弹窗
        /// </summary>
        public static void ShowAlertInfo(this Control owner, Yw.Vmo.VException ex)
        {
            var form = owner.FindForm();
            form.ShowAlertInfo(ex);
        }
 
 
    }
}