EventItem.cs 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Runtime.Serialization;
  6. using Aitex.Core.Util;
  7. namespace Aitex.Core.RT.Event
  8. {
  9. [DataContract]
  10. [Serializable]
  11. public enum EventLevel
  12. {
  13. [EnumMember]
  14. Information = 0,
  15. [EnumMember]
  16. Warning,
  17. [EnumMember]
  18. Alarm
  19. }
  20. [DataContract]
  21. [Serializable]
  22. public enum EventType
  23. {
  24. /// <summary>
  25. /// 在TopView显示一条记录
  26. /// </summary>
  27. [EnumMember]
  28. EventUI_Notify,
  29. /// <summary>
  30. /// 弹出对话框
  31. /// </summary>
  32. [EnumMember]
  33. Dialog_Nofity,
  34. /// <summary>
  35. ///
  36. /// </summary>
  37. [EnumMember]
  38. KickOut_Notify,
  39. /// <summary>
  40. ///
  41. /// </summary>
  42. [EnumMember]
  43. Sound_Notify,
  44. /// <summary>
  45. /// 在屏幕左下角弹出一个提醒的悬浮窗口,自动消失
  46. /// </summary>
  47. [EnumMember]
  48. UIMessage_Notify,
  49. [EnumMember]
  50. OperationLog,
  51. [EnumMember]
  52. HostNotification,
  53. }
  54. [DataContract]
  55. [Serializable]
  56. public class EventItem
  57. {
  58. [DataMember]
  59. public int Id { get; set; }
  60. [DataMember]
  61. public string EventEnum { get; set; } //
  62. [DataMember]
  63. public EventType Type { get; set; }
  64. [DataMember]
  65. public EventLevel Level { get; set; }
  66. [DataMember]
  67. public string Source { get; set; } //Which module send out this event
  68. [DataMember]
  69. public string Description { get; set; } //detail text
  70. [DataMember]
  71. public DateTime OccuringTime { get; set; } //
  72. [DataMember]
  73. public bool IsAcknowledged { get; set; }
  74. [DataMember]
  75. public string Explaination { get; set; }
  76. [DataMember]
  77. public string Solution { get; set; }
  78. [DataMember]
  79. public string GlobalDescription_en
  80. {
  81. get;
  82. set;
  83. }
  84. [DataMember]
  85. public string GlobalDescription_zh
  86. {
  87. get;
  88. set;
  89. }
  90. [DataMember]
  91. public SerializableDictionary<string, string> DVID
  92. {
  93. get;
  94. set;
  95. }
  96. public SerializableDictionary<string, object> ObjDVID
  97. {
  98. get;
  99. set;
  100. }
  101. public bool IsTriggered
  102. {
  103. get
  104. {
  105. return !IsAcknowledged;
  106. }
  107. }
  108. public EventItem Clone()
  109. {
  110. EventItem result = new EventItem();
  111. result.Description = Description;
  112. result.EventEnum = EventEnum;
  113. result.Explaination = Explaination;
  114. result.Id = Id;
  115. result.IsAcknowledged = IsAcknowledged;
  116. result.Level = Level;
  117. result.OccuringTime = OccuringTime;
  118. result.Solution = Solution;
  119. result.Source = Source;
  120. result.Type = Type;
  121. result.GlobalDescription_en = GlobalDescription_en;
  122. result.GlobalDescription_zh = GlobalDescription_zh;
  123. result.DVID = DVID;
  124. result.ObjDVID = ObjDVID;
  125. return result;
  126. }
  127. public EventItem Clone(SerializableDictionary<string, object> objDvid)
  128. {
  129. EventItem result = new EventItem();
  130. result.Description = Description;
  131. result.EventEnum = EventEnum;
  132. result.Explaination = Explaination;
  133. result.Id = Id;
  134. result.IsAcknowledged = IsAcknowledged;
  135. result.Level = Level;
  136. result.OccuringTime = OccuringTime;
  137. result.Solution = Solution;
  138. result.Source = Source;
  139. result.Type = Type;
  140. result.GlobalDescription_en = GlobalDescription_en;
  141. result.GlobalDescription_zh = GlobalDescription_zh;
  142. result.DVID = DVID;
  143. result.ObjDVID = objDvid;
  144. return result;
  145. }
  146. public EventItem()
  147. {
  148. }
  149. public EventItem (string name )
  150. : this(0, "System", name, "", EventLevel.Information, EventType.EventUI_Notify)
  151. {
  152. }
  153. public EventItem(string name, string description)
  154. : this(0, "System", name, description, EventLevel.Information, EventType.EventUI_Notify)
  155. {
  156. }
  157. public EventItem(string source, string name, string description)
  158. :this(0, source,name,description, EventLevel.Information, EventType.EventUI_Notify)
  159. {
  160. }
  161. public EventItem(string name, EventType type, EventLevel level)
  162. : this(0,"System", name, "", level, type)
  163. {
  164. }
  165. public EventItem(string source, string name, string description, EventLevel level, EventType type)
  166. : this (0, source,name, description, level, type)
  167. {
  168. }
  169. public EventItem(int id, string source, string name, string description, EventLevel level, EventType type)
  170. {
  171. EventEnum = name;
  172. Type = type;
  173. Level = level;
  174. Source = source;
  175. Description = description;
  176. Id = id;
  177. }
  178. }
  179. }