• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# UI.ControlBuilder类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



ControlBuilder类属于System.Web.UI命名空间,在下文中一共展示了ControlBuilder类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: SkinBuilder

 public SkinBuilder(ThemeProvider provider, Control control, ControlBuilder skinBuilder, string themePath)
 {
     this._provider = provider;
     this._control = control;
     this._skinBuilder = skinBuilder;
     this._themePath = themePath;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:SkinBuilder.cs


示例2: BuildEvalExpression

        internal static void BuildEvalExpression(string field, string formatString, string propertyName,
            Type propertyType, ControlBuilder controlBuilder, CodeStatementCollection methodStatements, CodeStatementCollection statements, CodeLinePragma linePragma, bool isEncoded, ref bool hasTempObject) {

            // Altogether, this function will create a statement that looks like this:
            // if (this.Page.GetDataItem() != null) {
            //     target.{{propName}} = ({{propType}}) this.Eval(fieldName, formatString);
            // }

            //     this.Eval(fieldName, formatString)
            CodeMethodInvokeExpression evalExpr = new CodeMethodInvokeExpression();
            evalExpr.Method.TargetObject = new CodeThisReferenceExpression();
            evalExpr.Method.MethodName = EvalMethodName;
            evalExpr.Parameters.Add(new CodePrimitiveExpression(field));
            if (!String.IsNullOrEmpty(formatString)) {
                evalExpr.Parameters.Add(new CodePrimitiveExpression(formatString));
            }

            CodeStatementCollection evalStatements = new CodeStatementCollection();
            BuildPropertySetExpression(evalExpr, propertyName, propertyType, controlBuilder, methodStatements, evalStatements, linePragma, isEncoded, ref hasTempObject);

            // if (this.Page.GetDataItem() != null)
            CodeMethodInvokeExpression getDataItemExpr = new CodeMethodInvokeExpression();
            getDataItemExpr.Method.TargetObject = new CodePropertyReferenceExpression(new CodeThisReferenceExpression(), "Page");
            getDataItemExpr.Method.MethodName = GetDataItemMethodName;

            CodeConditionStatement ifStmt = new CodeConditionStatement();
            ifStmt.Condition = new CodeBinaryOperatorExpression(getDataItemExpr, 
                                                                CodeBinaryOperatorType.IdentityInequality, 
                                                                new CodePrimitiveExpression(null));
            ifStmt.TrueStatements.AddRange(evalStatements);
            statements.Add(ifStmt);
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:32,代码来源:DataBindingExpressionBuilder.cs


示例3: Init

 public override void Init(TemplateParser parser, ControlBuilder parentBuilder, Type type, string tagName, string ID, IDictionary attribs)
 {
     this._contentPlaceHolderID = ID;
     if (parser.FInDesigner)
     {
         base.Init(parser, parentBuilder, type, tagName, ID, attribs);
     }
     else
     {
         if (string.IsNullOrEmpty(ID))
         {
             throw new HttpException(System.Web.SR.GetString("Control_Missing_Attribute", new object[] { "ID", type.Name }));
         }
         this._templateName = ID;
         MasterPageParser parser2 = parser as MasterPageParser;
         if (parser2 == null)
         {
             throw new HttpException(System.Web.SR.GetString("ContentPlaceHolder_only_in_master"));
         }
         base.Init(parser, parentBuilder, type, tagName, ID, attribs);
         if (parser2.PlaceHolderList.Contains(this.Name))
         {
             throw new HttpException(System.Web.SR.GetString("ContentPlaceHolder_duplicate_contentPlaceHolderID", new object[] { this.Name }));
         }
         parser2.PlaceHolderList.Add(this.Name);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:27,代码来源:ContentPlaceHolderBuilder.cs


示例4: AppendSubBuilder

		public override void AppendSubBuilder (ControlBuilder subBuilder)
		{
			// LAMESPEC: docs suggest that only View controls are accepted, but tests
			// show that anything goes here (including subBuilder.ControlType == null),
			// so we're just passing the call up the chain
			base.AppendSubBuilder (subBuilder);
		}
开发者ID:nobled,项目名称:mono,代码行数:7,代码来源:MultiViewControlBuilder.cs


示例5: Init

        public override void Init(TemplateParser parser, ControlBuilder parentBuilder, Type type, string tagName, string id,
		                          IDictionary attribs)
        {
            base.Init(parser, parentBuilder, type, tagName, id, attribs);

            _typeName = (string)attribs["typename"];
        }
开发者ID:mhinze,项目名称:msmvc,代码行数:7,代码来源:ViewTypeControlBuilder.cs


示例6: OnProcessGeneratedCode

        public override void OnProcessGeneratedCode(ControlBuilder controlBuilder, CodeCompileUnit codeCompileUnit, CodeTypeDeclaration baseType, CodeTypeDeclaration derivedType, CodeMemberMethod buildMethod, CodeMemberMethod dataBindingMethod, System.Collections.IDictionary additionalState)
        {
            // only run this once during page compilation, and only use this one builder (so that we don't get master pages, etc.)
            if (controlBuilder.GetType() == typeof(FileLevelPageControlBuilder))
            {
                // the page will only contain one namespace and one type
                var ns = codeCompileUnit.Namespaces.Cast<CodeNamespace>().FirstOrDefault();
                if (ns != null)
                {
                    var type = ns.Types.Cast<CodeTypeDeclaration>().FirstOrDefault();
                    if (type != null)
                    {
                        /* When this is output, it will inject this into every page:
                         *
                         * protected override PageStatePersister PageStatePersister {
                         *   get { return new CompressedHiddenFieldPageStatePersister(this); }
                         * }
                         *
                         */
                        CodeMemberProperty property = new CodeMemberProperty()
                        {
                            Name = "PageStatePersister",
                            HasGet = true,
                            Attributes = MemberAttributes.Override | MemberAttributes.Family,
                            Type = new CodeTypeReference(typeof(PageStatePersister))
                        };
                        var newObj = new CodeObjectCreateExpression(typeof(CompressedHiddenFieldPageStatePersister), new CodeThisReferenceExpression());
                        property.GetStatements.Add(new CodeMethodReturnStatement(newObj));
                        type.Members.Add(property);
                    }
                }
            }

            base.OnProcessGeneratedCode(controlBuilder, codeCompileUnit, baseType, derivedType, buildMethod, dataBindingMethod, additionalState);
        }
开发者ID:GrabYourPitchforks,项目名称:viewstate-compression,代码行数:35,代码来源:ViewStateCompressorControlBuilderInterceptor.cs


示例7: AppendSubBuilder

        /// <include file='doc\LiteralTextContainerControlBuilder.uex' path='docs/doc[@for="LiteralTextContainerControlBuilder.AppendSubBuilder"]/*' />
        public override void AppendSubBuilder(ControlBuilder subBuilder)
        {
            if (InDesigner)
            {
                base.AppendSubBuilder(subBuilder);
            }

            // The first one is used if ASP.NET is compiled with FAST_DATABINDING off. The second
            // is used if it is compiled with FAST_DATABINDING on. Note: We can't do a type 
            // comparison because CodeBlockBuilder is internal.
            //else if (typeof(DataBoundLiteralControl).IsAssignableFrom(subBuilder.ControlType))
            else if (subBuilder.GetType().FullName == "System.Web.UI.CodeBlockBuilder")
            {
                TextParser.AddDataBinding(subBuilder);
            }
            else
            {
                base.AppendSubBuilder(subBuilder);
                if (subBuilder.ControlType != typeof(LiteralText))
                {
                    if (_textParser != null)
                    {
                        _textParser.ResetBreaking();
                    }
                    else
                    {
                        _controlsInserted = true;
                    }
                }
            }
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:32,代码来源:LiteralTextContainerControlBuilder.cs


示例8: Init

        public override void Init(TemplateParser parser, ControlBuilder parentBuilder,
                                  Type type, string tagName, string ID, IDictionary attribs) {

            // Copy the ID so that it will be available when BuildObject is called
            _contentPlaceHolderID = ID;

            if (parser.FInDesigner) {
                // shortcut for designer
                base.Init(parser, parentBuilder, type, tagName, ID, attribs);
                return;
            }

            if (String.IsNullOrEmpty(ID)) {
                throw new HttpException(SR.GetString(SR.Control_Missing_Attribute, "ID", type.Name));
            }

            _templateName = ID;

            MasterPageParser masterPageParser = parser as MasterPageParser;
            if (masterPageParser == null) {
                throw new HttpException(SR.GetString(SR.ContentPlaceHolder_only_in_master));
            }

			base.Init(parser, parentBuilder, type, tagName, ID, attribs);

            if (masterPageParser.PlaceHolderList.Contains(Name))
                throw new HttpException(SR.GetString(SR.ContentPlaceHolder_duplicate_contentPlaceHolderID, Name));

            masterPageParser.PlaceHolderList.Add(Name);
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:30,代码来源:ContentPlaceHolder.cs


示例9: Init

        public override void Init(TemplateParser parser, ControlBuilder parentBuilder,
                                  Type type, string tagName, string ID, IDictionary attribs) {

            base.Init(parser, parentBuilder, type /*type*/, tagName, ID, attribs);

            SetControlType(typeof(string));
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:7,代码来源:StringPropertyBuilder.cs


示例10: Init

        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        public override void Init(TemplateParser parser, ControlBuilder parentBuilder,
                                  Type type, string tagName, string ID, IDictionary attribs) {

            base.Init(parser, parentBuilder, type /*type*/, tagName, ID, attribs);

            // 



            PropertyInfo propInfo = TargetFrameworkUtil.GetProperty(parentBuilder.ControlType, 
                tagName, BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.IgnoreCase);
            SetControlType(propInfo.PropertyType);
            Debug.Assert(ControlType != null, "ControlType != null");

            BindingFlags bindingFlags = BindingFlags.Public | BindingFlags.Instance;

            // Look for an "item" property on the collection that takes in an integer index
            // (similar to IList::Item)
            propInfo = TargetFrameworkUtil.GetProperty(ControlType, "Item", bindingFlags, types: new Type[] { typeof(int) });
            if (propInfo == null) {
                // fall-back on finding a non-specific Item property
                // a type with overloaded indexed properties will result in an exception however
                propInfo = TargetFrameworkUtil.GetProperty(ControlType, "Item", bindingFlags);
            }

            // If we got one, use it to determine the type of the items
            if (propInfo != null)
                _itemType = propInfo.PropertyType;
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:32,代码来源:CollectionBuilder.cs


示例11: ProcessObjects

		void ProcessObjects (ControlBuilder builder)
		{
			if (builder.Children == null)
				return;

			foreach (object t in builder.Children) {
				if (!(t is ObjectTagBuilder))
					continue;

				ObjectTagBuilder tag = (ObjectTagBuilder) t;
				if (tag.Scope == null) {
					string fname = CreateFieldForObject (tag.Type, tag.ObjectID);
					CreatePropertyForObject (tag.Type, tag.ObjectID, fname, true);
					continue;
				}
				
				if (tag.Scope == "session") {
					sessionObjectTags.Add (tag);
					CreateApplicationOrSessionPropertyForObject (tag.Type, tag.ObjectID,
										     false, false);
				} else if (tag.Scope == "application") {
					applicationObjectTags.Add (tag);
					CreateFieldForObject (tag.Type, tag.ObjectID);
					CreateApplicationOrSessionPropertyForObject (tag.Type, tag.ObjectID,
										     true, false);
				} else {
					throw new ParseException (tag.location, "Invalid scope: " + tag.Scope);
				}
			}
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:30,代码来源:GlobalAsaxCompiler.cs


示例12: Init

		public override void Init (TemplateParser parser,
					   ControlBuilder parentBuilder,
					   Type type,
					   string tagName,
					   string id,
					   IDictionary attribs) 
		{
			if (attribs == null)
				throw new ParseException (parser.Location, "Error in ObjectTag.");

			attribs.Remove ("runat");
			this.id = attribs ["id"] as string;
			attribs.Remove ("id");
			if (this.id == null || this.id.Trim () == "")
				throw new ParseException (parser.Location, "Object tag must have a valid ID.");

			scope = attribs ["scope"] as string;
			string className = attribs ["class"] as string;
			attribs.Remove ("scope");
			attribs.Remove ("class");
			if (className == null || className.Trim () == "")
				throw new ParseException (parser.Location, "Object tag must have 'class' attribute.");

			this.type = parser.LoadType (className);
			if (this.type == null)
				throw new ParseException (parser.Location, "Type " + className + " not found.");

			if (attribs ["progid"] != null || attribs ["classid"] != null)
				throw new ParseException (parser.Location, "ClassID and ProgID are not supported.");

			if (attribs.Count > 0)
				throw new ParseException (parser.Location, "Unknown attribute");
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:33,代码来源:ObjectTagBuilder.cs


示例13: BuildExpressionSetup

        internal static void BuildExpressionSetup(ControlBuilder controlBuilder, CodeStatementCollection methodStatements, CodeStatementCollection statements, CodeLinePragma linePragma, bool isTwoWayBound, bool designerMode) {
            // {{controlType}} target;
            CodeVariableDeclarationStatement targetDecl = new CodeVariableDeclarationStatement(controlBuilder.ControlType, "dataBindingExpressionBuilderTarget");
            methodStatements.Add(targetDecl);

            CodeVariableReferenceExpression targetExp = new CodeVariableReferenceExpression(targetDecl.Name);

            // target = ({{controlType}}) sender;
            CodeAssignStatement setTarget = new CodeAssignStatement(targetExp,
                                                                    new CodeCastExpression(controlBuilder.ControlType,
                                                                                           new CodeArgumentReferenceExpression("sender")));
            setTarget.LinePragma = linePragma;
            statements.Add(setTarget);

            Type bindingContainerType = controlBuilder.BindingContainerType;
            CodeVariableDeclarationStatement containerDecl = new CodeVariableDeclarationStatement(bindingContainerType, "Container");
            methodStatements.Add(containerDecl);

            // {{containerType}} Container = ({{containerType}}) target.BindingContainer;
            CodeAssignStatement setContainer = new CodeAssignStatement(new CodeVariableReferenceExpression(containerDecl.Name),
                                                                       new CodeCastExpression(bindingContainerType,
                                                                                              new CodePropertyReferenceExpression(targetExp,
                                                                                                                                  "BindingContainer")));
            setContainer.LinePragma = linePragma;
            statements.Add(setContainer);
            string variableName = isTwoWayBound ? "BindItem" : "Item";
            GenerateItemTypeExpressions(controlBuilder, methodStatements, statements, linePragma, variableName);
            //Generate code for other variable as well at design time in addition to runtime variable for intellisense to work.
            if (designerMode) {
                GenerateItemTypeExpressions(controlBuilder, methodStatements, statements, linePragma, isTwoWayBound ?  "Item" : "BindItem");
            }
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:32,代码来源:DataBindingExpressionBuilder.cs


示例14: SetParentBuilder

 internal override void SetParentBuilder(ControlBuilder parentBuilder)
 {
     if (!base.InDesigner && !(parentBuilder is FileLevelPageControlBuilder))
     {
         throw new HttpException(System.Web.SR.GetString("Content_allowed_in_top_level_only"));
     }
     base.SetParentBuilder(parentBuilder);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:ContentBuilderInternal.cs


示例15: OnProcessGeneratedCode

 /// <summary>
 /// This method is called after the code generation for this <see cref="System.Web.UI.ControlBuilder"/> is complete.
 /// </summary>
 /// <param name="controlBuilder">The control builder instance.</param>
 /// <param name="codeCompileUnit">This is the entire <see cref="System.CodeDom.CodeCompileUnit"/> that is being generated by the compilation.</param>
 /// <param name="baseType">The type declaration of code behind class. When code behind is not used, this is the same as <paramref name="derivedType"/>.</param>
 /// <param name="derivedType">The type declaration of top level markup element.</param>
 /// <param name="buildMethod">The method with necessary code to create the control and set it's various properties, events, fields.</param>
 /// <param name="dataBindingMethod">The method with code to evaluate data binding expressions within the control.</param>
 /// <param name="additionalState">This is an additional state which can be used to store/retrive data within several methods of <see cref="System.Web.Compilation.ControlBuilderInterceptor"/>.
 /// The state is per control builder.</param>
 public virtual void OnProcessGeneratedCode(ControlBuilder controlBuilder, 
                                            CodeCompileUnit codeCompileUnit, 
                                            CodeTypeDeclaration baseType, 
                                            CodeTypeDeclaration derivedType, 
                                            CodeMemberMethod buildMethod, 
                                            CodeMemberMethod dataBindingMethod,
                                            IDictionary additionalState) {
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:19,代码来源:ControlBuilderInterceptor.cs


示例16: Init

 public override void Init(TemplateParser parser, ControlBuilder parentBuilder, Type type, string tagName, string ID, IDictionary attribs)
 {
     base.Init(parser, parentBuilder, type, tagName, ID, attribs);
     if ((base.InPageTheme && (base.ParentBuilder != null)) && base.ParentBuilder.IsControlSkin)
     {
         ((PageThemeParser) base.Parser).CurrentSkinBuilder = parentBuilder;
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:TemplateBuilder.cs


示例17: AppendSubBuilder

 public override void AppendSubBuilder(ControlBuilder subBuilder)
 {
     if (subBuilder is CodeBlockBuilder)
     {
         throw new Exception(System.Web.SR.GetString("Multiview_rendering_block_not_allowed"));
     }
     base.AppendSubBuilder(subBuilder);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:MultiViewControlBuilder.cs


示例18: AllowControl

 public override bool AllowControl(Type controlType, ControlBuilder builder)
 {
     return (controlType == typeof(HtmlHead)
       || controlType == typeof(HtmlTitle)
       || controlType == typeof(ContentPlaceHolder)
       || controlType == typeof(Content)
       || controlType == typeof(HtmlLink));
 }
开发者ID:necronomicon,项目名称:mvc,代码行数:8,代码来源:ViewParserFilter.cs


示例19: ParseComplete

        public override void ParseComplete(ControlBuilder rootBuilder) {
            base.ParseComplete(rootBuilder);

            IMvcControlBuilder builder = rootBuilder as IMvcControlBuilder;
            if (builder != null) {
                builder.Inherits = _inherits;
            }
        }
开发者ID:nobled,项目名称:mono,代码行数:8,代码来源:ViewTypeParserFilter.cs


示例20: Init

		public override void Init (TemplateParser parser,
					  ControlBuilder parentBuilder,
					  Type type,
					  string tagName,
					  string ID,
					  IDictionary attribs)
		{
			throw new NotImplementedException ();
		}
开发者ID:carrie901,项目名称:mono,代码行数:9,代码来源:TemplateBuilder.jvm.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# UI.ControlCollection类代码示例发布时间:2022-05-26
下一篇:
C# UI.Control类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap