schangxiang@126.com
2025-11-04 f5ed29dc26c7cd952d56ec5721a2efc43cd25992
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
using DataEntity.Event;
using DataEntity.Sockets.Base;
using HandyControl.Controls;
using HandyControl.Data;
using System;
using System.IO;
using System.Windows.Interop;
using System.Windows.Media.Imaging;
using XCommon.Event;
using XCommon.Log;
using static DataEntity.Event.EventExArgs;
using static HxEnum.OperationTypeEnum;
 
namespace XCommon.Tip
{
    /// <summary>
    /// 信息通知
    /// </summary>
    public static class ShowTip
    {
        //public static event EventHandler ShowEvent;
        //public static event EventHandler ShowDeviceErrorEvent;
 
        /// <summary>
        /// 信息通知的显示
        /// </summary>
        /// <param name="msg"></param>
        /// <param name="type"></param>
        /// <param name="waitTime"></param>
        /// <param name="staysOpen">是否保持一致显示</param>
        public static void ShowNotice(string msg, InfoType type, int waitTime = 3, bool staysOpen = false)
        {
            try
            {
                GrowlInfo growlInfo = new GrowlInfo();
                growlInfo.Message = msg;
                growlInfo.Type = type;
                growlInfo.WaitTime = waitTime;
                growlInfo.StaysOpen = staysOpen;
                growlInfo.Token = "ShowTip";
 
                //ShowEvent?.Invoke(growlInfo, EventArgs.Empty);
 
                if (growlInfo.Type == InfoType.Success)
                {
                    Growl.Success(growlInfo);
                }
                else if (growlInfo.Type == InfoType.Info)
                {
                    Growl.Info(growlInfo);
                }
                else if (growlInfo.Type == InfoType.Warning)
                {
                    Growl.Warning(growlInfo);
                }
                else if (growlInfo.Type == InfoType.Error)
                {
                    growlInfo.WaitTime = 5;
                    Growl.Error(growlInfo);
                }
                else if (growlInfo.Type == InfoType.Fatal)
                {
                    Growl.Fatal(growlInfo);
                }
            }
            catch(Exception ex)
            {
                LoggerHelper.ErrorLog("ShowNotice ERROR:", ex);
            }
        }
 
        /// <summary>
        /// 清除所有消息通知
        /// </summary>
        public static void ClearNotice()
        {
            Growl.Clear();
            Growl.ClearGlobal();
        }
 
 
 
 
 
 
    }
}