예제 #1
0
 private ReflectedEvent(EventDispatcher dispatch, WeakHash <object, EventDispatcher> dispatchers, object instance, bool clsOnly)
 {
     this.dispatcher  = dispatch;
     this.instance    = instance;
     this.clsOnly     = clsOnly;
     this.dispatchers = dispatchers;
 }
예제 #2
0
        private EventDispatcher GetDispatcher(object instance)
        {
            if (dispatchers == null)
            {
                dispatchers = new WeakHash <object, EventDispatcher>();
            }

            if (instance == null)
            {
                // targetting a static method, we'll use a random object
                // as our place holder here...
                instance = staticTarget;
            }

            EventDispatcher res;

            if (dispatchers.TryGetValue(instance, out res))
            {
                return(res);
            }

            return(dispatchers[instance] = new EventDispatcher(dispatcher.Info));
        }