Esempio n. 1
0
        internal void WireupAutomaticEvents()
        {
            if (!SupportAutoEvents || !AutoEventWireup)
            {
                return;
            }

            /* Avoid expensive reflection operations by computing the event info only once */
            Type      type   = GetType();
            ArrayList events = auto_event_info.InsertOrGet((uint)type.GetHashCode(), type, null, CollectAutomaticEventInfo);

            for (int i = 0; i < events.Count; ++i)
            {
                EvtInfo evinfo = (EvtInfo)events [i];
                if (evinfo.noParams)
                {
                    NoParamsInvoker npi = new NoParamsInvoker(this, evinfo.method);
                    evinfo.evt.AddEventHandler(this, npi.FakeDelegate);
                }
                else
                {
                    evinfo.evt.AddEventHandler(this, Delegate.CreateDelegate(typeof(EventHandler), this, evinfo.method));
                }
            }
        }
Esempio n. 2
0
        internal void WireupAutomaticEvents()
        {
            if (!SupportAutoEvents || !AutoEventWireup)
            {
                return;
            }

            ArrayList events = null;

            /* Avoid expensive reflection operations by computing the event info only once */
            lock (auto_event_info_monitor) {
                if (auto_event_info == null)
                {
                    auto_event_info = new Hashtable();
                }
                events = (ArrayList)auto_event_info [GetType()];
                if (events == null)
                {
                    events = CollectAutomaticEventInfo();
                    auto_event_info [GetType()] = events;
                }
            }

            for (int i = 0; i < events.Count; ++i)
            {
                EvtInfo evinfo = (EvtInfo)events [i];
                if (evinfo.noParams)
                {
                    NoParamsInvoker npi = new NoParamsInvoker(this, evinfo.method);
                    evinfo.evt.AddEventHandler(this, npi.FakeDelegate);
                }
                else
                {
                    evinfo.evt.AddEventHandler(this, Delegate.CreateDelegate(
#if NET_2_0
                                                   typeof(EventHandler), this, evinfo.method));
#else
                                                   typeof(EventHandler), this, evinfo.methodName));
#endif
                }
            }
        }
Esempio n. 3
0
		internal void WireupAutomaticEvents ()
		{
			if (!SupportAutoEvents || !AutoEventWireup)
				return;

			/* Avoid expensive reflection operations by computing the event info only once */
			Type type = GetType ();
			ArrayList events = auto_event_info.InsertOrGet ((uint)type.GetHashCode (), type, null, CollectAutomaticEventInfo);

			for (int i = 0; i < events.Count; ++i) {
				EvtInfo evinfo = (EvtInfo)events [i];
				if (evinfo.noParams) {
					NoParamsInvoker npi = new NoParamsInvoker (this, evinfo.method);
					evinfo.evt.AddEventHandler (this, npi.FakeDelegate);
				} else
					evinfo.evt.AddEventHandler (this, Delegate.CreateDelegate (typeof (EventHandler), this, evinfo.method));
			}
		}
Esempio n. 4
0
		internal void WireupAutomaticEvents ()
		{
			if (!SupportAutoEvents || !AutoEventWireup)
				return;

			ArrayList events = null;

			/* Avoid expensive reflection operations by computing the event info only once */
			lock (auto_event_info_monitor) {
				if (auto_event_info == null)
					auto_event_info = new Hashtable ();
				events = (ArrayList)auto_event_info [GetType ()];
				if (events == null) {
					events = CollectAutomaticEventInfo ();
					auto_event_info [GetType ()] = events;
				}
			}

			for (int i = 0; i < events.Count; ++i) {
				EvtInfo evinfo = (EvtInfo)events [i];
				if (evinfo.noParams) {
					NoParamsInvoker npi = new NoParamsInvoker (this, evinfo.method);
					evinfo.evt.AddEventHandler (this, npi.FakeDelegate);
				} else
					evinfo.evt.AddEventHandler (this, Delegate.CreateDelegate (typeof (EventHandler), this, evinfo.method));
			}
		}