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


C# HtmlTextWriter.WriteBreak方法代码示例

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


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

示例1: WithBody

        public EmailBuilder WithBody(IEnumerable<KeyValuePair<string, IList>> lists)
        {
            var writer = new StringWriter();
            var html = new HtmlTextWriter(writer);

            html.RenderBeginTag(HtmlTextWriterTag.H1);
            html.WriteEncodedText(_viewModel.Subject);
            html.RenderEndTag();
            html.WriteBreak();
            html.WriteBreak();
            foreach (var list in lists)
            {
                html.RenderBeginTag(HtmlTextWriterTag.H3);
                html.WriteEncodedText(list.Key);
                html.RenderEndTag();
                html.RenderBeginTag(HtmlTextWriterTag.Ul);
                foreach (var item in list.Value)
                {
                    html.RenderBeginTag(HtmlTextWriterTag.Li);
                    html.WriteEncodedText(item.ToString());
                    html.RenderEndTag();
                }
                html.RenderEndTag();
                html.WriteBreak();
                html.WriteBreak();
            }

            _viewModel.Body = writer.ToString();

            return this;
        }
开发者ID:COTB,项目名称:k94warriors,代码行数:31,代码来源:EmailBuilder.cs

示例2: GenerateGeneralPage

        private static void GenerateGeneralPage(string inputFilePath, string outputFilePath, Dictionary<PackageKey, FeedPackage> feedPackages)
        {
            using (var stringWriter = new StringWriter())
            {
                using (var writer = new HtmlTextWriter(stringWriter))
                {
                    writer.RenderBeginTag(HtmlTextWriterTag.H1);
                    {
                        writer.WriteLine("Nuget Package Report Overview");
                    }
                    writer.RenderEndTag();

                    writer.WriteGeneralInformation(inputFilePath, feedPackages);
                    writer.WriteBreak();

                    writer.RenderBeginTag(HtmlTextWriterTag.Table);
                    {
                        WriteGeneralPageTableHeaders(writer, "Package Name", "Current Version", "Latest Version", "License",
                                                     "Instances");

                        foreach (var package in feedPackages)
                        {
                            WriteGeneralPagePackageRows(writer, package);
                        }
                    }
                    writer.RenderEndTag();

                    var content = writer.InnerWriter.ToString();

                    var path = Path.Combine(outputFilePath, GeneralPageFileName);
                    File.WriteAllText(path, content);
                    System.Diagnostics.Process.Start(path);
                }
            }
        }
开发者ID:Banane9,项目名称:NugetPackageReport,代码行数:35,代码来源:ReportWriter.cs

示例3: RenderContents

		protected override void RenderContents(HtmlTextWriter writer)
		{
            bool beginTagWritten = false;
            foreach (var field in this.ContentView.Content.Fields.Values)
            {
                if (field.ValidationResult == null)
                    continue;
                if (this.ContentView.NeedToValidate && !field.ReadOnly && !field.IsValid)
                {
                    if (!beginTagWritten)
                    {
                        writer.AddAttribute(HtmlTextWriterAttribute.Class, "sn-error-msg");
                        writer.RenderBeginTag(HtmlTextWriterTag.Div);
                        beginTagWritten = true;
                    }
                    writer.Write(field.DisplayName);
                    writer.Write(": ");
                    writer.Write(ResolveValidationResult(field));
                    writer.WriteBreak();
                }
            }
            if (beginTagWritten)
                writer.RenderEndTag();
            if (this.ContentView.ContentException != null)
                RenderContentError(writer, this.ContentView.ContentException, this.Debug);
		}
开发者ID:maxpavlov,项目名称:FlexNet,代码行数:26,代码来源:ErrorView.cs

示例4: RenderContentError

		internal static void RenderContentError(HtmlTextWriter writer, Exception exception, bool debug)
		{
			if (exception == null)
				return;

			writer.AddAttribute(HtmlTextWriterAttribute.Class, "sn-error-msg");
		    writer.RenderBeginTag(HtmlTextWriterTag.Div);
            
            var e = exception;
            while (e != null)
            {
                writer.Write(e.Message);
                writer.WriteBreak();

                //only show inner messages if we are in debug mode);
                if (!debug)
                    break;

                e = e.InnerException;
            }

		    if (debug)
		    {
                if (exception.Data.Keys.Count > 0)
                {
                    writer.WriteBreak();

                    foreach (var key in exception.Data.Keys)
                    {
                        writer.Write(string.Format("{0}: {1}", key, exception.Data[key]));
                        writer.WriteBreak();
                    }

                    writer.WriteBreak();
                }

		        writer.Write(exception.StackTrace);
			    writer.WriteBreak();
		    }

			writer.RenderEndTag();
		}
开发者ID:maxpavlov,项目名称:FlexNet,代码行数:42,代码来源:ErrorView.cs

示例5: RenderContents

        protected override void RenderContents(HtmlTextWriter writer)
        {
            foreach (var srGroup in Items.GetRange(0, (MaxCount < Items.Count) ? MaxCount : Items.Count))
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "clearFix item");
                writer.RenderBeginTag(HtmlTextWriterTag.Div);

                writer.AddAttribute(HtmlTextWriterAttribute.Class, String.IsNullOrEmpty(srGroup.Description) ? "widebody" : "body");
                writer.RenderBeginTag(HtmlTextWriterTag.Div);
                writer.AddAttribute(HtmlTextWriterAttribute.Href, srGroup.URL);
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "link bold");
                writer.RenderBeginTag(HtmlTextWriterTag.A);
                writer.Write(HtmlUtil.SearchTextHighlight(Text, srGroup.Name.HtmlEncode()));
                writer.RenderEndTag();

                if (!String.IsNullOrEmpty(srGroup.Description))
                {
                    writer.WriteBreak();

                    if (!string.IsNullOrEmpty(SpanClass))
                        writer.AddAttribute(HtmlTextWriterAttribute.Class, SpanClass);
                    writer.RenderBeginTag(HtmlTextWriterTag.Span);
                    writer.Write(CheckEmptyValue(srGroup.Description.HtmlEncode()));
                    writer.RenderEndTag();

                }
                writer.RenderEndTag();

                if (srGroup.Date.HasValue)
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, "date");
                    writer.RenderBeginTag(HtmlTextWriterTag.Div);

                    writer.AddAttribute(HtmlTextWriterAttribute.Style, "height:100%");
                    writer.RenderBeginTag(HtmlTextWriterTag.Table);
                    writer.RenderBeginTag(HtmlTextWriterTag.Tr);
                    writer.RenderBeginTag(HtmlTextWriterTag.Td);

                    writer.Write(srGroup.Date.Value.ToShortDateString());

                    writer.RenderEndTag();
                    writer.RenderEndTag();
                    writer.RenderEndTag();

                    writer.RenderEndTag();
                }
                writer.RenderEndTag();
            }
        }
开发者ID:vipwan,项目名称:CommunityServer,代码行数:49,代码来源:ResultsView.cs

示例6: RenderContents

        protected override void RenderContents(HtmlTextWriter writer)
        {
            if (_buttons.Count == 0) return;

            GuayaquilHelper.WriteBoxBorder(writer, "xtop");
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "xboxcontent");
            writer.AddAttribute(HtmlTextWriterAttribute.Id, "guayaquil_toolbar");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            foreach (ToolBarButton button in _buttons)
            {
                WriteButton(writer, button);
            }

            writer.RenderEndTag();
            GuayaquilHelper.WriteBoxBorder(writer, "xbottom");
            writer.WriteBreak();
        }
开发者ID:dmziryanov,项目名称:ApecAuto,代码行数:18,代码来源:Toolbar.cs

示例7: RenderContents

        protected override void RenderContents(HtmlTextWriter writer)
        {
            var contentPath = string.Empty;
            var currentUrlList = GetSiteUrlList(ref contentPath);
            var protocol = HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Scheme);
            
            #region template

            if (UseBrowseTemplate)
            {
                Try2AddUrlLinks(contentPath, currentUrlList, protocol);
                base.RenderContents(writer);
                return;
            }
            if (UseEditTemplate)
            {
                Try2AddUrlLinks(contentPath, currentUrlList, protocol);
                base.RenderContents(writer);
                return;
            }
            if (UseInlineEditTemplate)
            {
                Try2AddUrlLinks(contentPath, currentUrlList, protocol);
                base.RenderContents(writer);
                return;
            }

            #endregion

            foreach (var siteUrl in currentUrlList)
            {
                var url = string.Concat(protocol, siteUrl, contentPath);
                var link = new System.Web.UI.WebControls.HyperLink();
                link.NavigateUrl = url;
                link.Text = url;
                link.Target = "new";
                link.CssClass = this.CssClass;
                link.RenderControl(writer);
                writer.WriteBreak();
            }
        }
开发者ID:maxpavlov,项目名称:FlexNet,代码行数:41,代码来源:SiteRelativeUrl.cs

示例8: RenderExistingConnections

 private void RenderExistingConnections(HtmlTextWriter writer) {
     WebPartManager manager = WebPartManager;
     bool headerRendered = false;
     bool consumersHeaderRendered = false;
     bool providersHeaderRendered = false;
     if (manager != null) {
         WebPart webPartToConnect = WebPartToConnect;
         // First, display connections for which we are providers (connections to consumers)
         WebPartConnectionCollection connections = manager.Connections;
         foreach (WebPartConnection connection in connections) {
             if (connection.Provider == webPartToConnect) {
                 if (!headerRendered) {
                     RenderInstructionTitle(writer);
                     RenderInstructionText(writer);
                     headerRendered = true;
                 }
                 if (!consumersHeaderRendered) {
                     writer.RenderBeginTag(HtmlTextWriterTag.Fieldset);
                     LabelStyle.AddAttributesToRender(writer, this);
                     writer.RenderBeginTag(HtmlTextWriterTag.Legend);
                     writer.Write(ConsumersTitle);
                     writer.RenderEndTag(); // Legend
                     string instructionText = ConsumersInstructionText;
                     if (!String.IsNullOrEmpty(instructionText)) {
                         writer.WriteBreak();
                         Label label = new Label();
                         label.Text = instructionText;
                         label.Page = Page;
                         label.ApplyStyle(InstructionTextStyle);
                         label.RenderControl(writer);
                         writer.WriteBreak();
                     }
                     consumersHeaderRendered = true;
                 }
                 RenderExistingConsumerConnection(writer, connection);
             }
         }
         if (consumersHeaderRendered) {
             writer.RenderEndTag(); // Fieldset
         }
         // Then, display connections for which we are consumers (connections to providers)
         foreach (WebPartConnection connection in connections) {
             if (connection.Consumer == webPartToConnect) {
                 if (!headerRendered) {
                     RenderInstructionTitle(writer);
                     RenderInstructionText(writer);
                     headerRendered = true;
                 }
                 if (!providersHeaderRendered) {
                     writer.RenderBeginTag(HtmlTextWriterTag.Fieldset);
                     LabelStyle.AddAttributesToRender(writer, this);
                     writer.RenderBeginTag(HtmlTextWriterTag.Legend);
                     writer.Write(ProvidersTitle);
                     writer.RenderEndTag(); // Legend
                     string instructionText = ProvidersInstructionText;
                     if (!String.IsNullOrEmpty(instructionText)) {
                         writer.WriteBreak();
                         Label label = new Label();
                         label.Text = instructionText;
                         label.Page = Page;
                         label.ApplyStyle(InstructionTextStyle);
                         label.RenderControl(writer);
                         writer.WriteBreak();
                     }
                     providersHeaderRendered = true;
                 }
                 RenderExistingProviderConnection(writer, connection);
             }
         }
     }
     if (providersHeaderRendered) {
         writer.RenderEndTag(); // Fieldset
     }
     if (headerRendered) {
         writer.WriteBreak();
     }
     else {
         RenderNoExistingConnection(writer);
     }
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:80,代码来源:ConnectionsZone.cs

示例9: RenderExistingConnection

        private void RenderExistingConnection(HtmlTextWriter writer,
                                              string connectionPointName,
                                              string partTitle,
                                              string disconnectEventArg,
                                              string editEventArg,
                                              bool consumer,
                                              bool isActive) {

            Label label = new Label();
            label.Page = Page;
            label.ApplyStyle(LabelStyle);

            writer.RenderBeginTag(HtmlTextWriterTag.Fieldset);

            writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
            writer.RenderBeginTag(HtmlTextWriterTag.Table);
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.RenderBeginTag(HtmlTextWriterTag.Td);

            label.Text = (consumer ? SendText : GetText);
            label.RenderControl(writer);

            writer.RenderEndTag(); // TD
            LabelStyle.AddAttributesToRender(writer, this);
            writer.RenderBeginTag(HtmlTextWriterTag.Td);

            writer.WriteEncodedText(connectionPointName);

            writer.RenderEndTag(); // TD
            writer.RenderEndTag(); // TR
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.RenderBeginTag(HtmlTextWriterTag.Td);

            label.Text = (consumer ? SendToText : GetFromText);
            label.RenderControl(writer);

            writer.RenderEndTag(); // TD
            LabelStyle.AddAttributesToRender(writer, this);
            writer.RenderBeginTag(HtmlTextWriterTag.Td);

            writer.WriteEncodedText(partTitle);

            writer.RenderEndTag(); // TD
            writer.RenderEndTag(); // TR
            writer.RenderEndTag(); // TABLE

            WebPartVerb disconnectVerb = DisconnectVerb;
            disconnectVerb.EventArgument = disconnectEventArg;
            RenderVerb(writer, disconnectVerb);
            if (VerbButtonType == ButtonType.Link) {
                writer.Write("&nbsp;");
            }

            if (isActive) {
                WebPartVerb configureVerb = ConfigureVerb;
                if (editEventArg == null) {
                    configureVerb.Enabled = false;
                }
                else {
                    configureVerb.Enabled = true;
                    configureVerb.EventArgument = editEventArg;
                }
                RenderVerb(writer, configureVerb);
            }
            else {
                writer.WriteBreak();
                label.ApplyStyle(ErrorStyle);
                label.Text = ExistingConnectionErrorMessage;
                label.RenderControl(writer);
            }

            writer.RenderEndTag(); // FIELDSET
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:73,代码来源:ConnectionsZone.cs

示例10: RenderAddVerbs

        private void RenderAddVerbs(HtmlTextWriter writer) {
            WebPart webPartToConnect = WebPartToConnect;

            WebPartCollection webParts = null;
            if (WebPartManager != null) {
                webParts = WebPartManager.WebParts;
            }

            if (webPartToConnect != null || DesignMode) {
                // Are there any compatible consumers?
                bool consumersAvailable = DesignMode;
                if (!consumersAvailable && WebPartManager != null) {
                    ProviderConnectionPointCollection providers =
                        WebPartManager.GetEnabledProviderConnectionPoints(webPartToConnect);
                    foreach (ProviderConnectionPoint provider in providers) {
                        if (GetValidConsumers(webPartToConnect, provider, webParts).Count != 0) {
                            consumersAvailable = true;
                            break;
                        }
                    }
                }
                if (consumersAvailable) {
                    ZoneLinkButton connectConsumerButton = new ZoneLinkButton(this, connectConsumerEventArgument);
                    connectConsumerButton.Text = ConnectToConsumerText;
                    connectConsumerButton.ApplyStyle(VerbStyle);
                    connectConsumerButton.Page = Page;
                    connectConsumerButton.RenderControl(writer);
                    writer.WriteBreak();
                }

                // Are there any compatible providers?
                bool providersAvailable = DesignMode;
                if (!providersAvailable && WebPartManager != null) {
                    ConsumerConnectionPointCollection consumers =
                        WebPartManager.GetEnabledConsumerConnectionPoints(webPartToConnect);
                    foreach (ConsumerConnectionPoint consumer in consumers) {
                        if (GetValidProviders(webPartToConnect, consumer, webParts).Count != 0) {
                            providersAvailable = true;
                            break;
                        }
                    }
                }
                if (providersAvailable) {
                    ZoneLinkButton connectProviderButton = new ZoneLinkButton(this, connectProviderEventArgument);
                    connectProviderButton.Text = ConnectToProviderText;
                    connectProviderButton.ApplyStyle(VerbStyle);
                    connectProviderButton.Page = Page;
                    connectProviderButton.RenderControl(writer);
                    writer.WriteBreak();
                }

                // Add separator if anything was rendered
                if (providersAvailable || consumersAvailable) {
                    writer.RenderBeginTag(HtmlTextWriterTag.Hr);
                    writer.RenderEndTag();
                }
            }
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:58,代码来源:ConnectionsZone.cs

示例11: RenderConnectToProvidersDropDowns

        private void RenderConnectToProvidersDropDowns(HtmlTextWriter writer) {
            WebPart webPartToConnect = WebPartToConnect;

            if (webPartToConnect != null) {
                ConsumerConnectionPointCollection consumers =
                    WebPartManager.GetEnabledConsumerConnectionPoints(webPartToConnect);
                bool first = true;
                Label label = new Label();
                label.Page = Page;
                label.AssociatedControlInControlTree = false;
                foreach (ConsumerConnectionPoint consumer in consumers) {
                    DropDownList list = (DropDownList)_connectDropDownLists[consumer];
                    if ((list == null) || !list.Enabled) {
                        continue;
                    }

                    if (first) {
                        string connectToProviderTitle = ConnectToProviderTitle;
                        if (!String.IsNullOrEmpty(connectToProviderTitle)) {
                            label.Text = connectToProviderTitle;
                            label.ApplyStyle(LabelStyle);
                            label.AssociatedControlID = String.Empty;
                            label.RenderControl(writer);
                            writer.WriteBreak();
                        }

                        string connectToProviderInstructionText = ConnectToProviderInstructionText;
                        if (!String.IsNullOrEmpty(connectToProviderInstructionText)) {
                            writer.WriteBreak();
                            label.Text = connectToProviderInstructionText;
                            label.ApplyStyle(InstructionTextStyle);
                            label.AssociatedControlID = String.Empty;
                            label.RenderControl(writer);
                            writer.WriteBreak();
                        }

                        first = false;
                    }

                    writer.RenderBeginTag(HtmlTextWriterTag.Fieldset);

                    writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
                    writer.RenderBeginTag(HtmlTextWriterTag.Table);
                    writer.RenderBeginTag(HtmlTextWriterTag.Tr);
                    writer.RenderBeginTag(HtmlTextWriterTag.Td);

                    label.ApplyStyle(LabelStyle);
                    label.Text = GetText;
                    label.AssociatedControlID = String.Empty;
                    label.RenderControl(writer);

                    writer.RenderEndTag(); // TD

                    LabelStyle.AddAttributesToRender(writer, this);
                    writer.RenderBeginTag(HtmlTextWriterTag.Td);

                    writer.WriteEncodedText(consumer.DisplayName);

                    writer.RenderEndTag(); // TD
                    writer.RenderEndTag(); // TR
                    writer.RenderBeginTag(HtmlTextWriterTag.Tr);
                    writer.RenderBeginTag(HtmlTextWriterTag.Td);

                    label.Text = GetFromText;
                    label.AssociatedControlID = list.ClientID;
                    label.RenderControl(writer);

                    writer.RenderEndTag(); // TD
                    writer.RenderBeginTag(HtmlTextWriterTag.Td);

                    list.ApplyStyle(EditUIStyle);
                    list.RenderControl(writer);

                    writer.RenderEndTag(); // TD
                    writer.RenderEndTag(); // TR
                    writer.RenderEndTag(); // TABLE

                    WebPartVerb connectVerb = ConnectVerb;
                    connectVerb.EventArgument = String.Join(ID_SEPARATOR.ToString(CultureInfo.InvariantCulture),
                        new string[] { connectEventArgument, consumerEventArgument, consumer.ID });
                    RenderVerb(writer, connectVerb);

                    writer.RenderEndTag(); // FIELDSET
                }
                writer.AddStyleAttribute(HtmlTextWriterStyle.TextAlign, "right");
                writer.RenderBeginTag(HtmlTextWriterTag.Div);
                WebPartVerb cancelVerb = CancelVerb;
                cancelVerb.EventArgument = cancelEventArgument;
                RenderVerb(writer, cancelVerb);
                writer.RenderEndTag();
            }
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:92,代码来源:ConnectionsZone.cs

示例12: Render

        protected override void Render(HtmlTextWriter writer)
        {
            if (this._searchBarLabel != null)
            {
                _searchBarLabel.RenderControl(writer);
            }

            foreach (Button b  in this.ButtonList)
            {
                b.RenderControl(writer);
            }
            writer.WriteBreak();
            this._searchText.RenderControl(writer);
            this._searchButton.RenderControl(writer);

        }
开发者ID:DaleHawthorne,项目名称:DaleWare.Web.UI.Controls,代码行数:16,代码来源:SearchBarWebPart.cs

示例13: RenderContents

        protected override void RenderContents(HtmlTextWriter output)
        {
            if (!string.IsNullOrEmpty(_timePickerXml.Label.Text))
            {
                Label lbl = new Label();
                lbl.ID = string.Format("lbl{0}", _timePickerXml.Name);
                lbl.Text = _timePickerXml.Label.Text;

                if (!string.IsNullOrEmpty(_timePickerXml.Label.Css))
                    lbl.CssClass = _timePickerXml.Label.Css;

                if (!string.IsNullOrEmpty(_timePickerXml.Label.Style))
                {
                    string[] styles = _timePickerXml.Label.Style.Split(';');

                    foreach (string style in styles)
                    {
                        string[] attributes = style.Split(':');

                        if (attributes.Length == 2)
                            lbl.Style.Add(attributes[0], attributes[1]);
                    }
                }

                lbl.RenderControl(output);
            }

            if (!string.IsNullOrEmpty(_timePickerXml.Css))
            {
                this._textBox.CssClass = _timePickerXml.Css;
            }

            if (!string.IsNullOrEmpty(_timePickerXml.Style))
            {
                string[] styles = _timePickerXml.Style.Split(';');

                foreach (string style in styles)
                {
                    string[] attributes = style.Split(':');

                    if (attributes.Length == 2)
                        this._textBox.Style.Add(attributes[0], attributes[1]);
                }
            }

            base.RenderContents(output);
            output.WriteBreak();
        }
开发者ID:danilocecilia,项目名称:HulcherProject,代码行数:48,代码来源:DynamicTime.cs

示例14: SaveProcessedData

        private static void SaveProcessedData(string targetPath, List<WorkItem> items)
        {
            var filePath = Path.Combine(targetPath, "data.html");
            var calendar = DateTimeFormatInfo.CurrentInfo.Calendar;
            
            using (var stringWriter = new StringWriter())
            using (var writer = new HtmlTextWriter(stringWriter))
            {
                stringWriter.WriteLine([email protected]"
<!doctype html>
<html lang=""en"">
<head>
  <meta charset=""utf-8"">

  <title>{targetPath}</title>

  <link rel=""stylesheet"" href=""styles.css"">
  </head>
  <body>
  ");
                /*
  <link rel=""stylesheet"" href=""https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"" integrity=""sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7"" crossorigin=""anonymous"">
  <link rel=""stylesheet"" href=""https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css"" integrity = ""sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r"" crossorigin = ""anonymous"" >
  <script src=""https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"" integrity = ""sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS"" crossorigin = ""anonymous"" ></ script >
    */
                writer.Indent++;

                foreach (var grouping in items.Where(i => i.CreationDate.Year == 2015).GroupBy(i => calendar.GetWeekOfYear(i.CreationDate, CalendarWeekRule.FirstDay, DayOfWeek.Monday)))
                {
                    writer.RenderBeginTag(HtmlTextWriterTag.H1);
                    writer.Write($"Week {grouping.Key}");
                    writer.RenderEndTag(); // h2

                    foreach (var item in grouping)
                    {
                        var pr = item as PullRequest;

                        writer.AddAttribute(HtmlTextWriterAttribute.Class, item.Author);
                        writer.AddAttribute(HtmlTextWriterAttribute.Id, item.Id.ToString());
                        writer.RenderBeginTag(HtmlTextWriterTag.Div);
                        writer.Indent++;

                        writer.RenderBeginTag("p");
                        writer.Indent++;

                        writer.RenderBeginTag(HtmlTextWriterTag.H3);
                        writer.AddAttribute(HtmlTextWriterAttribute.Href, item.Url);
                        writer.RenderBeginTag(HtmlTextWriterTag.A);
                        writer.Write((pr != null) ? "Pull request " : "Issue ");
                        writer.Write("#" + item.Id);
                        writer.RenderEndTag(); //a
                        writer.RenderEndTag(); //h3

                        writer.RenderBeginTag(HtmlTextWriterTag.H2);
                        writer.Write(item.Title);
                        writer.RenderEndTag(); // h2

                        writer.RenderEndTag(); // p
                        writer.Indent--;

                        if (pr != null)
                        {
                            writer.RenderBeginTag(HtmlTextWriterTag.P);
                            writer.Indent++;

                            if (pr.CloseDate == default(DateTime))
                            {
                                writer.Write($"Opened at <strong>{pr.CreationDate.ToString("dddd MMMM d, HH:mm")}, never closed</strong>. ");
                            }
                            else
                            {
                                writer.Write($"Opened at <strong>{pr.CreationDate.ToString("dddd MMMM d, HH:mm")}</strong>, closed at <strong>{pr.CloseDate.ToString("dddd MMMM d, HH:mm")}</strong>. ");
                                writer.RenderBeginTag(HtmlTextWriterTag.Strong);
                                writer.WriteBreak();
                                writer.Write($"Under review for {(pr.CloseDate - pr.CreationDate).TotalHours.ToString("F")} hours");
                                writer.RenderEndTag();
                            }
                            writer.RenderEndTag(); // p
                            writer.Indent--;

                            writer.RenderBeginTag(HtmlTextWriterTag.P);
                            writer.Indent++;

                            writer.Write($"First commit on <strong>{pr.FirstCommit.ToString("dddd MMMM d, HH:mm")}</strong>, last at <strong>{pr.LastCommit.ToString("dddd MMMM d, HH:mm")}</strong>.");
                            writer.WriteBreak();
                            writer.Write("Worked on for ");
                            writer.RenderBeginTag(HtmlTextWriterTag.Strong);
                            writer.Write($"{(pr.LastCommit - pr.FirstCommit).TotalHours.ToString("F")} hours");
                            writer.RenderEndTag();

                            writer.RenderEndTag(); // p
                            writer.Indent--;

                            writer.RenderBeginTag(HtmlTextWriterTag.P);
                            writer.Indent++;

                            foreach (var commit in pr.Commits)
                            {
                                writer.AddAttribute(HtmlTextWriterAttribute.Class, commit.Author);
                                writer.RenderBeginTag(HtmlTextWriterTag.Span);
//.........这里部分代码省略.........
开发者ID:AmadeusW,项目名称:GitTimeline,代码行数:101,代码来源:Program.cs

示例15: RenderInstructionTitle

 private void RenderInstructionTitle(HtmlTextWriter writer)
 {
     if ((this.PartChromeType != System.Web.UI.WebControls.WebParts.PartChromeType.None) && (this.PartChromeType != System.Web.UI.WebControls.WebParts.PartChromeType.BorderOnly))
     {
         string instructionTitle = this.InstructionTitle;
         if (!string.IsNullOrEmpty(instructionTitle))
         {
             Label label = new Label();
             if (this.WebPartToConnect != null)
             {
                 label.Text = string.Format(CultureInfo.CurrentCulture, instructionTitle, new object[] { this.WebPartToConnect.DisplayTitle });
             }
             else
             {
                 label.Text = instructionTitle;
             }
             label.Page = this.Page;
             label.ApplyStyle(base.LabelStyle);
             label.RenderControl(writer);
             writer.WriteBreak();
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:23,代码来源:ConnectionsZone.cs


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