} //	end Constructor
		internal AeCondition(EnumEventType anEventType, uint anEventCategory,
		                     uint aSeverity, string aSourcePath,
		                     string aMessage, DateTime anOccurenceTime,
		                     ArrayList someEventAttributes, string anActorId,
		                     EnumConditionChange aChangeMask, EnumConditionState aNewState, bool ackRequired,
		                     EnumQuality aQuality, string aConditionName,
		                     string aSubConditionName, DateTime anActiveTime,
		                     uint aCookie)
		{
			m_eventType = anEventType;
			m_eventCategory = anEventCategory;
			m_severity = aSeverity;
			m_sourcePath = aSourcePath;
			m_message = aMessage;
			m_occurenceTime = anOccurenceTime;
			m_eventAttributes = someEventAttributes;
			m_actorId = anActorId;
			m_changeMask = aChangeMask;
			m_newState = aNewState;
			m_ackRequired = ackRequired;
			m_quality = aQuality;
			m_conditionName = aConditionName;
			m_subConditionName = aSubConditionName;
			m_activeTime = anActiveTime;
			m_cookie = aCookie;
		}
Exemple #2
0
 //当事件的回调被移除后一同移除事件。
 private static void OnListenerRemoved(EnumEventType eventType)
 {
     if (m_EventTable[eventType] == null)
     {
         m_EventTable.Remove(eventType);
     }
 }
		//----------------------------

		/// <summary>
		/// Builds an event. The Type, Source and CategoryId are mandatory attributes
		/// </summary>
		/// <param name="anEventType">
		/// the type of this event
		/// </param>
		/// <param name="aSource">
		/// address space source generating the event
		/// </param>
		/// <param name="aCategoryId">
		/// event category Id
		/// </param>
		/// <include
		///		file='TBNS.doc.xml'
		///			path='//class[@name="AeEvent"]/
		///			ctor[@name="AeEvent"]/doc/*'
		///	/>
		public AeEvent(
			EnumEventType anEventType,
			string aSource,
			uint aCategoryId)
		{
			this.m_type = anEventType;
			this.m_source = aSource;
			this.m_categoryId = aCategoryId;
		} //	end ctr
		//-----------------------------

		/// <summary>
		/// Category constructor
		/// </summary>
		/// <param name="anEventType"> the type of event</param>
		/// <param name="anId">unique integer identifier of a category</param>
		/// <param name="aName"> the category name</param>
		/// <include
		///		file='TBNS.doc.xml'
		///			path='//class[@name="AeCategory"]/
		///			ctor[@name="AeCategory"]/doc/*'
		///	/>
		public AeCategory(
			EnumEventType anEventType,
			uint anId,
			string aName)
		{
			this.m_eventType = anEventType;
			this.m_id = anId;
			this.m_name = aName;
		} //	end ctr
		} //	end ctr


		/// <summary>
		/// Internal constructor. may be only called from witin the TBN asembly
		/// </summary>
		/// <param name="anEventType"></param>
		/// <param name="anId"></param>
		/// <param name="aName"></param>
		/// <param name="aHandle"></param>
		internal AeCategory(
			EnumEventType anEventType,
			uint anId,
			string aName,
			uint aHandle) :
				this(anEventType, anId, aName)
		{
			this.m_handle = aHandle;
		} //	end ctr
Exemple #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AeCategory"/> class.
 /// </summary>
 /// <param name="anEventType"></param>
 /// <param name="anId"></param>
 /// <param name="aDescription"></param>
 /// <param name="aSession"></param>
 internal AeCategory(
     EnumEventType anEventType,
     uint anId,
     string aDescription,
     AeSession aSession)
 {
     m_index       = ++CategoryIndex;
     m_eventType   = anEventType;
     m_Id          = anId;
     m_description = aDescription;
     m_aeSession   = aSession;
 }
Exemple #7
0
    private static Dictionary <EnumEventType, Delegate> m_EventTable = new Dictionary <EnumEventType, Delegate>();//事件类型绑定一个回调,回调是一个委托。委托可以添加多个方法

    //AddListener方法中调用此方法,当没有此类型时添加类型和空回调,有事件类型和回调时判断加入的回调是否和之前类型相同。这个方法不会增加回调方法,实际的回调增加在AddLister方法内。
    private static void OnListenerAdding(EnumEventType eventType, Delegate callBack)
    {
        if (!m_EventTable.ContainsKey(eventType))
        {
            m_EventTable.Add(eventType, null);
        }
        Delegate d = m_EventTable[eventType];

        if (d != null && d.GetType() != callBack.GetType())//判断方法类型是否相同,或者说方法签名是否相同
        {
            throw new Exception(string.Format("尝试为事件{0}添加不同类型的委托,当前事件所对应的委托是{1},要添加的委托类型为{2}", eventType, d.GetType(), callBack.GetType()));
        }
    }
        //---------------------------

        /// <summary>
        /// Initializes a new instance of the Event class.
        /// </summary>
        /// <param name="anEventType"></param>
        /// <param name="anEventCategory"></param>
        /// <param name="aSeverity"></param>
        /// <param name="aSourcePath"></param>
        /// <param name="aMessage"></param>
        /// <param name="anOccurenceTime"></param>
        /// <param name="someEventAttributes"></param>
        /// <param name="anActorId"></param>
        internal AeEvent(EnumEventType anEventType, uint anEventCategory,
                         uint aSeverity, string aSourcePath,
                         string aMessage, DateTime anOccurenceTime,
                         ArrayList someEventAttributes, string anActorId)
        {
            m_eventType       = anEventType;
            m_eventCategory   = anEventCategory;
            m_severity        = aSeverity;
            m_sourcePath      = aSourcePath;
            m_message         = aMessage;
            m_occurenceTime   = anOccurenceTime;
            m_eventAttributes = someEventAttributes;
            m_actorId         = anActorId;
        }
        public FormEventSet(EnumEventType eventType)
        {
            InitializeComponent();

            base.ApplyDefLanguageResource();

            //初始化imageList
            this.imageListParameter.Images.Add(IconResource.EmptyIcon);
            this.imageListParameter.Images.Add(IconResource.Property);
            this.imageListParameter.Images.Add(IconResource.Right);
            this.imageListParameter.Images.Add(IconResource.Method);

            this.eventType = eventType;
        }
        private ChatHistory _NewHistory(EnumEventType type)
        {
            EventType evtType = _rep.RepEventType.FindBy(evt => evt.EventTypeId == type).FirstOrDefault();

            ChatHistory history = new ChatHistory
            {
                Date      = DateTime.Now,
                EventType = evtType
            };

            history.FormatValue();

            return(history);
        }
Exemple #11
0
    //five parameters
    public static void Broadcast <T, X, Y, Z, W>(EnumEventType eventType, T arg1, X arg2, Y arg3, Z arg4, W arg5)
    {
        Delegate d;

        if (m_EventTable.TryGetValue(eventType, out d))
        {
            CallBack <T, X, Y, Z, W> callBack = d as CallBack <T, X, Y, Z, W>;
            if (callBack != null)
            {
                callBack(arg1, arg2, arg3, arg4, arg5);
            }
            else
            {
                throw new Exception(string.Format("广播事件错误:事件{0}对应委托具有不同的类型", eventType));
            }
        }
    }
Exemple #12
0
    //no parameters,广播事件。
    public static void Broadcast(EnumEventType eventType)
    {
        Delegate d;

        if (m_EventTable.TryGetValue(eventType, out d))
        {
            CallBack callBack = d as CallBack;
            if (callBack != null)
            {
                callBack();
            }
            else
            {
                throw new Exception(string.Format("广播事件错误:事件{0}对应委托具有不同的类型", eventType));
            }
        }
    }
Exemple #13
0
        public OutputModel Get(EnumEventType eventType)
        {
            switch (eventType)
            {
            case EnumEventType.Diagnose:
                outputservice = new DiagnoseOutputService();
                break;

            case EnumEventType.Register:
                outputservice = new RegisterOutputService();
                break;

            default:
                throw new Exception("Not a valid event type. Please provide a valid event type and try again.");
            }
            return(outputservice.Get());
        }
Exemple #14
0
 //只进行判错和提醒,实际移除在RemoverListener方法内。
 private static void OnListenerRemoving(EnumEventType eventType, Delegate callBack)
 {
     if (m_EventTable.ContainsKey(eventType))
     {
         Delegate d = m_EventTable[eventType];
         if (d == null)
         {
             throw new Exception(string.Format("移除监听错误:事件{0}没有对应的委托", eventType));
         }
         else if (d.GetType() != callBack.GetType())
         {
             throw new Exception(string.Format("移除监听错误:尝试为事件{0}移除不同类型的委托,当前委托类型为{1},要移除的委托类型为{2}", eventType, d.GetType(), callBack.GetType()));
         }
     }
     else
     {
         throw new Exception(string.Format("移除监听错误:没有事件码{0}", eventType));
     }
 }
Exemple #15
0
 //no parameters,移除事件的回调中的指定函数。然后调用OnListenerRenmoved函数,在此函数中当移除函数为0后,在事件表中删除整个事件。
 public static void RemoveListener(EnumEventType eventType, CallBack callBack)
 {
     OnListenerRemoving(eventType, callBack);
     m_EventTable[eventType] = (CallBack)m_EventTable[eventType] - callBack;
     OnListenerRemoved(eventType);
 }
Exemple #16
0
 //five parameters
 public static void AddListener <T, X, Y, Z, W>(EnumEventType eventType, CallBack <T, X, Y, Z, W> callBack)
 {
     OnListenerAdding(eventType, callBack);
     m_EventTable[eventType] = (CallBack <T, X, Y, Z, W>)m_EventTable[eventType] + callBack;
 }
Exemple #17
0
 //no parameters
 public static void AddListener(EnumEventType eventType, CallBack callBack)
 {
     OnListenerAdding(eventType, callBack);
     m_EventTable[eventType] = (CallBack)m_EventTable[eventType] + callBack;
 }
Exemple #18
0
 private OutputModel GetViewModel(EnumEventType eventType)
 {
     outputService = new OutputService();
     return(outputService.Get(eventType));
 }