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 { /// /// 信息通知 /// public static class ShowTip { //public static event EventHandler ShowEvent; //public static event EventHandler ShowDeviceErrorEvent; /// /// 信息通知的显示 /// /// /// /// /// 是否保持一致显示 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); } } /// /// 清除所有消息通知 /// public static void ClearNotice() { Growl.Clear(); Growl.ClearGlobal(); } } }