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


C# TagHelperOutput.SuppressOutput方法代码示例

本文整理汇总了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();
 }
开发者ID:freemsly,项目名称:TagHelperSamples,代码行数:7,代码来源:ModalBodyTagHelper.cs

示例2: Process

 public override void Process(TagHelperContext context, TagHelperOutput output)
 {
     if (!Condition)
     {
         output.SuppressOutput();
     }
 }
开发者ID:ChujianA,项目名称:aspnetcore-doc-cn,代码行数:7,代码来源:ConditionTagHelper.cs

示例3: Process

 public override void Process(TagHelperContext context, TagHelperOutput output)
 {
     if (!AspVisible)
     {
         output.SuppressOutput();
     }
 }
开发者ID:cabarney,项目名称:MvcNextGen,代码行数:7,代码来源:VisibleTagHelper.cs

示例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;"">&nbsp;</div>");

            //    foreach (var move in MoveResult.MovesPlayed) {
            //        AddBoardToOutput(move.Board, output);
            //        output.Content.AppendEncoded(@"&nbsp;");
            //        output.Content.AppendEncoded(Environment.NewLine);
            //    }
            //}
        }
开发者ID:sayedihashimi,项目名称:sudoku,代码行数:31,代码来源:MoveResultTagHelper.cs

示例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();
     }
 }
开发者ID:glennc,项目名称:GHUtils,代码行数:9,代码来源:ScriptManager.cs

示例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));
        }
开发者ID:blink2linkme,项目名称:Platformus,代码行数:9,代码来源:CheckBoxTagHelper.cs

示例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());
        }
开发者ID:OlegDokuka,项目名称:Platformus,代码行数:9,代码来源:UnboundCheckBoxTagHelper.cs

示例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));
        }
开发者ID:blink2linkme,项目名称:Platformus,代码行数:9,代码来源:DropDownListTagHelper.cs

示例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());
        }
开发者ID:blink2linkme,项目名称:Platformus,代码行数:9,代码来源:SecretEditorTagHelper.cs

示例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();
 }
开发者ID:MisterJames,项目名称:TagHelperSamples,代码行数:11,代码来源:ModalFooterTagHelper.cs

示例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);
 }
开发者ID:rjperes,项目名称:NodeServices,代码行数:12,代码来源:AngularPrerenderTagHelper.cs

示例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());
        }
开发者ID:billwaddyjr,项目名称:Razor,代码行数:20,代码来源:TagHelperOutputTest.cs

示例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();
        }
开发者ID:4myBenefits,项目名称:Mvc,代码行数:39,代码来源:EnvironmentTagHelper.cs

示例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());
        }
开发者ID:billwaddyjr,项目名称:Razor,代码行数:24,代码来源:TagHelperOutputTest.cs

示例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);
            }
        }
开发者ID:njannink,项目名称:sonarlint-vs,代码行数:32,代码来源:CacheTagHelper.cs


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