本文整理汇总了C#中Microsoft.AspNet.Razor.Runtime.TagHelpers.TagHelperOutput.SuppressOutput方法的典型用法代码示例。如果您正苦于以下问题:C# TagHelperOutput.SuppressOutput方法的具体用法?C# TagHelperOutput.SuppressOutput怎么用?C# TagHelperOutput.SuppressOutput使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.AspNet.Razor.Runtime.TagHelpers.TagHelperOutput
的用法示例。
在下文中一共展示了TagHelperOutput.SuppressOutput方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProcessAsync
public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
{
var childContent = await context.GetChildContentAsync();
var modalContext = (ModalContext)context.Items[typeof(ModalTagHelper)];
modalContext.Body = childContent;
output.SuppressOutput();
}
示例2: Process
public override void Process(TagHelperContext context, TagHelperOutput output)
{
if (!Condition)
{
output.SuppressOutput();
}
}
示例3: Process
public override void Process(TagHelperContext context, TagHelperOutput output)
{
if (!AspVisible)
{
output.SuppressOutput();
}
}
示例4: Process
//[HtmlAttributeName("DisplaySteps")]
//public bool DisplaySteps { get; set; }
public override void Process(TagHelperContext context, TagHelperOutput output)
{
// [initial-board] -> [solved-board]
// seqences of boards
if(MoveResult == null) {
output.SuppressOutput();
return;
}
output.TagName = "span";
AddBoardToOutput(MoveResult.OriginalBoard.Board, output);
output.Content.AppendEncoded(Environment.NewLine);
output.Content.AppendEncoded(@" ");
AddBoardToOutput(MoveResult.CurrentBoard.Board, output);
//if (DisplaySteps) {
// output.Content.AppendEncoded(Environment.NewLine);
// output.Content.AppendEncoded(@"<br/>");
// output.Content.AppendEncoded(@"<div style=""height: 10px;""> </div>");
// foreach (var move in MoveResult.MovesPlayed) {
// AddBoardToOutput(move.Board, output);
// output.Content.AppendEncoded(@" ");
// output.Content.AppendEncoded(Environment.NewLine);
// }
//}
}
示例5: ProcessAsync
public async override Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
{
if (context.AllAttributes["managed"].Value.ToString() == "true")
{
var content = await context.GetChildContentAsync();
_manager.Scripts.Add(content);
output.SuppressOutput();
}
}
示例6: Process
public override void Process(TagHelperContext context, TagHelperOutput output)
{
if (this.ViewContext == null || this.For == null)
return;
output.SuppressOutput();
output.Content.Clear();
output.Content.Append(this.GenerateCheckBox(this.ViewContext, this.For));
}
示例7: Process
public override void Process(TagHelperContext context, TagHelperOutput output)
{
if (string.IsNullOrEmpty(this.Identity))
return;
output.SuppressOutput();
output.Content.Clear();
output.Content.Append(this.GenerateCheckBox());
}
示例8: Process
public override void Process(TagHelperContext context, TagHelperOutput output)
{
if (this.ViewContext == null || this.For == null || this.Options == null)
return;
output.SuppressOutput();
output.Content.Clear();
output.Content.Append(this.GenerateDropDownList(this.ViewContext, this.For, this.Options));
}
示例9: Process
public override void Process(TagHelperContext context, TagHelperOutput output)
{
if (this.For == null)
return;
output.SuppressOutput();
output.Content.Clear();
output.Content.Append(this.GenerateField());
}
示例10: ProcessAsync
public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
{
if (ShowDismiss)
{
output.PreContent.AppendFormat(@"<button type='button' class='btn btn-default' data-dismiss='modal'>{0}</button>", DismissText);
}
var childContent = await context.GetChildContentAsync();
var modalContext = (ModalContext)context.Items[typeof(ModalTagHelper)];
modalContext.Footer = childContent;
output.SuppressOutput();
}
示例11: ProcessAsync
public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
{
var result = await AngularRenderer.RenderToString(
nodeServices: this.nodeServices,
componentModuleName: this.ModuleName,
componentExportName: this.ExportName,
componentTagName: output.TagName,
requestUrl: UriHelper.GetEncodedUrl(this.contextAccessor.HttpContext.Request)
);
output.SuppressOutput();
output.PostElement.AppendEncoded(result);
}
示例12: SuppressOutput_Sets_TagName_Content_PreContent_PostContent_ToNull
public void SuppressOutput_Sets_TagName_Content_PreContent_PostContent_ToNull()
{
// Arrange
var tagHelperOutput = new TagHelperOutput("p");
tagHelperOutput.PreContent.Append("Pre Content");
tagHelperOutput.Content.Append("Content");
tagHelperOutput.PostContent.Append("Post Content");
// Act
tagHelperOutput.SuppressOutput();
// Assert
Assert.Null(tagHelperOutput.TagName);
Assert.NotNull(tagHelperOutput.PreContent);
Assert.Empty(tagHelperOutput.PreContent.GetContent());
Assert.NotNull(tagHelperOutput.Content);
Assert.Empty(tagHelperOutput.Content.GetContent());
Assert.NotNull(tagHelperOutput.PostContent);
Assert.Empty(tagHelperOutput.PostContent.GetContent());
}
示例13: Process
/// <inheritdoc />
public override void Process(TagHelperContext context, TagHelperOutput output)
{
// Always strip the outer tag name as we never want <environment> to render
output.TagName = null;
if (string.IsNullOrWhiteSpace(Names))
{
// No names specified, do nothing
return;
}
var environments = Names.Split(NameSeparator, StringSplitOptions.RemoveEmptyEntries)
.Where(name => !string.IsNullOrWhiteSpace(name));
if (!environments.Any())
{
// Names contains only commas or empty entries, do nothing
return;
}
var currentEnvironmentName = HostingEnvironment.EnvironmentName?.Trim();
if (string.IsNullOrWhiteSpace(currentEnvironmentName))
{
// No current environment name, do nothing
return;
}
if (environments.Any(name =>
string.Equals(name.Trim(), currentEnvironmentName, StringComparison.OrdinalIgnoreCase)))
{
// Matching environment name found, do nothing
return;
}
// No matching environment name found, suppress all output
output.SuppressOutput();
}
示例14: SuppressOutput_PreventsTagOutput
public void SuppressOutput_PreventsTagOutput()
{
// Arrange
var tagHelperOutput = new TagHelperOutput("p",
attributes: new Dictionary<string, object>
{
{ "class", "btn" },
{ "something", " spaced " }
});
tagHelperOutput.PreContent.Append("Pre Content");
tagHelperOutput.Content.Append("Content");
tagHelperOutput.PostContent.Append("Post Content");
// Act
tagHelperOutput.SuppressOutput();
// Assert
Assert.NotNull(tagHelperOutput.PreContent);
Assert.Empty(tagHelperOutput.PreContent.GetContent());
Assert.NotNull(tagHelperOutput.Content);
Assert.Empty(tagHelperOutput.Content.GetContent());
Assert.NotNull(tagHelperOutput.PostContent);
Assert.Empty(tagHelperOutput.PostContent.GetContent());
}
示例15: ProcessAsync
/// <inheritdoc />
public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
{
TagHelperContent result = null;
if (Enabled)
{
var key = GenerateKey(context);
if (!MemoryCache.TryGetValue(key, out result))
{
// Create an entry link scope and flow it so that any triggers related to the cache entries
// created within this scope get copied to this scope.
using (var link = MemoryCache.CreateLinkingScope())
{
result = await context.GetChildContentAsync();
MemoryCache.Set(key, result, GetMemoryCacheEntryOptions(link));
}
}
}
// Clear the contents of the "cache" element since we don't want to render it.
output.SuppressOutput();
if (Enabled)
{
output.Content.SetContent(result);
}
else
{
result = await context.GetChildContentAsync();
output.Content.SetContent(result);
}
}