public static string ToName(JournalEventNameType journalEventNameType)
		{
			string name = null;
			FieldInfo fieldInfo = journalEventNameType.GetType().GetField(journalEventNameType.ToString());
			if (fieldInfo != null)
			{
				EventNameAttribute[] descriptionAttributes = (EventNameAttribute[])fieldInfo.GetCustomAttributes(typeof(EventNameAttribute), false);
				if (descriptionAttributes.Length > 0)
				{
					EventNameAttribute eventDescriptionAttribute = descriptionAttributes[0];
					name = eventDescriptionAttribute.Name;
				}
			}
			return name;
		}
		public static JournalSubsystemType ToSubsystem(JournalEventNameType journalEventNameType)
		{
			JournalSubsystemType subsystemType = JournalSubsystemType.GK;
			FieldInfo fieldInfo = journalEventNameType.GetType().GetField(journalEventNameType.ToString());
			if (fieldInfo != null)
			{
				EventNameAttribute[] descriptionAttributes = (EventNameAttribute[])fieldInfo.GetCustomAttributes(typeof(EventNameAttribute), false);
				if (descriptionAttributes.Length > 0)
				{
					EventNameAttribute eventDescriptionAttribute = descriptionAttributes[0];
					subsystemType = eventDescriptionAttribute.JournalSubsystemType;
				}
			}
			return subsystemType;
		}
		public static XStateClass ToStateClass(JournalEventNameType journalEventNameType)
		{
			XStateClass stateClass = XStateClass.No;
			FieldInfo fieldInfo = journalEventNameType.GetType().GetField(journalEventNameType.ToString());
			if (fieldInfo != null)
			{
				EventNameAttribute[] descriptionAttributes = (EventNameAttribute[])fieldInfo.GetCustomAttributes(typeof(EventNameAttribute), false);
				if (descriptionAttributes.Length > 0)
				{
					EventNameAttribute eventDescriptionAttribute = descriptionAttributes[0];
					stateClass = eventDescriptionAttribute.StateClass;
				}
			}
			return stateClass;
		}
示例#4
0
	   string GetEventImage(JournalEventNameType journalEventNameType)
		{
			FieldInfo fieldInfo = journalEventNameType.GetType().GetField(journalEventNameType.ToString());
			if (fieldInfo != null)
			{
				EventNameAttribute[] descriptionAttributes = (EventNameAttribute[])fieldInfo.GetCustomAttributes(typeof(EventNameAttribute), false);
				if (descriptionAttributes.Length > 0)
				{
					EventNameAttribute eventNameAttribute = descriptionAttributes[0];
					Name = eventNameAttribute.Name;
					var stateClass = eventNameAttribute.StateClass;
					if (stateClass != XStateClass.Norm)
						return "/Content/Image/StateClasses/" + stateClass.ToString() + ".png";
				}
			}
			return "/Content/Image/Images/blank.png";
		}