You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

56 lines
1.5 KiB

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<ShowMessageSentEvent>().Publish(log);
}
public static void ShowMessage( int level, string msg, string remark="")
{
LogModel log = new LogModel(level, msg,remark);
_ea.GetEvent<ShowMessageSentEvent>().Publish(log);
}
static object messageLock = new object();
/// <summary>
/// 弹窗显示
/// </summary>
/// <param name="message"></param>
/// <returns></returns>
public static Task<object> MessageBox(string message)
{
lock (messageLock)
{
var sampleMessageDialog = new SampleMessageDialog
{
Message = { Text = message }
};
return DialogHost.Show(sampleMessageDialog, "RootDialog");
}
}
}
}