コード例 #1
0
        public LayoutRegionDrawing(
            IDebugDrawing drawing,
            DrawingElement page,
            DebugLayoutRegion debugLayoutRegion,
            int headingLevel,
            bool showButtons)
            : base(
                page,
                "'" + debugLayoutRegion.Name + "'",
                headingLevel)
        {
            LeftMargin   = 3;
            RightMargin  = 3;
            TopMargin    = 3;
            BottomMargin = 3;

            CssClass = "layout-region";

            if (debugLayoutRegion.Region != null)
            {
                var region = new RegionDrawing(
                    drawing,
                    page,
                    debugLayoutRegion.Region,
                    headingLevel,
                    showButtons);
                AddChild(region);
            }

            var details = new List <string>();

            AddDebugInfo(details, debugLayoutRegion);

            if (details.Count > 0)
            {
                if (showButtons)
                {
                    AddDetails(details, AddHeaderButton(page, "Detail"));
                }
                else
                {
                    AddDetails(details, this);
                }
            }
        }
コード例 #2
0
        public ComponentDrawing(
            IDebugDrawing drawing,
            DrawingElement page,
            DebugComponent debugComponent,
            int headingLevel,
            bool showButtons)
            : base(
                page,
                "Component '" + debugComponent.Name + "'",
                headingLevel)
        {
            CssClass = "component";

            var details = new List <string>();

            AddDebugInfo(details, debugComponent);

            if (details.Count > 0)
            {
                if (showButtons)
                {
                    AddDetails(details, AddHeaderButton(page, "Detail"));
                }
                else
                {
                    AddDetails(details, this);
                }
            }

            if (showButtons && !ReferenceEquals(debugComponent.Element, null))
            {
                var elementDebugInfo = debugComponent.Element.GetDebugInfo <DebugComponent>();
                if (elementDebugInfo != null && elementDebugInfo.HasData())
                {
                    AddHeaderButton(page, "Definition")
                    .AddChild(new ComponentDrawing(
                                  drawing,
                                  page,
                                  elementDebugInfo,
                                  headingLevel + 1,
                                  false));
                }
            }
        }
コード例 #3
0
        public DataScopeRulesDrawing(
            IDebugDrawing drawing,
            DrawingElement page,
            DebugDataScopeRules debugDataScope,
            int headingLevel,
            bool showButtons,
            int depth)
            : base(
                page,
                debugDataScope.Name,
                headingLevel)
        {
            CssClass = "data-scope";

            var details = new List <string>();

            AddDebugInfo(details, debugDataScope);

            if (details.Count > 0)
            {
                if (showButtons)
                {
                    AddDetails(details, AddHeaderButton(page, "Detail"));
                }
                else
                {
                    AddDetails(details, this);
                }
            }

            if (!ReferenceEquals(debugDataScope.Scopes, null) && debugDataScope.Scopes.Count > 0)
            {
                var scopeList = new TitledListDrawing(
                    "Data scopes",
                    debugDataScope.Scopes.Select(s => s.ToString().InitialCaps()));
                AddChild(scopeList);
            }

            if (!ReferenceEquals(debugDataScope.DataSupplies, null) && debugDataScope.DataSupplies.Count > 0)
            {
                AddChild(new TextDrawing
                {
                    CssClass = "h3",
                    Text     = new[] { "Data supplied" }
                });

                foreach (var supply in debugDataScope.DataSupplies)
                {
                    AddChild(new SuppliedDependencyDrawing(supply));
                }
            }

            if (depth != 0 && debugDataScope.Children != null && debugDataScope.Children.Count > 0)
            {
                foreach (var child in debugDataScope.Children)
                {
                    if (child.HasData())
                    {
                        var childDrawing = new DataScopeRulesDrawing(
                            drawing,
                            page,
                            child as DebugDataScopeRules,
                            headingLevel,
                            showButtons,
                            depth - 1);
                        AddChild(childDrawing);
                    }
                }
            }
        }
コード例 #4
0
        public PageDrawing(
            IDebugDrawing drawing,
            DebugPage debugPage,
            int headingLevel,
            bool showButtons)
            : base(
                null,
                "Page '" + debugPage.Name + "'",
                headingLevel)
        {
            LeftMargin   = 20;
            RightMargin  = 20;
            TopMargin    = 20;
            BottomMargin = 20;

            CssClass = "page";

            var text = new List <string>();

            if (!string.IsNullOrEmpty(debugPage.RequiredPermission))
            {
                text.Add("Requires the '" + debugPage.RequiredPermission + "' permission");
            }

            if (text.Count > 0)
            {
                var textDrawing = new TextDrawing
                {
                    Text = text.ToArray()
                };
                AddChild(textDrawing);
            }

            var details = new List <string>();

            AddDebugInfo(details, debugPage);
            AddDetails(details, this);

            if (debugPage.Routes != null)
            {
                foreach (var route in debugPage.Routes)
                {
                    AddChild(new RouteDrawing(route));
                }
            }

            if (debugPage.Layout != null)
            {
                var layout = new LayoutDrawing(
                    drawing,
                    this,
                    debugPage.Layout,
                    headingLevel + 1,
                    showButtons);
                AddChild(layout);
            }

            if (!ReferenceEquals(debugPage.Scope, null))
            {
                AddHeaderButton(this, "Scope")
                .AddChild(new DataScopeRulesDrawing(
                              drawing,
                              this,
                              debugPage.Scope,
                              headingLevel + 1,
                              false,
                              -1));
            }

            if (!ReferenceEquals(debugPage.DataContext, null))
            {
                AddHeaderButton(this, "Context")
                .AddChild(new DataScopeRulesDrawing(
                              drawing,
                              this,
                              debugPage.DataContext,
                              headingLevel + 1,
                              false,
                              -1));
            }
        }
コード例 #5
0
ファイル: DebugDrawer.cs プロジェクト: jeffhong21/ProjectBANG
 public static void Draw(IDebugDrawing drawing)
 {
     CheckForFrameChange();
     Drawings.Add(drawing);
 }
コード例 #6
0
        public LayoutDrawing(
            IDebugDrawing drawing,
            DrawingElement page,
            DebugLayout debugLayout,
            int headingLevel,
            bool showButtons)
            : base(
                page,
                "Layout '" + debugLayout.Name + "'",
                headingLevel)
        {
            LeftMargin   = 15f;
            RightMargin  = 15f;
            TopMargin    = 15f;
            BottomMargin = 15f;

            ChildSpacing = 15f;

            CssClass = "layout";

            var details = new List <string>();

            AddDebugInfo(details, debugLayout);

            if (details.Count > 0)
            {
                if (showButtons)
                {
                    AddDetails(details, AddHeaderButton(page, "Detail"));
                }
                else
                {
                    AddDetails(details, this);
                }
            }

            if (showButtons && !ReferenceEquals(debugLayout.Element, null))
            {
                var elementDebugInfo = debugLayout.Element.GetDebugInfo <DebugLayout>();
                if (elementDebugInfo != null)
                {
                    AddHeaderButton(page, "Definition")
                    .AddChild(new LayoutDrawing(
                                  drawing,
                                  page,
                                  elementDebugInfo,
                                  headingLevel + 1,
                                  false));
                }
            }

            if (debugLayout.Children != null)
            {
                foreach (var debugRegion in debugLayout.Children)
                {
                    AddChild(new LayoutRegionDrawing(
                                 drawing,
                                 page,
                                 debugRegion as DebugLayoutRegion,
                                 headingLevel,
                                 showButtons));
                }
            }
        }
コード例 #7
0
        public RegionDrawing(
            IDebugDrawing drawing,
            DrawingElement page,
            DebugRegion debugRegion,
            int headingLevel,
            bool showButtons)
            : base(
                page,
                "zone '" + debugRegion.Name + "'",
                headingLevel)
        {
            CssClass = "region";

            string repeat = null;

            if (!ReferenceEquals(debugRegion.RepeatType, null))
            {
                repeat = debugRegion.RepeatType.DisplayName(TypeExtensions.NamespaceOption.None);

                if (!string.IsNullOrEmpty(debugRegion.RepeatScope))
                {
                    repeat = "'" + debugRegion.RepeatScope + "' " + repeat;
                }

                if (!string.IsNullOrEmpty(debugRegion.ListScope))
                {
                    repeat += " from a list in '" + debugRegion.ListScope + "' scope";
                }

                repeat = "Repeat for each " + repeat;

                if (showButtons)
                {
                    AddChild(new TextDrawing {
                        Text = new[] { repeat }
                    });
                }
            }

            var details = new List <string>();

            if (!string.IsNullOrEmpty(repeat))
            {
                details.Add(repeat);
            }
            AddDebugInfo(details, debugRegion);

            if (details.Count > 0)
            {
                if (showButtons)
                {
                    AddDetails(details, AddHeaderButton(page, "Detail"));
                }
                else
                {
                    AddDetails(details, this);
                }
            }

            if (!ReferenceEquals(debugRegion.Scope, null) && debugRegion.Scope.HasData())
            {
                var dataScopeDrawing = new DataScopeRulesDrawing(
                    drawing,
                    page,
                    debugRegion.Scope,
                    headingLevel + 1,
                    false,
                    0);

                if (showButtons)
                {
                    AddHeaderButton(page, "Scope").AddChild(dataScopeDrawing);
                }
                else
                {
                    AddChild(dataScopeDrawing);
                }
            }

            if (!ReferenceEquals(debugRegion.DataContext, null) && debugRegion.DataContext.HasData())
            {
                var dataScopeDrawing = new DataScopeRulesDrawing(
                    drawing,
                    page,
                    debugRegion.DataContext,
                    headingLevel + 1,
                    false,
                    0);

                if (showButtons)
                {
                    AddHeaderButton(page, "Context").AddChild(dataScopeDrawing);
                }
                else
                {
                    AddChild(dataScopeDrawing);
                }
            }

            if (showButtons && !ReferenceEquals(debugRegion.Element, null))
            {
                var elementDebugInfo = debugRegion.Element.GetDebugInfo <DebugRegion>();
                if (elementDebugInfo != null && elementDebugInfo.HasData())
                {
                    AddHeaderButton(page, "Definition")
                    .AddChild(new RegionDrawing(
                                  drawing,
                                  page,
                                  elementDebugInfo,
                                  headingLevel + 1,
                                  false));
                }
            }

            if (debugRegion.Children != null &&
                debugRegion.Children.Count > 0 &&
                debugRegion.Children[0] != null &&
                debugRegion.Children[0].HasData())
            {
                var content = drawing.DrawDebugInfo(page, debugRegion.Children[0], headingLevel, showButtons);
                AddChild(content);
            }
        }