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


C# HtmlTextWriter.Class方法代码示例

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


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

示例1: MainInformationSection

        public MainInformationSection(MainStatistics stats)
        {
            var strWr = new StringWriter();
            using (var writer = new HtmlTextWriter(strWr))
            {
                writer
                    .Class("columns")
                    .Div(() => writer
                        .Class("one-third column")
                        .Div(() => writer
                            .Div(() => writer
                                .Class("border-bottom p-3 mb-3")
                                .H2("Time: ")
                                .Class("border border-0 p-3 mb-3")
                                .Div(() => writer
                                    .Ul(() => writer
                                        .Li("Start datetime: " + stats.StartDate)
                                        .Li("Finish datetime: " + stats.EndDate)
                                        .Li("Duration: " + stats.Duration)
                                    )
                                )
                            )
                            .Div(() => writer
                                .Class("border-bottom p-3 mb-3")
                                .H2("Summary: ")
                                .Class("border border-0 p-3 mb-3")
                                .Div(() => writer
                                    .Ul(() => writer
                                        .Li("Total: " + stats.TotalAll)
                                        .Li("Success: " + stats.TotalPassed)
                                        .Li("Errors: " + stats.TotalBroken)
                                        .Li("Failures: " + stats.TotalFailed)
                                        .Li("Inconclusive: " + stats.TotalInconclusive)
                                        .Li("Ignored: " + stats.TotalIgnored)
                                    )
                                )
                            )
                        )
                        .Class("two-thirds column")
                        .Div(() => writer
                            .WithAttr(HtmlTextWriterAttribute.Id, Output.GetStatsPieId())
                            .Tag(HtmlTextWriterTag.Div)
                        )
                    );

            }

            HtmlCode = strWr.ToString();
        }
开发者ID:elv1s42,项目名称:NUnitGo,代码行数:49,代码来源:MainInformationSection.cs

示例2: GetCode

 private string GetCode()
 {
     var stringWriter = new StringWriter();
     using (var writer = new HtmlTextWriter(stringWriter))
     {
         writer
             .Class("border-bottom p-3 mb-3")
             .Div(() => writer
                 .H1(Title)
             );
     }
     return stringWriter.ToString();
 }
开发者ID:elv1s42,项目名称:NUnitGo,代码行数:13,代码来源:SectionName.cs

示例3: GeneratePageString

        private void GeneratePageString()
        {
            var strWr = new StringWriter();
            using (var writer = new HtmlTextWriter(strWr))
            {
                writer
                    .WriteString("<!DOCTYPE html>")
                    .NewLine()
                    .Tag(HtmlTextWriterTag.Head, () => writer
                        .Tag(HtmlTextWriterTag.Meta, new Dictionary<string, string>
                        {
                            {"http-equiv", "X-UA-Compatible"},
                            {"content", @"IE=edge"},
                            {"charset", "utf-8"}
                        })
                        .Title(PageTitle)
                        .Scripts(ScriptFilePaths)
                        .TagIf(!PageScriptString.Equals(""), HtmlTextWriterTag.Script, PageScriptString)
                        .Type(@"text/css")
                        .Tag(HtmlTextWriterTag.Style)
                        .Stylesheets(PageStylePaths)

                    )
                    .Tag(HtmlTextWriterTag.Body, () => writer
                        .Class("border-bottom p-3 mb-3 bg-gray")
                        .Div(() => writer
                            .Class("container")
                            .Div(() => writer
                                .TextAlign("center")
                                .Div(() => writer
                                    .H1(PageTitle)
                                )
                            )
                        )
                        .Class("container")
                        .Tag(HtmlTextWriterTag.Div, () => writer
                            .Write(PageBodyCode)
                        )
                    )
                    .NewLine()
                    .Footer(FooterSection.HtmlCode)
                    .NewLine()
                    .WriteString("</html>")
                    .NewLine();
            }
            FullPage = strWr.ToString();
        }
开发者ID:elv1s42,项目名称:NUnitGo,代码行数:47,代码来源:HtmlPage.cs


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