本文整理汇总了C#中Fluqi.Extension.Helpers.jStringBuilder.AppendFormat方法的典型用法代码示例。如果您正苦于以下问题:C# jStringBuilder.AppendFormat方法的具体用法?C# jStringBuilder.AppendFormat怎么用?C# jStringBuilder.AppendFormat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fluqi.Extension.Helpers.jStringBuilder
的用法示例。
在下文中一共展示了jStringBuilder.AppendFormat方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RenderAsTable
/// <summary>
/// Returns an HTML table of all available icons, split into <paramref name="numColumns"/>.
/// </summary>
/// <param name="numColumns">Number of columns to split the table into</param>
/// <returns>HTML table of [rendered] icons</returns>
public static string RenderAsTable(int numColumns) {
int currCol = 0;
jStringBuilder sb = new jStringBuilder(true, 1);
sb.AppendTabsLine("<table id=\"table-icons\">");
List<string>.Enumerator e = Icons.ToList().GetEnumerator();
while (e.MoveNext()) {
if (currCol == 0)
sb.Append("<tr>");
sb.AppendTabs();
sb.AppendFormat("<td title=\".{0}\">", e.Current);
sb.AppendFormat( "<span class=\"ui-icon {0}\"></span>", e.Current);
sb.AppendFormat("</td>");
currCol++;
if (currCol == numColumns) {
sb.AppendLine("</tr>");
currCol = 0;
}
}
sb.AppendTabsLine("</table>");
return sb.ToString();
}
示例2: GetTagHtml
/// <summary>
/// Builds up the HTML for the AutoComplete control and options (and returns the generated HTML).
/// </summary>
/// <returns>Generated HTML for the control.</returns>
protected internal string GetTagHtml() {
// ID property is _mandatory_
if (string.IsNullOrEmpty(this.ID))
throw new ArgumentException("AutoComplete ID property _must_ be supplied.");
bool prettyRender = this.Rendering.PrettyRender;
bool renderCss = this.Rendering.RenderCSS;
int tabDepth = this.Rendering.TabDepth;
jStringBuilder sb = new jStringBuilder(prettyRender, tabDepth);
if (renderCss)
this.WithCss("ui-autocomplete-input");
// turn off autocomplete, so it doesn't compete with dropdown menu
this.WithAttribute("autocomplete", "off");
sb.AppendTabsIf();
sb.AppendFormat("<input id=\"{0}\"", this.ID);
this.RenderAttributes(sb);
sb.Append(" />");
return sb.ToString();
}
示例3: RenderCloseItem
private void RenderCloseItem(jStringBuilder sb) {
sb.AppendFormat("</{0}>", this.Tag);
}
示例4: RenderAsList
/// <summary>
/// Returns an HTML list (ul/li set) of all the available icons.
/// </summary>
/// <returns>HTML list (ul/li set) of all the available icons.</returns>
public static string RenderAsList() {
jStringBuilder sb = new jStringBuilder(true, 1);
sb.AppendTabsLine("<ul id=\"icons\">");
List<string>.Enumerator e = Icons.ToList().GetEnumerator();
while (e.MoveNext()) {
sb.AppendTabs();
sb.AppendFormat("<li title=\".{0}\">", e.Current);
sb.AppendFormat( "<span class=\"ui-icon {0}\"></span>", e.Current);
sb.AppendFormat("</li>");
sb.AppendLine();
}
sb.AppendTabsLine("</ul>");
return sb.ToString();
}
示例5: RenderOpenItem
private void RenderOpenItem(jStringBuilder sb) {
bool renderCss = this.Menu.Rendering.RenderCSS;
sb.AppendTabsFormat("<{0}", this.Tag);
if (this.IsDivider) {
if (renderCss)
this.AddCssClass("ui-widget-content ui-menu-divider");
this.RenderAttributes(sb);
sb.Append(">");
return;
}
if (renderCss)
this.AddCssClass("ui-menu-item");
if (this.IsDisabled)
this.AddCssClass("ui-state-disabled");
this.RenderAttributes(sb);
sb.Append(">");
if (!string.IsNullOrEmpty(this.Html))
sb.Append(this.Html);
else {
if (!string.IsNullOrEmpty(this.TargetURL))
sb.AppendFormat("<a href=\"{0}\"", this.TargetURL);
else
sb.AppendFormat("<a href=\"#\"");
if (renderCss)
sb.Append(" class=\"ui-corner-all\"");
sb.Append(">");
if (!string.IsNullOrEmpty(this.Icon)) {
sb.AppendFormat("<span class=\"ui-icon {0}\"></span>", this.Icon);
}
// Title is mandatory when not using the HTML version
sb.Append(this.Title);
sb.Append("</a>");
}
}
示例6: RenderOpenItem
private void RenderOpenItem(jStringBuilder sb) {
bool renderCss = this.SelectMenu.Rendering.RenderCSS;
sb.AppendTabsFormat("<{0}", this.Tag);
this.RenderAttributes(sb);
if (this.Selected) {
sb.Append(" selected=\"selected\"");
}
if (!string.IsNullOrEmpty(this.Value)) {
sb.AppendFormat(" value=\"{0}\"", this.Value);
}
sb.Append(">");
sb.Append(this.Title);
}
示例7: RenderRootOpenItem
private void RenderRootOpenItem(jStringBuilder sb) {
sb.AppendTabsFormat("<{0}", PARENT_TAG);
if (!string.IsNullOrEmpty(this.Label)) {
sb.AppendFormat(" {0}=\"{1}\"",
LABEL_TAG,
HttpUtility.HtmlAttributeEncode(this.Label)
);
}
if (this.IsDisabled) {
sb.Append(" disabled=\"disabled\"");
}
this.RenderAttributes(sb);
sb.Append(">");
}
示例8: RenderOpenItem
private void RenderOpenItem(jStringBuilder sb) {
sb.AppendTabsFormat("<{0}>", this.Tag);
if (!string.IsNullOrEmpty(this.Html))
sb.Append(this.Html);
else {
if (!string.IsNullOrEmpty(this.TargetURL))
sb.AppendFormat("<a href=\"{0}\">", this.TargetURL);
else
sb.AppendFormat("<a href=\"#\">");
if (!string.IsNullOrEmpty(this.Icon)) {
sb.AppendFormat("<span class=\"ui-icon {0}\"></span>", this.Icon);
}
// Title is mandatory when not using the HTML version
sb.Append(this.Title);
sb.Append("</a>");
}
}
示例9: RenderAttributes
/// <summary>
/// Renders the registered attributes to the provided jStringBuilder object. The registered
/// CSS classes and Style rules are also added at this point (as they're attributes as well really).
/// </summary>
protected internal void RenderAttributes(jStringBuilder sb) {
bool hasID = _HtmlAttr.Keys.Any(x => x == "id");
// force the ID to come out first (as this is what you're interested in 90% of the time)
if (hasID) {
sb.AppendFormat(" id=\"{0}\"", HttpUtility.HtmlAttributeEncode(_HtmlAttr["id"].ToString()) );
}
// add in any defined CSS classes
if (_CssClasses.Any()) {
sb.Append(" class=\"");
sb.Append(this._CssClasses.ToSeparated(" ") );
sb.Append("\"");
}
// add in the full style rules
if (_Styles.Any()) {
sb.Append(" style=\"");
foreach (string key in this._Styles.Keys) {
sb.AppendFormat("{0}:{1};", HttpUtility.HtmlAttributeEncode(key), HttpUtility.HtmlAttributeEncode(_Styles[key].ToString()) );
}
sb.TrimEnd(";");
sb.Append("\"");
}
if (_HtmlAttr.Any()) {
// avoid ID as this will already have been added
foreach (string key in _HtmlAttr.Keys.Where(x => x != "id")) {
sb.AppendFormat(" {0}=\"{1}\"", key, HttpUtility.HtmlAttributeEncode(_HtmlAttr[key].ToString()) );
}
}
}
示例10: OptionsCSharpCode
protected string OptionsCSharpCode() {
jStringBuilder sb = new jStringBuilder(true/*includeWhitespace*/, 2);
if (this.Disabled) sb.AppendTabsLineIf(".SetDisabled(true)");
if (!this.AutoOpen) sb.AppendTabsLineIf(".SetAutoOpen(false)");
if (!this.CloseOnEscape) sb.AppendTabsLineIf(".SetCloseOnEscape(false)");
if (!Utils.IsNullEmptyOrDefault(this.CloseText, Options.DEFAULT_CLOSE_TEXT)) sb.AppendTabsFormatLineIf(".SetCloseText(\"{0}\")", this.CloseText);
if (!string.IsNullOrEmpty(this.DialogClass)) sb.AppendTabsFormatLineIf(".SetDialogClass(\"{0}\")", this.DialogClass);
if (!this.Draggable) sb.AppendTabsLineIf(".SetDraggable(false)");
if (!Utils.IsNullEmptyOrDefault(this.Height, Options.DEFAULT_HEIGHT)) {
if (Utils.IsNumeric(this.Height))
sb.AppendTabsFormatLineIf(".SetHeight({0})", this.Height);
else
sb.AppendTabsFormatLineIf(".SetHeight(\"{0}\")", this.Height);
}
if (!string.IsNullOrEmpty(this.HideEffect)) sb.AppendTabsFormatLineIf(".SetHideEffect(\"{0}\")", this.HideEffect);
if (this.MinWidth != Options.DEFAULT_MIN_WIDTH) sb.AppendTabsFormatLineIf(".SetMinWidth({0})", this.MinWidth);
if (!Utils.IsNullEmptyOrDefault(this.MaxWidth, Options.DEFAULT_MAX_WIDTH)) {
if (Utils.IsNumeric(this.MaxWidth))
sb.AppendTabsFormatLineIf(".SetMaxWidth({0})", this.MaxWidth);
else
sb.AppendTabsFormatLineIf(".SetMaxWidth(\"{0}\")", this.MaxWidth);
}
if (this.MinHeight != Options.DEFAULT_MIN_HEIGHT) sb.AppendTabsFormatLineIf(".SetMinHeight({0})", this.MinHeight);
if (!Utils.IsNullEmptyOrDefault(this.MaxHeight, Options.DEFAULT_MAX_HEIGHT)) {
if (Utils.IsNumeric(this.MaxHeight))
sb.AppendTabsFormatLineIf(".SetMaxHeight({0})", this.MaxHeight);
else
sb.AppendTabsFormatLineIf(".SetMaxHeight(\"{0}\")", this.MaxHeight);
}
if (this.Modal) sb.AppendTabsFormatLineIf(".SetModal(true)");
if (!Utils.IsNullEmptyOrDefault(this.Position1, Options.DEFAULT_POSITION)) {
// first one is populated, so there's something of interest here
sb.AppendTabsIf(".SetPosition(");
if (Utils.IsNumeric(this.Position1))
sb.Append(this.Position1);
else
sb.AppendFormat("\"{0}\"", this.Position1);
if (!string.IsNullOrEmpty(this.Position2)) {
// second one is populated too
if (Utils.IsNumeric(this.Position2))
sb.AppendFormat(", {0}", this.Position2);
else
sb.AppendFormat(", \"{0}\"", this.Position2);
}
// and close
sb.AppendLineIf(")");
}
if (!this.Resizable) sb.AppendTabsFormatLineIf(".SetResizable(false)");
if (!string.IsNullOrEmpty(this.ShowEffect)) sb.AppendTabsFormatLineIf(".SetShowEffect(\"{0}\")", this.ShowEffect);
if (!this.Stack) sb.AppendTabsLineIf(".SetStack(true)");
if (!string.IsNullOrEmpty(this.Title)) sb.AppendTabsFormatLineIf(".SetTitle(\"{0}\")", this.Title);
if (this.Width != Options.DEFAULT_WIDTH) sb.AppendTabsFormatLineIf(".SetWidth({0})", this.Width);
if (this.ZIndex != Options.DEFAULT_ZINDEX) sb.AppendTabsFormatLineIf(".SetZIndex({0})", this.ZIndex);
// buttons are always added in the demo
sb.AppendTabsLineIf(".AddButton(\"OK\", \"return OKClicked();\")");
sb.AppendTabsLineIf(".AddButton(\"Cancel\", \"return CancelClicked();\")");
return sb.ToString();
}
示例11: GetTagHtml
/// <summary>
/// Builds up the opening HTML for the Accordion control.
/// </summary>
/// <returns>Opening HTML</returns>
/// <remarks>
/// Only renders the opening part as we need to allow the HTML in the "using" block
/// to be rendered out and then close off).
/// </remarks>
protected string GetTagHtml() {
bool prettyRender = this.Rendering.PrettyRender;
bool renderCss = this.Rendering.RenderCSS;
int tabDepth = this.Rendering.TabDepth;
jStringBuilder sb = new jStringBuilder(prettyRender, tabDepth);
_Panels.ResetPaneIndex();
// Work out if we have an accordion set as the active one
_Panels.ResolveActivePane();
if (renderCss) {
this.WithCss("ui-accordion ui-widget ui-helper-reset");
if (this.Options.AreIconsEnabled())
// icons are on, so add the main CSS class for the icons as well as the normal classes
base.WithCss("ui-accordion-icons");
}
base.WithID(this.ID);
sb.AppendFormat("<{0}", this.Options.ContainerTag);
base.RenderAttributes(sb);
sb.Append(">");
return sb.ToString();
}
示例12: RenderClosingTag
/// <summary>
/// Renders the closing tag for the PushButton control.
/// </summary>
/// <param name="sb">StringBuilder to add the closing tag to</param>
protected void RenderClosingTag(jStringBuilder sb) {
if (Core.ButtonType.IsInputButton(this.InputType))
sb.Append(" />");
else
sb.AppendFormat("</{0}>", Core.ButtonType.ButtonTypeToString(this.InputType));
}
示例13: RenderOpeningTag
/// <summary>
/// Renders the opening tag for the PushButton control.
/// </summary>
/// <param name="sb">StringBuilder to add the opening tag to</param>
protected void RenderOpeningTag(jStringBuilder sb) {
switch (this.InputType) {
// intentional fallthrough
case Core.ButtonType.eButtonType.Reset:
case Core.ButtonType.eButtonType.Submit:
sb.AppendFormat("<input type=\"{0}\" value=\"{1}\"", Core.ButtonType.ButtonTypeToString(this.InputType), this.Label);
break;
case Core.ButtonType.eButtonType.Hyperlink:
sb.AppendFormat("<a href=\"{0}\"", this.Href);
break;
case Core.ButtonType.eButtonType.Button:
sb.Append("<button");
break;
default:
throw new NotSupportedException(string.Format("Tag type {0} is not supported.", this.InputType.ToString()));
}
}