EV.cs 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. using System.Collections.Generic;
  2. using Aitex.Core.RT.Log;
  3. using Aitex.Core.Util;
  4. namespace Aitex.Core.RT.Event
  5. {
  6. public static class EV
  7. {
  8. public static ICommonEvent InnerEventManager { set; private get; }
  9. public static void PostMessage<T>(string module, T eventID, SerializableDictionary<string, string> dvid, params object[] args) where T : struct
  10. {
  11. if (InnerEventManager != null)
  12. InnerEventManager.WriteEvent(module, eventID.ToString(), dvid, args);
  13. }
  14. public static void PostMessage<T>(string module, T eventID, params object[] args) where T : struct
  15. {
  16. if (InnerEventManager != null)
  17. InnerEventManager.WriteEvent(module, eventID.ToString(), args);
  18. }
  19. public static void Notify(string eventName)
  20. {
  21. if (InnerEventManager != null)
  22. InnerEventManager.WriteEvent(eventName);
  23. }
  24. public static void Notify(string source, string eventName, string description)
  25. {
  26. if (InnerEventManager != null)
  27. InnerEventManager.WriteEvent(source, eventName, description);
  28. }
  29. public static void Notify(string eventName, SerializableDictionary<string, string> dvid)
  30. {
  31. if (InnerEventManager != null)
  32. InnerEventManager.WriteEvent(eventName,dvid);
  33. }
  34. public static void Notify(string eventName, SerializableDictionary<string, object> dvid)
  35. {
  36. if (InnerEventManager != null)
  37. InnerEventManager.WriteEvent(eventName, dvid);
  38. }
  39. //public static void PostMessage(string module, T eventID, params object[] args) where T : struct
  40. //{
  41. // if (InnerEventManager != null)
  42. // InnerEventManager.WriteEvent(module, eventID.ToString(), args);
  43. //}
  44. public static void PostNotificationMessage(string message)
  45. {
  46. if (InnerEventManager != null)
  47. InnerEventManager.PostNotificationMessage(message);
  48. }
  49. public static void PostPopDialogMessage(EventLevel level, string title, string message)
  50. {
  51. if (InnerEventManager != null)
  52. InnerEventManager.PostPopDialogMessage(level, title, message);
  53. }
  54. public static void PostKickoutMessage(string message)
  55. {
  56. if (InnerEventManager != null)
  57. InnerEventManager.PostKickoutMessage(message);
  58. }
  59. public static void PostSoundMessage(string message)
  60. {
  61. if (InnerEventManager != null)
  62. InnerEventManager.PostSoundMessage(message);
  63. }
  64. public static List<EventItem> GetAlarmEvent()
  65. {
  66. if (InnerEventManager != null)
  67. return InnerEventManager.GetAlarmEvent();
  68. return null;
  69. }
  70. public static void ClearAlarmEvent()
  71. {
  72. if (InnerEventManager != null)
  73. InnerEventManager.ClearAlarmEvent();
  74. }
  75. public static List<EventItem> QueryDBEvent(string sql)
  76. {
  77. if (InnerEventManager != null)
  78. return InnerEventManager.QueryDBEvent(sql);
  79. return null;
  80. }
  81. public static void Subscribe(string evName)
  82. {
  83. if (InnerEventManager != null)
  84. InnerEventManager.Subscribe(new EventItem(evName));
  85. }
  86. public static void Subscribe(string evName, string description)
  87. {
  88. if (InnerEventManager != null)
  89. InnerEventManager.Subscribe(new EventItem(evName, description));
  90. }
  91. public static void Subscribe(EventItem item)
  92. {
  93. if (InnerEventManager != null)
  94. InnerEventManager.Subscribe(item);
  95. }
  96. public static void WriteEvent(string eventName)
  97. {
  98. if (InnerEventManager != null)
  99. InnerEventManager.WriteEvent(eventName);
  100. }
  101. public static void WriteEvent(string eventName, SerializableDictionary<string, string> dvid)
  102. {
  103. if (InnerEventManager != null)
  104. InnerEventManager.WriteEvent(eventName, dvid);
  105. }
  106. public static void PostInfoLog(string module, string description, int traceLevel=2)
  107. {
  108. //LOG.Info(description, false, traceLevel+1);
  109. if (InnerEventManager != null)
  110. {
  111. InnerEventManager.PostInfoLog(module, description);
  112. }
  113. }
  114. public static void PostInfoLog(string module, eEvent id, string description, int traceLevel = 2)
  115. {
  116. //LOG.Info(description, false, traceLevel+1);
  117. if (InnerEventManager != null)
  118. {
  119. InnerEventManager.PostInfoLog(module,id, description);
  120. }
  121. }
  122. public static void PostWarningLog(string module, string description, int traceLevel = 2)
  123. {
  124. //LOG.Warning(description, traceLevel + 1);
  125. if (InnerEventManager != null)
  126. {
  127. InnerEventManager.PostWarningLog(module, description);
  128. }
  129. }
  130. public static void PostWarningLog(string module, eEvent id, string description, int traceLevel = 2)
  131. {
  132. //LOG.Warning(description, traceLevel + 1);
  133. if (InnerEventManager != null)
  134. {
  135. InnerEventManager.PostWarningLog(module,id, description);
  136. }
  137. }
  138. public static void PostAlarmLog(string module, string description, int traceLevel = 2)
  139. {
  140. //LOG.Error(description, traceLevel + 1);
  141. if (InnerEventManager != null)
  142. {
  143. InnerEventManager.PostAlarmLog(module, description);
  144. }
  145. }
  146. public static void PostAlarmLog(string module, eEvent id, string description, int traceLevel = 2)
  147. {
  148. //LOG.Error(description, traceLevel + 1);
  149. if (InnerEventManager != null)
  150. {
  151. InnerEventManager.PostAlarmLog(module,id, description);
  152. }
  153. }
  154. }
  155. }