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();
|
}
|
|
|
|
|
|
|
}
|
}
|