Exemplo n.º 1
0
        protected override T PopulateDebugInfo <T>(DebugInfo debugInfo, int parentDepth, int childDepth)
        {
            _dataScopeRules.ElementName = "Page " + Name;

            if (typeof(T).IsAssignableFrom(typeof(DebugPage)))
            {
                var debugPage = debugInfo as DebugPage ?? new DebugPage();

                debugPage.RequiredPermission = RequiredPermission;
                debugPage.DataContext        = _dataContextBuilder.GetDebugInfo <DebugDataScopeRules>(0, -1);
                debugPage.Scope = _dataScopeRules.GetDebugInfo <DebugDataScopeRules>(0, -1);

                if (childDepth != 0)
                {
                    debugPage.Layout = _layout.GetDebugInfo <DebugLayout>(0, childDepth - 1);
                }

                return(base.PopulateDebugInfo <T>(debugPage, parentDepth, childDepth));
            }

            if (typeof(T).IsAssignableFrom(typeof(DebugDataScopeRules)))
            {
                var debugDataScopeRules = _dataScopeRules.GetDebugInfo <T>(parentDepth, childDepth);
                return(base.PopulateDebugInfo <T>(debugDataScopeRules, parentDepth, childDepth));
            }

            if (typeof(T).IsAssignableFrom(typeof(DebugDataConsumer)))
            {
                var debugDataConsumer = _dataConsumer.GetDebugInfo <T>(parentDepth, childDepth);
                return(base.PopulateDebugInfo <T>(debugDataConsumer, parentDepth, childDepth));
            }

            return(base.PopulateDebugInfo <T>(debugInfo, parentDepth, childDepth));
        }
Exemplo n.º 2
0
        protected override T PopulateDebugInfo <T>(DebugInfo debugInfo, int parentDepth, int childDepth)
        {
            if (typeof(T).IsAssignableFrom(typeof(DebugRegion)))
            {
                var debugRegion = debugInfo as DebugRegion ?? new DebugRegion();

                debugRegion.Scope       = Element.GetDebugInfo <DebugDataScopeRules>(0, 0);
                debugRegion.DataContext = _dataContextBuilder.GetDebugInfo <DebugDataScopeRules>();

                debugRegion.DataSupply = new DebugDataSupply
                {
                    Instance        = this,
                    IsStatic        = false,
                    SubscriberCount = _onSupplyActions.Count,
                    SuppliedData    = new DebugDataScope
                    {
                        DataType  = Region.RepeatType,
                        ScopeName = Region.RepeatScope
                    },
                    Supplier = new DebugDataSupplier
                    {
                        Instance = this,
                        Name     = Region.Name + " page region",
                    }
                };

                return(base.PopulateDebugInfo <T>(debugRegion, parentDepth, childDepth));
            }

            if (typeof(T).IsAssignableFrom(typeof(DebugDataScopeRules)))
            {
                var debugDataScopeRules = ElementDataScopeRules == null
                    ? new DebugDataScopeRules()
                    : ElementDataScopeRules.GetDebugInfo <DebugDataScopeRules>(parentDepth, childDepth);

                if (Region.RepeatType != null)
                {
                    if (debugDataScopeRules.DataSupplies == null)
                    {
                        debugDataScopeRules.DataSupplies = new List <DebugSuppliedDependency>();
                    }

                    var repeatDataSupply = new DebugSuppliedDependency
                    {
                        DataTypeSupplied = new DebugDataScope
                        {
                            DataType  = Region.RepeatType,
                            ScopeName = Region.RepeatScope
                        },
                        DataSupply = new DebugDataSupply
                        {
                            Instance        = this,
                            IsStatic        = false,
                            SubscriberCount = _onSupplyActions.Count,
                            SuppliedData    = new DebugDataScope
                            {
                                DataType  = Region.RepeatType,
                                ScopeName = Region.RepeatScope
                            },
                            Supplier = new DebugDataSupplier
                            {
                                Instance = this,
                                Name     = Region.Name + " page region",
                            }
                        },
                        DataConsumer = new DebugDataConsumer
                        {
                            DependentData = new List <DebugDataScope>
                            {
                                new DebugDataScope
                                {
                                    DataType  = Region.ListType,
                                    ScopeName = Region.ListScope
                                }
                            }
                        }
                    };

                    debugDataScopeRules.DataSupplies.Add(repeatDataSupply);
                }

                return(base.PopulateDebugInfo <T>(debugDataScopeRules, parentDepth, childDepth));
            }

            if (typeof(T).IsAssignableFrom(typeof(DebugDataSupplier)))
            {
                var debugDataSupplier = debugInfo as DebugDataSupplier ?? new DebugDataSupplier();

                if (Region.RepeatType != null)
                {
                    debugDataSupplier.SuppliedTypes = new List <Type> {
                        Region.RepeatType
                    };
                    debugDataSupplier.DefaultSupply = new DebugDataScope
                    {
                        DataType  = Region.RepeatType,
                        ScopeName = Region.RepeatScope
                    };
                }

                return(base.PopulateDebugInfo <T>(debugDataSupplier, parentDepth, childDepth));
            }

            if (typeof(T).IsAssignableFrom(typeof(DebugDataSupply)))
            {
                var debugDataSupply = debugInfo as DebugDataSupply ?? new DebugDataSupply();

                lock (_onSupplyActions) debugDataSupply.SubscriberCount = _onSupplyActions.Count;
                debugDataSupply.IsStatic = false;

                var region = Element as IRegion;
                if (region != null)
                {
                    debugDataSupply.SuppliedData = new DebugDataScope
                    {
                        DataType  = region.RepeatType,
                        ScopeName = region.RepeatScope
                    };
                }

                return(base.PopulateDebugInfo <T>(debugDataSupply, parentDepth, childDepth));
            }

            return(base.PopulateDebugInfo <T>(debugInfo, parentDepth, childDepth));
        }