示例#1
0
        public void AddTarget(EventHandler notification, UIControlEvent events)
        {
#if XAMCORE_2_0
            var targets = allTargets.GetValue(this, k =>
            {
                MarkDirty();
                return(new Dictionary <EventHandler, Dictionary <UIControlEvent, UIControlEventProxy> > ());
            });
#else
            if (targets == null)
            {
                targets = new Dictionary <EventHandler, Dictionary <UIControlEvent, UIControlEventProxy> > ();
                MarkDirty();
            }
#endif

            Dictionary <UIControlEvent, UIControlEventProxy> t;
            if (!targets.TryGetValue(notification, out t))
            {
                t = new Dictionary <UIControlEvent, UIControlEventProxy> ();
                targets [notification] = t;
            }

            UIControlEventProxy ep;

            if (!t.TryGetValue(events, out ep))
            {
                ep         = new UIControlEventProxy(this, notification);
                t [events] = ep;
                AddTarget(ep, Selector.GetHandle(UIControlEventProxy.BridgeSelector), events);
            }
            else
            {
                ep.Counter++;
            }
        }
示例#2
0
        public void AddTarget(EventHandler notification, UIControlEvent events)
        {
            #if XAMCORE_2_0
            var targets = allTargets.GetValue (this, k =>
            {
                MarkDirty ();
                return new Dictionary<EventHandler, Dictionary<UIControlEvent, UIControlEventProxy>> ();
            });
            #else
            if (targets == null) {
                targets = new Dictionary<EventHandler, Dictionary<UIControlEvent, UIControlEventProxy>> ();
                MarkDirty ();
            }
            #endif

            Dictionary<UIControlEvent, UIControlEventProxy> t;
            if (!targets.TryGetValue (notification, out t)) {
                t = new Dictionary<UIControlEvent, UIControlEventProxy> ();
                targets [notification] = t;
            }

            UIControlEventProxy ep;

            if (!t.TryGetValue (events, out ep)) {
                ep = new UIControlEventProxy (this, notification);
                t [events] = ep;
                AddTarget (ep, Selector.GetHandle (UIControlEventProxy.BridgeSelector), events);
            } else {
                ep.Counter++;
            }
        }