Exemple #1
0
        public EventHook(object subject, EventInfo eventInfo, Action <object[], Info> callback = null, int timeout = TO.Infinite)
        {
            if (eventInfo == null)
            {
                throw new ArgumentNullException("eventInfo");
            }

            this.Subject   = subject;
            this.EventInfo = eventInfo;
            this.Callback  = callback;
            this.Timeout   = timeout;
            this.ResetStartTime();
            GenericAction.AddGenericEventHandler(subject, eventInfo, this.CallbackWrap);
        }
        private UniversalEventHandle(object source, EventInfo eventInfo, UniversalEventCallback callback)
        {
            if (eventInfo == null)
            {
                throw new ArgumentNullException("eventInfo");
            }
            if (callback == null)
            {
                throw new ArgumentNullException("callback");
            }

            this.UniversalEventType = UniversalEventType.Event;
            this.EventInfo          = eventInfo;
            GenericAction.AddGenericEventHandler(source, eventInfo, this.OnEventChanged);
            this.Callback = callback;

            this.hashCode = HashCodeOperations.Combine(source ?? 0, eventInfo, callback);
        }
            public override bool AddEventHandler()
            {
                GenericAction.AddGenericEventHandler(this.Subject, this.EventInfo, this.OnEvent);

                return(true);
            }