EV.cs 4.6 KB

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