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


C# HtmlTable.Dispose方法代码示例

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


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

示例1: PrintResults


//.........这里部分代码省略.........
                            if (result.TestStatus == Enums.TestStatus.Failed)
                            {
                                if (result.ErrorMessage.Equals("Failed to execute tests due to insufficient GACS access."))
                                {
                                    cell.Attributes.CssStyle.Value = "border-bottom:None; border-right:None; border-top:None; border-left:None;font-family:Verdana;font-size:9pt;font-weight:bold;";
                                    cell.InnerText = result.ErrorMessage;
                                }
                                else
                                {
                                    cell.Attributes.CssStyle.Value = "border-bottom:None; border-right:None; border-top:None; border-left:None;font-family:Verdana;font-size:9pt;font-weight:bold;color:#FFFFFF;vertical-align:middle;position:relative;";
                                    cell.InnerHtml = "<a href =" + result.ImagePath + "> " + result.ErrorMessage + "</a> &nbsp;" + @"<div style=""background:#ac2925; width: 20px; height:20px; border-radius:50%;display:inline-block;position:absolute;bottom:10%""></div>";
                                }
                            }
                            else if (result.TestStatus == Enums.TestStatus.Completed)
                            {
                                cell.Attributes.CssStyle.Value = "border-bottom:None; border-right:None; border-top:None; border-left:None;font-weight:bold;color:#FFFFFF;font-family:Verdana;font-size:9pt; vertical-align:middle;position:relative;";
                                cell.InnerHtml = "<a href =" + testParameters.First().ImagePath.ToString() + "> " + result.TestStatus.ToString() + "</a> &nbsp;" + @"<div style=""background:#397439; width: 20px; height:20px; border-radius:50%;display:inline-block;position:absolute;bottom:10%""></div>";
                            }

                            testparamets.Cells.Add(cell);

                            table.Rows.Add(testparamets);
                            this.testParameterRowCount++;
                            if (result.CurrentData != null)
                            {
                                HtmlTableRow testDataRow = new HtmlTableRow();
                                testDataRow.ID = this.testParameterRowCount.ToString();
                                testDataRow.Style.Add(HtmlTextWriterStyle.Display, "none");
                                testDataRow.Style.Add(HtmlTextWriterStyle.Width, "100%");

                                HtmlTableCell testDataCell = new HtmlTableCell();
                                testDataCell.Attributes.CssStyle.Value = "border-bottom:None; border-right:None; border-top:None; border-left:None;";
                                testDataCell.ColSpan = 4;
                                testDataCell.Width = "100%";

                                HtmlTable testDataTable = new HtmlTable();
                                testDataTable.Width = "100%";
                                testDataTable.Attributes.CssStyle.Value = "border-bottom:None; border-right:None; border-top:None; border-left:None;";

                                foreach (TestAutomationTemplate.Core.TestResult.TestData td in result.CurrentData)
                                {
                                    HtmlTableRow testDataTableRow = new HtmlTableRow();
                                    testDataTableRow.Attributes.CssStyle.Value = "border-bottom:None; border-right:None; border-top:None; border-left:None;";
                                    if (x % 2 == 0)
                                    {
                                        testDataTable.BgColor = "#FFFFFF";
                                    }
                                    else
                                    {
                                        testDataTable.BgColor = "#F0F0F0";
                                    }

                                    HtmlTableCell testDataTableCell = new HtmlTableCell();
                                    testDataTableCell.InnerHtml = "<li><b>" + td.Name + "</b>: " + td.Value + "</li>";
                                    testDataTableCell.ColSpan = 4;
                                    testDataTableCell.Width = "100%";
                                    testDataTableCell.Attributes.CssStyle.Value = "border-bottom:None;border-right:None;border-top:None;border-left:None; font-family:Verdana; font-size:8pt;padding:5px 5px 5px 5px;text-indent:50px;";
                                    testDataTableRow.Cells.Add(testDataTableCell);
                                    testDataTable.Rows.Add(testDataTableRow);
                                }

                                StringBuilder innerTable = new StringBuilder();
                                testDataTable.RenderControl(new HtmlTextWriter(new StringWriter(innerTable)));
                                testDataCell.InnerHtml = innerTable.ToString();
                                testDataRow.Cells.Add(testDataCell);
                                table.Rows.Add(testDataRow);
                                this.testParameterRowCount++;
                            }
                            else
                            {
                                HtmlTableRow testDataRow = new HtmlTableRow();
                                testDataRow.ID = this.testParameterRowCount.ToString();
                                testDataRow.Style.Add(HtmlTextWriterStyle.Display, "none");
                                testDataRow.Style.Add(HtmlTextWriterStyle.Width, "100%");

                                HtmlTableCell testDataCell = new HtmlTableCell();
                                testDataCell.Attributes.CssStyle.Value = "border-bottom:None; border-right:None; border-top:None; border-left:None;font-family:Verdana; font-size:8pt;";
                                testDataCell.ColSpan = 4;
                                testDataCell.Width = "100%";
                                testDataCell.InnerHtml = "<b>Test Parameters not available</b>";
                                testDataRow.Cells.Add(testDataCell);
                                table.Rows.Add(testDataRow);
                                this.testParameterRowCount++;
                            }
                        }
                    }
                }
            }

            StringBuilder stringBuilder = new StringBuilder();
            table.RenderControl(new HtmlTextWriter(new StringWriter(stringBuilder)));
            this.emailBody = this._reportJavaScript.WriteHTMLHeaderInformation().ToString() + this.PrintOverallStats().ToString() + stringBuilder.ToString() + this._reportJavaScript.GenerateJavaScriptCode(this.testDataRowCount).ToString();
            string reportDirectory = CustomConfiguration.TempDirectory;
            File.WriteAllText(reportDirectory + "Results.html", this.emailBody);
            this.CopyImagestoReportFolder(reportDirectory);
            stringBuilder.Clear();
            table.Dispose();

            return this.emailBody.ToString();
        }
开发者ID:jmaleonard,项目名称:testAutomationTemplate,代码行数:101,代码来源:GenerateReport.cs

示例2: NoResults

        /// <summary>
        /// Noes the results.
        /// </summary>
        /// <returns></returns>
        private string NoResults()
        {
            HtmlTable NoResultsTable = new HtmlTable();
            NoResultsTable.EnableTheming = true;
            NoResultsTable.Border = 1;
            NoResultsTable.BorderColor = "#000000";
            NoResultsTable.Width = "100%";
            NoResultsTable.CellSpacing = 0;

            HtmlTableRow NoResultsTableName = new HtmlTableRow();
            HtmlTableCell NoResultsTableNameCell = new HtmlTableCell("th");
            NoResultsTableNameCell.ColSpan = 4;
            NoResultsTableName.BorderColor = "#FFFFFF";
            NoResultsTableNameCell.Attributes.CssStyle.Value = "border-bottom: None;border-right:None;border-top:None;border-left:None; font-family:Verdana; font-size:9pt;color:#FFFFFF;";
            NoResultsTableNameCell.BgColor = "#808080";
            NoResultsTableNameCell.Align = "left";
            NoResultsTableNameCell.InnerText = "No test results available";
            NoResultsTableName.BgColor = "#808080";

            NoResultsTableName.Cells.Add(NoResultsTableNameCell);
            NoResultsTable.Rows.Add(NoResultsTableName);

            StringBuilder NoResultsStringBuilder = new StringBuilder();
            NoResultsTable.RenderControl(new HtmlTextWriter(new StringWriter(NoResultsStringBuilder)));
            this.emailBody = NoResultsStringBuilder.ToString();
            NoResultsStringBuilder.Clear();
            NoResultsTable.Dispose();

            return this.emailBody.ToString();
        }
开发者ID:jmaleonard,项目名称:testAutomationTemplate,代码行数:34,代码来源:GenerateReport.cs


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