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


C# HtmlTextWriter.DangerButton方法代码示例

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


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

示例1: TestListSection

 public TestListSection(List<NunitGoTest> tests)
 {
     var treeCode = Tree.GetTreeCode(tests);
     var stringWriter = new StringWriter();
     using (var writer = new HtmlTextWriter(stringWriter))
     {
         writer
             .Tag(HtmlTextWriterTag.Div,
                 () => writer
                     .Float("right")
                     .Div(() => writer
                         .DangerButton("Back", Output.Files.FullReportFile)
                     )
             )
             .Tag(HtmlTextWriterTag.Div, () => writer
                 .Write(treeCode)
             );
     }
     HtmlCode = stringWriter.ToString();
 }
开发者ID:elv1s42,项目名称:NUnitGo,代码行数:20,代码来源:TestListSection.cs

示例2: TimelineSection

        public TimelineSection(List<NunitGoTest> tests, string height = "90%")
        {
            var testResultsList = (from test in tests
                                   let start = test.DateTimeStart.ToString("HH:mm:ss")
                                   let finish = test.DateTimeFinish.ToString("HH:mm:ss")
                                   let toolitipText = "Test: " + test.FullName + ", " +
                                                       "Time: " + start + " - " + finish + ", " +
                                                       Environment.NewLine + "Result: " + test.Result
                                   let bcgColor = test.GetColor()
                                   select new HorizontalBarElement("", toolitipText, bcgColor, test.TestDuration,
                                       test.TestHrefRelative)).ToList();
            var timelineBar = new HorizontalBar("timeline-bar", "", testResultsList, false);
            var stringWriter = new StringWriter();
            using (var writer = new HtmlTextWriter(stringWriter))
            {
                writer.AddStyleAttribute(HtmlTextWriterStyle.Height, height);
                writer.AddStyleAttribute(HtmlTextWriterStyle.BackgroundColor, Colors.White);
                writer.AddStyleAttribute(HtmlTextWriterStyle.Overflow, "scroll");
                writer.RenderBeginTag(HtmlTextWriterTag.Div);

                writer.AddStyleAttribute(HtmlTextWriterStyle.Margin, "1% 2% 3% 97%");
                writer.RenderBeginTag(HtmlTextWriterTag.Div);
                writer.DangerButton("Back", Output.Files.FullReportFile);
                writer.RenderEndTag(); //DIV

                writer.AddStyleAttribute(HtmlTextWriterStyle.PaddingLeft, "30px");
                writer.RenderBeginTag(HtmlTextWriterTag.H3);
                writer.Write("Timeline (" + tests.First().DateTimeStart
                    + "-" + tests.Last().DateTimeFinish + "):");
                writer.RenderEndTag();
                writer.Write(timelineBar.BarHtml);

                writer.RenderEndTag(); //DIV
            }
            HtmlCode = stringWriter.ToString();
        }
开发者ID:elv1s42,项目名称:NUnitGo,代码行数:36,代码来源:TimelineSection.cs

示例3: StatisticsSection

        public StatisticsSection(MainStatistics mainStats, string height = "90%")
        {
            var testResultsList = new List<HorizontalBarElement>
            {
                new HorizontalBarElement("Passed", "Passed (" + mainStats.TotalPassed + @"/" + mainStats.TotalAll + ")",
                    Colors.TestPassed,
                    mainStats.TotalPassed/(double)mainStats.TotalAll),
                new HorizontalBarElement("Failed", "Failed (" + mainStats.TotalFailed + @"/" + mainStats.TotalAll + ")",
                    Colors.TestFailed,
                    mainStats.TotalFailed/(double)mainStats.TotalAll),
                new HorizontalBarElement("Broken", "Broken (" + mainStats.TotalBroken + @"/" + mainStats.TotalAll + ")",
                    Colors.TestBroken,
                    mainStats.TotalBroken/(double)mainStats.TotalAll),
                new HorizontalBarElement("Ignored", "Ignored (" + mainStats.TotalIgnored + @"/" + mainStats.TotalAll + ")",
                    Colors.TestIgnored,
                    mainStats.TotalIgnored/(double)mainStats.TotalAll),
                new HorizontalBarElement("Inconclusive", "Iconclusive (" + mainStats.TotalInconclusive + @"/" + mainStats.TotalAll + ")",
                    Colors.TestInconclusive,
                    mainStats.TotalInconclusive/(double)mainStats.TotalAll),
                new HorizontalBarElement("Unknown", "Unknown (" + mainStats.TotalUnknown + @"/" + mainStats.TotalAll + ")",
                    Colors.TestUnknown,
                    mainStats.TotalUnknown/(double)mainStats.TotalAll)
            };
            var testResultsBar = new HorizontalBar("test-results-bar", "Test results bar", testResultsList);

            var testExecutedList = new List<HorizontalBarElement>
            {
                new HorizontalBarElement("Executed", "Executed (" + mainStats.TotalExecuted + @"/" + mainStats.TotalAll + ")",
                    Colors.TestPassed,
                    mainStats.TotalExecuted/(double)mainStats.TotalAll),
                new HorizontalBarElement("Not executed", "Not executed (" +
                    (mainStats.TotalAll-mainStats.TotalExecuted).ToString("D") + @"/" + mainStats.TotalAll + ")",
                    Colors.TestIgnored,
                    (mainStats.TotalAll-mainStats.TotalExecuted)/(double)mainStats.TotalAll)
            };
            var testExecutedBar = new HorizontalBar("test-success-bar", "Test success bar", testExecutedList);

            var testSuccessList = new List<HorizontalBarElement>
            {
                new HorizontalBarElement("True", "True (" + mainStats.TotalSuccessTrue + @"/" + mainStats.TotalExecuted + ")",
                    Colors.TestPassed,
                    mainStats.TotalSuccessTrue/(double)mainStats.TotalExecuted),
                new HorizontalBarElement("False", "False (" + mainStats.TotalSuccessFalse + @"/" + mainStats.TotalExecuted + ")",
                    Colors.TestFailed,
                    mainStats.TotalSuccessFalse/(double)mainStats.TotalExecuted)
            };
            var testSuccessBar = new HorizontalBar("test-success-bar", "Test success bar", testSuccessList);

            var stringWriter = new StringWriter();
            using (var writer = new HtmlTextWriter(stringWriter))
            {
                writer.AddStyleAttribute(HtmlTextWriterStyle.Height, height);
                writer.AddStyleAttribute(HtmlTextWriterStyle.BackgroundColor, Colors.White);
                writer.AddStyleAttribute(HtmlTextWriterStyle.Overflow, "scroll");
                writer.RenderBeginTag(HtmlTextWriterTag.Div);

                writer.AddStyleAttribute(HtmlTextWriterStyle.Margin, "1% 2% 3% 97%");
                writer.RenderBeginTag(HtmlTextWriterTag.Div);
                writer.DangerButton("Back", Output.Files.FullReportFile);
                writer.RenderEndTag(); //DIV

                writer.AddStyleAttribute(HtmlTextWriterStyle.PaddingLeft, "30px");
                writer.RenderBeginTag(HtmlTextWriterTag.H3);
                writer.Write("Test cases results:");
                writer.RenderEndTag();
                writer.Write(testResultsBar.BarHtml);

                writer.AddStyleAttribute(HtmlTextWriterStyle.PaddingLeft, "30px");
                writer.RenderBeginTag(HtmlTextWriterTag.H3);
                writer.Write("Test cases success:");
                writer.RenderEndTag();
                writer.Write(testSuccessBar.BarHtml);

                writer.AddStyleAttribute(HtmlTextWriterStyle.PaddingLeft, "30px");
                writer.RenderBeginTag(HtmlTextWriterTag.H3);
                writer.Write("Executed test cases:");
                writer.RenderEndTag();
                writer.Write(testExecutedBar.BarHtml);

                writer.RenderEndTag(); //DIV
            }
            HtmlCode = stringWriter.ToString();
        }
开发者ID:elv1s42,项目名称:NUnitGo,代码行数:83,代码来源:StatisticsSection.cs

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