Пример #1
0
        public void RaiseEvent(RoutedEventArgs args)
        {
            this.VerifyAccess();
            if (args == null)
            {
                throw new ArgumentNullException();
            }
            EventRoute route = new EventRoute(args._routedEvent);

            args.Source = (object)this;
            if (args._routedEvent._routingStrategy == RoutingStrategy.Direct)
            {
                this.AddToEventRouteImpl(route, args);
            }
            else
            {
                int       num       = 0;
                UIElement uiElement = this;
                while (num++ <= 256)
                {
                    uiElement.AddToEventRouteImpl(route, args);
                    uiElement = uiElement._parent;
                    if (uiElement == null)
                    {
                        goto label_8;
                    }
                }
                throw new InvalidOperationException();
            }
label_8:
            route.InvokeHandlers((object)this, args);
            args.Source = args.OriginalSource;
        }
Пример #2
0
 public void AddToEventRoute(EventRoute route, RoutedEventArgs args)
 {
     this.VerifyAccess();
     if (route == null || args == null)
     {
         throw new ArgumentNullException();
     }
     this.AddToEventRouteImpl(route, args);
 }
Пример #3
0
        private void AddToEventRouteImpl(EventRoute route, RoutedEventArgs args)
        {
            Hashtable   eventHandlersStore = UIElement._classEventHandlersStore;
            RoutedEvent routedEvent        = args._routedEvent;

            for (int index1 = 0; index1 < 2; ++index1)
            {
                if (eventHandlersStore != null)
                {
                    ArrayList arrayList = (ArrayList)eventHandlersStore[(object)routedEvent];
                    if (arrayList != null)
                    {
                        int index2 = 0;
                        for (int count = arrayList.Count; index2 < count; ++index2)
                        {
                            RoutedEventHandlerInfo eventHandlerInfo = (RoutedEventHandlerInfo)arrayList[index2];
                            route.Add((object)this, eventHandlerInfo._handler, eventHandlerInfo._handledEventsToo);
                        }
                    }
                }
                eventHandlersStore = this._instanceEventHandlersStore;
            }
        }