EV.cs 5.1 KB

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