当前位置: 首页>>代码示例>>C#>>正文


C# HtmlTextWriter.AddOutput方法代码示例

本文整理汇总了C#中System.Web.UI.HtmlTextWriter.AddOutput方法的典型用法代码示例。如果您正苦于以下问题:C# HtmlTextWriter.AddOutput方法的具体用法?C# HtmlTextWriter.AddOutput怎么用?C# HtmlTextWriter.AddOutput使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Web.UI.HtmlTextWriter的用法示例。


在下文中一共展示了HtmlTextWriter.AddOutput方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: NunitTestHtml

        public NunitTestHtml(NunitGoTest nunitGoTest, string testOutput = "")
        {
            Style = GetStyle();
            ResultColor = nunitGoTest.GetColor();

            var strWr = new StringWriter();
            using (var writer = new HtmlTextWriter(strWr))
            {
                writer.AddStyleAttribute(HtmlTextWriterStyle.Left, "0%");
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "test-window");
                writer.AddAttribute(HtmlTextWriterAttribute.Title, Title);
                writer.RenderBeginTag(HtmlTextWriterTag.Div);

                writer.WithAttr(HtmlTextWriterAttribute.Id, Id)
                    .Tag(HtmlTextWriterTag.Div, () => writer
                        .Css(HtmlTextWriterStyle.TextAlign, "center")
                        .Css(HtmlTextWriterStyle.BackgroundColor, Colors.TestBorderColor)
                        .Css("padding", "20px")
                        .Css("margin", "0")
                        .CssShadow("0 0 20px -5px black")
                        .Tag(HtmlTextWriterTag.H2, () => writer
                            .Text($"{nunitGoTest.Name}. Result: ")
                            .Css("padding", "10px")
                            .Css(HtmlTextWriterStyle.BackgroundColor, ResultColor)
                            .Tag(HtmlTextWriterTag.Span, nunitGoTest.Result))
                        .Css("float", "right")
                        .Css("padding", "10px")
                        .Tag(HtmlTextWriterTag.Div, () => writer
                            .DangerButton("Back", "./../../" + Output.Files.TestListFile))
                        .Css("table-layout", "fixed")
                        .Css("word-break", "break-all")
                        .Css(HtmlTextWriterStyle.Width, "100%")
                        .Css(HtmlTextWriterStyle.BackgroundColor, Colors.BodyBackground)
                        .Css("border-spacing", "0")
                        .CssShadow("0 0 20px 0 " + Colors.TestBorderColor)
                        .Tag(HtmlTextWriterTag.Table, () => writer
                            .Css(HtmlTextWriterStyle.Width, "50%")
                            .Tag(HtmlTextWriterTag.Col)
                            .Css(HtmlTextWriterStyle.Width, "50%")
                            .Tag(HtmlTextWriterTag.Col)
                            .Tag(HtmlTextWriterTag.Tr, () => writer
                                .Css(HtmlTextWriterStyle.Width, "50%")
                                .Css(HtmlTextWriterStyle.BackgroundColor, Colors.White)
                                .Tag(HtmlTextWriterTag.Td, () => writer
                                    .AddTestResult(nunitGoTest))
                                .Css(HtmlTextWriterStyle.Width, "50%")
                                .Css(HtmlTextWriterStyle.BackgroundColor, Colors.White)
                                .Tag(HtmlTextWriterTag.Td, () => writer
                                    .AddTestHistory(nunitGoTest))
                            ))
                        .WithAttr(HtmlTextWriterAttribute.Id, "tabs-container")
                        .Tag(HtmlTextWriterTag.Div, () => writer
                            .WithAttr(HtmlTextWriterAttribute.Class, "tabs-menu")
                            .Tag(HtmlTextWriterTag.Ul, () => writer
                                .WithAttr(HtmlTextWriterAttribute.Class, "current")
                                .Tag(HtmlTextWriterTag.Li, () => writer
                                    .WithAttr(HtmlTextWriterAttribute.Href, "#test-screenshots-href")
                                    .Tag(HtmlTextWriterTag.A, "Screenshots"))
                                .Tag(HtmlTextWriterTag.Li, () => writer
                                    .WithAttr(HtmlTextWriterAttribute.Href, "#test-failure-href")
                                    .Tag(HtmlTextWriterTag.A, "Failure"))
                                .Tag(HtmlTextWriterTag.Li, () => writer
                                    .WithAttr(HtmlTextWriterAttribute.Href, "#test-environment-href")
                                    .Tag(HtmlTextWriterTag.A, "Test environment"))
                                .Tag(HtmlTextWriterTag.Li, () => writer
                                    .WithAttr(HtmlTextWriterAttribute.Href, "#test-output-href")
                                    .Tag(HtmlTextWriterTag.A, "Output"))
                                .Tag(HtmlTextWriterTag.Li, () => writer
                                    .WithAttr(HtmlTextWriterAttribute.Href, "#test-events-href")
                                    .Tag(HtmlTextWriterTag.A, "Test events"))
                            )
                            .WithAttr(HtmlTextWriterAttribute.Class, "test-tab")
                            .Tag(HtmlTextWriterTag.Div, () => writer
                                .WithAttr(HtmlTextWriterAttribute.Id, "test-screenshots-href")
                                .WithAttr(HtmlTextWriterAttribute.Class, "tab-content")
                                .Tag(HtmlTextWriterTag.Div, () => writer
                                    .AddScreenshots(nunitGoTest))
                                .WithAttr(HtmlTextWriterAttribute.Id, "test-failure-href")
                                .WithAttr(HtmlTextWriterAttribute.Class, "tab-content")
                                .Tag(HtmlTextWriterTag.Div, () => writer
                                    .AddFailure(nunitGoTest))
                                .WithAttr(HtmlTextWriterAttribute.Id, "test-environment-href")
                                .WithAttr(HtmlTextWriterAttribute.Class, "tab-content")
                                .Tag(HtmlTextWriterTag.Div, () => writer
                                    .AddEnvironment())
                                .WithAttr(HtmlTextWriterAttribute.Id, "test-output-href")
                                .WithAttr(HtmlTextWriterAttribute.Class, "tab-content")
                                .Tag(HtmlTextWriterTag.Div, () => writer
                                    .AddOutput(nunitGoTest, testOutput))
                                .WithAttr(HtmlTextWriterAttribute.Id, "test-events-href")
                                .WithAttr(HtmlTextWriterAttribute.Class, "tab-content")
                                .Tag(HtmlTextWriterTag.Div, () => writer
                                    .AddTestEvents(nunitGoTest)))
                        )
                    );

                writer.RenderEndTag(); //DIV
            }

            HtmlCode = strWr.ToString();
//.........这里部分代码省略.........
开发者ID:elv1s42,项目名称:NUnitGo,代码行数:101,代码来源:NunitTestHtml.cs


注:本文中的System.Web.UI.HtmlTextWriter.AddOutput方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。