using EC.UsingEventAggregator; using ECMonitor.UC; using MaterialDesignThemes.Wpf; using Prism.Events; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ECMonitor.Manager { public class MessageManager { static IEventAggregator _ea { get; set; } public static void Init(IEventAggregator ea) { _ea = ea; } public static void ShowMessage( string msg, bool isErr=false) { int level = 0; if (isErr) { level = 3; } LogModel log = new LogModel(level, msg); _ea.GetEvent().Publish(log); } public static void ShowMessage( int level, string msg, string remark="") { LogModel log = new LogModel(level, msg,remark); _ea.GetEvent().Publish(log); } static object messageLock = new object(); /// /// 弹窗显示 /// /// /// public static Task MessageBox(string message) { lock (messageLock) { var sampleMessageDialog = new SampleMessageDialog { Message = { Text = message } }; return DialogHost.Show(sampleMessageDialog, "RootDialog"); } } } }