Esempio n. 1
0
        public void Wait()
        {
            this.waiting = true;
            TimeSpan timeSpan = TimeSpan.FromMilliseconds(this.Timeout);

            while (!this.doneWaiting && (this.Timeout < 0 || (DateTime.Now - this.StartTime) < timeSpan))
            {
                ;
            }

            GenericAction.RemoveGenericEventHandler(this.Subject, this.EventInfo, this.CallbackWrap);
        }
Esempio n. 2
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);
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
 public override void RemoveEventHandler()
 {
     GenericAction.RemoveGenericEventHandler(this.Subject, this.EventInfo, this.OnEvent);
 }
Esempio n. 5
0
            public override bool AddEventHandler()
            {
                GenericAction.AddGenericEventHandler(this.Subject, this.EventInfo, this.OnEvent);

                return(true);
            }