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 { /// /// 日志种类 /// public string Type { get; set; } /// /// 日志内容 /// public string Content { get; set; } /// /// 发生时间 /// public DateTime OccurTime { get; set; } public LogEventArgs(string type, string content, DateTime occurTime) { Type = type; Content = content; OccurTime = occurTime; } } }