58 lines
1.5 KiB
C#
58 lines
1.5 KiB
C#
![]() |
using ToolLibrary.LogHelper;
|
|||
|
|
|||
|
namespace Yunda.ISAS.DataMonitoringServer.DataAnalysis
|
|||
|
{
|
|||
|
public delegate void StateEventDelegate(StateEventArgs stateEventArgs);
|
|||
|
|
|||
|
public delegate void LogEventDelegate(LogEventArgs stateEventArgs);
|
|||
|
|
|||
|
|
|||
|
public static class MonitoringEventBus
|
|||
|
{
|
|||
|
public static event StateEventDelegate StateEvent;
|
|||
|
|
|||
|
public static event LogEventDelegate LogEvent;
|
|||
|
|
|||
|
public static void LogHandler(string content, string type)
|
|||
|
{
|
|||
|
LogEvent?.Invoke(new LogEventArgs(type, content, DateTime.Now));
|
|||
|
Log4Helper.Info(typeof(MonitoringEventBus), content);
|
|||
|
}
|
|||
|
public static void ImpletementStateEvent(StateEventArgs value)
|
|||
|
{
|
|||
|
StateEvent?.Invoke(value);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public class StateEventArgs
|
|||
|
{
|
|||
|
public bool IsStartSucceed { get; set; }
|
|||
|
|
|||
|
public StateEventArgs(bool value)
|
|||
|
{
|
|||
|
IsStartSucceed = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public class LogEventArgs
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
/// 日志种类
|
|||
|
/// </summary>
|
|||
|
public string Type { get; set; }
|
|||
|
/// <summary>
|
|||
|
/// 日志内容
|
|||
|
/// </summary>
|
|||
|
public string Content { get; set; }
|
|||
|
/// <summary>
|
|||
|
/// 发生时间
|
|||
|
/// </summary>
|
|||
|
public DateTime OccurTime { get; set; }
|
|||
|
public LogEventArgs(string type, string content, DateTime occurTime)
|
|||
|
{
|
|||
|
Type = type;
|
|||
|
Content = content;
|
|||
|
OccurTime = occurTime;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|