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


C# ControlBuilder.AllowWhitespaceLiterals方法代码示例

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


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

示例1: Deny_Unrestricted

		public void Deny_Unrestricted ()
		{
			ControlBuilder cb = new ControlBuilder ();
			Assert.IsNull (cb.ControlType, "ControlType");
			Assert.IsFalse (cb.HasAspCode, "HasAspCode");
			cb.ID = "mono";
			Assert.AreEqual ("mono", cb.ID, "ID");
			Assert.AreEqual (typeof (Control), cb.NamingContainerType, "NamingContainerType");
			Assert.IsNull (cb.TagName, "TagName");
			Assert.IsTrue (cb.AllowWhitespaceLiterals (), "AllowWhitespaceLiterals");
			cb.AppendLiteralString ("mono");
			cb.AppendSubBuilder (cb);
			cb.CloseControl ();
			Assert.IsNull (cb.GetChildControlType (null, null), "GetChildControlType");
			Assert.IsTrue (cb.HasBody (), "HasBody");
			Assert.IsFalse (cb.HtmlDecodeLiterals (), "HtmlDecodeLiterals");
			cb.Init (null, cb, typeof (TemplateBuilder), "span", "mono", null);
			Assert.IsFalse (cb.NeedsTagInnerText (), "NeedsTagInnerText");
			//cb.OnAppendToParentBuilder (null);
			cb.SetTagInnerText ("mono");

			cb = ControlBuilder.CreateBuilderFromType (null, cb, typeof (TemplateBuilder), "span", "mono", null, 0, String.Empty);
			Assert.IsNotNull (cb, "CreateBuilderFromType");
		}
开发者ID:nobled,项目名称:mono,代码行数:24,代码来源:ControlBuilderCas.cs

示例2: BuildBuildMethodInternal


//.........这里部分代码省略.........
                            call.Method.MethodName = "BuildCachedControl";
                            call.Parameters.Add(ctrlRefExpr);
                            call.Parameters.Add(new CodePrimitiveExpression(ctrlBuilder.ID));

                            // If the caching is shared, use the type of the control as the key
                            // otherwise, generate a guid
                            if (cacheAttrib.Shared) {
                                call.Parameters.Add(new CodePrimitiveExpression(
                                    ctrlBuilder.ControlType.GetHashCode().ToString(CultureInfo.InvariantCulture)));
                            }
                            else
                                call.Parameters.Add(new CodePrimitiveExpression(Guid.NewGuid().ToString()));
                            call.Parameters.Add(new CodePrimitiveExpression(cacheAttrib.Duration));
                            call.Parameters.Add(new CodePrimitiveExpression(cacheAttrib.VaryByParams));
                            call.Parameters.Add(new CodePrimitiveExpression(cacheAttrib.VaryByControls));
                            call.Parameters.Add(new CodePrimitiveExpression(cacheAttrib.VaryByCustom));
                            call.Parameters.Add(new CodePrimitiveExpression(cacheAttrib.SqlDependency));
                            CodeDelegateCreateExpression newDelegate = new CodeDelegateCreateExpression();
                            newDelegate.DelegateType = new CodeTypeReference(typeof(BuildMethod));
                            newDelegate.TargetObject = new CodeThisReferenceExpression();
                            newDelegate.MethodName = buildMethodPrefix + ctrlBuilder.ID;
                            call.Parameters.Add(newDelegate);
                            if (useProviderName) {
                                call.Parameters.Add(new CodePrimitiveExpression(providerName));
                            }
                            buildSubControlBlock.Add(new CodeExpressionStatement(call));
                        }

                    }
                    else if (child is string && !builder.HasAspCode) {

                        // VSWhidbey 276806: if the control cares about the inner text (builder does not allow whitespace literals)
                        // the inner literals should be added to the control.
                        if (!fControlSkin || !builder.AllowWhitespaceLiterals()) {
                            string s = (string) child;
                            CodeExpression expr;

                            if (!UseResourceLiteralString(s)) {
                                // e.g. ((IParserAccessor)__ctrl).AddParsedSubObject(new LiteralControl({{@QuoteCString(text)}}));
                                newExpr = new CodeObjectCreateExpression(typeof(LiteralControl));
                                newExpr.Parameters.Add(new CodePrimitiveExpression(s));
                                expr = newExpr;
                            }
                            else {
                                // Add the string to the resource builder, and get back its offset/size
                                int offset, size;
                                bool fAsciiOnly;
                                _stringResourceBuilder.AddString(s, out offset, out size, out fAsciiOnly);

                                methCallExpression = new CodeMethodInvokeExpression();
                                methCallExpression.Method.TargetObject = new CodeThisReferenceExpression();
                                methCallExpression.Method.MethodName = "CreateResourceBasedLiteralControl";
                                methCallExpression.Parameters.Add(new CodePrimitiveExpression(offset));
                                methCallExpression.Parameters.Add(new CodePrimitiveExpression(size));
                                methCallExpression.Parameters.Add(new CodePrimitiveExpression(fAsciiOnly));
                                expr = methCallExpression;
                            }

                            BuildAddParsedSubObjectStatement(buildSubControlBlock, expr, linePragma, ctrlRefExpr, ref gotParserVariable);
                        }
                    }
                }
            }

            // Process the complex attributes
            if (builder.ComplexPropertyEntries.Count > 0) {
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:67,代码来源:BaseTemplateCodeDomTreeGenerator.cs

示例3: BuildBuildMethodInternal


//.........这里部分代码省略.........
                         }
                     }
                     CodeMethodInvokeExpression expression18 = new CodeMethodInvokeExpression {
                         Method = { TargetObject = new CodeTypeReferenceExpression(typeof(StaticPartialCachingControl)), MethodName = "BuildCachedControl" }
                     };
                     expression18.Parameters.Add(expression3);
                     expression18.Parameters.Add(new CodePrimitiveExpression(builder3.ID));
                     if (attribute2.Shared)
                     {
                         expression18.Parameters.Add(new CodePrimitiveExpression(builder3.ControlType.GetHashCode().ToString(CultureInfo.InvariantCulture)));
                     }
                     else
                     {
                         expression18.Parameters.Add(new CodePrimitiveExpression(Guid.NewGuid().ToString()));
                     }
                     expression18.Parameters.Add(new CodePrimitiveExpression(attribute2.Duration));
                     expression18.Parameters.Add(new CodePrimitiveExpression(attribute2.VaryByParams));
                     expression18.Parameters.Add(new CodePrimitiveExpression(attribute2.VaryByControls));
                     expression18.Parameters.Add(new CodePrimitiveExpression(attribute2.VaryByCustom));
                     expression18.Parameters.Add(new CodePrimitiveExpression(attribute2.SqlDependency));
                     CodeDelegateCreateExpression expression19 = new CodeDelegateCreateExpression {
                         DelegateType = new CodeTypeReference(typeof(BuildMethod)),
                         TargetObject = new CodeThisReferenceExpression(),
                         MethodName = buildMethodPrefix + builder3.ID
                     };
                     expression18.Parameters.Add(expression19);
                     if (flag2)
                     {
                         expression18.Parameters.Add(new CodePrimitiveExpression(providerName));
                     }
                     falseStatements.Add(new CodeExpressionStatement(expression18));
                 }
             }
             else if (((obj3 is string) && !builder.HasAspCode) && (!fControlSkin || !builder.AllowWhitespaceLiterals()))
             {
                 CodeExpression expression20;
                 string s = (string) obj3;
                 if (!this.UseResourceLiteralString(s))
                 {
                     expression = new CodeObjectCreateExpression(typeof(LiteralControl), new CodeExpression[0]);
                     expression.Parameters.Add(new CodePrimitiveExpression(s));
                     expression20 = expression;
                 }
                 else
                 {
                     int num3;
                     int num4;
                     bool flag3;
                     base._stringResourceBuilder.AddString(s, out num3, out num4, out flag3);
                     expression2 = new CodeMethodInvokeExpression {
                         Method = { TargetObject = new CodeThisReferenceExpression(), MethodName = "CreateResourceBasedLiteralControl" }
                     };
                     expression2.Parameters.Add(new CodePrimitiveExpression(num3));
                     expression2.Parameters.Add(new CodePrimitiveExpression(num4));
                     expression2.Parameters.Add(new CodePrimitiveExpression(flag3));
                     expression20 = expression2;
                 }
                 BuildAddParsedSubObjectStatement(falseStatements, expression20, linePragma, expression3, ref gotParserVariable);
             }
         }
     }
     if (builder.ComplexPropertyEntries.Count > 0)
     {
         CodeStatementCollection statements10 = statements;
         PropertyEntry entry7 = null;
         int num5 = 1;
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:67,代码来源:BaseTemplateCodeDomTreeGenerator.cs


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