Exemple #1
0
        private void Route(object sender, EntityRoutedEventArgs e)
        {
            if (e.Handled)
            {
                return;
            }

            switch (e.Event.Type)
            {
            case EntityRoutedEventType.BubbleToParent:

                var parent = this.FindParentEntity();
                if (parent != null)
                {
                    parent.OnRoutedEvent(sender, e);
                }

                break;

            case EntityRoutedEventType.BubbleToTreeParent:

                if (_treeParent != null)
                {
                    _treeParent.OnRoutedEvent(sender, e);
                }

                break;

            default:
                break;
            }
        }
Exemple #2
0
        private void Route(object sender, EntityRoutedEventArgs e)
        {
            if (e.Handled) return;

            switch (e.Event.Type)
            {
                case EntityRoutedEventType.BubbleToParent:

                    var parent = this.FindParentEntity();
                    if (parent != null)
                    {
                        parent.OnRoutedEvent(sender, e);
                    }

                    break;
                case EntityRoutedEventType.BubbleToTreeParent:

                    if (_treeParent != null)
                    {
                        _treeParent.OnRoutedEvent(sender, e);
                    }

                    break;
                default:
                    break;
            }
        }
Exemple #3
0
        /// <summary>
        /// 触发某个路由事件
        /// </summary>
        /// <param name="indicator"></param>
        /// <param name="args"></param>
        protected void RaiseRoutedEvent(EntityRoutedEvent indicator, object args)
        {
            var arg = new EntityRoutedEventArgs
            {
                Source = this,
                Event  = indicator,
                Args   = args
            };

            this.Route(this, arg);
        }
Exemple #4
0
        /// <summary>
        /// 触发某个路由事件
        /// </summary>
        /// <param name="indicator"></param>
        /// <param name="args"></param>
        protected void RaiseRoutedEvent(EntityRoutedEvent indicator, object args)
        {
            var arg = new EntityRoutedEventArgs
            {
                Source = this,
                Event = indicator,
                Args = args
            };

            this.Route(this, arg);
        }
Exemple #5
0
        /// <summary>
        /// 触发某个路由事件
        /// </summary>
        /// <param name="indicator"></param>
        /// <param name="args"></param>
        protected void RaiseRoutedEvent(EntityRoutedEvent indicator, EventArgs args)
        {
            if (indicator.Type == EntityRoutedEventType.BubbleToTreeParent)
            {
                throw new InvalidOperationException("列表类上只支持 BubbleToParent 的实体路由事件。");
            }

            //如果没有父实体,则直接返回
            var parent = this.Parent;

            if (parent == null)
            {
                return;
            }

            var arg = new EntityRoutedEventArgs
            {
                Source = this,
                Event  = indicator,
                Args   = args
            };

            parent.RouteByList(this, arg);
        }
Exemple #6
0
 internal void RouteByList(object sender, EntityRoutedEventArgs e)
 {
     this.OnRoutedEvent(sender, e);
 }
Exemple #7
0
 /// <summary>
 /// 发生某个路由事件
 /// 子类重写此方法以实现监听路由事件。
 ///
 /// 注意:子类在重写时,调用基类方法就表示继续路由。一般在最后才调用基类的方法。
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected virtual void OnRoutedEvent(object sender, EntityRoutedEventArgs e)
 {
     this.Route(sender, e);
 }
Exemple #8
0
 /// <summary>
 /// 发生某个路由事件
 /// 子类重写此方法以实现监听路由事件。
 /// 
 /// 注意:子类在重写时,调用基类方法就表示继续路由。一般在最后才调用基类的方法。
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected virtual void OnRoutedEvent(object sender, EntityRoutedEventArgs e)
 {
     this.Route(sender, e);
 }
Exemple #9
0
 internal void RouteByList(object sender, EntityRoutedEventArgs e)
 {
     this.OnRoutedEvent(sender, e);
 }