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


C# ITemplate类代码示例

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


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

示例1: TryProcess

		public bool TryProcess(IDocumentProcessor docProcessor, XmlNode node, bool isRoot, ITemplate template, IRenderFunction currentRenderFunction) {
			if (node.NodeType != XmlNodeType.Element)
				return false;

			GenericElementProcessorContext context = new GenericElementProcessorContext();

			currentRenderFunction.AddFragment(new LiteralFragment("<" + node.Name));
			AddAttributeFragments(docProcessor, node, isRoot, template, currentRenderFunction, context);

			if (context.Id != null) {
				string tagName = node.Name;
				if (tagName.ToLowerCase() == "input" && context.Type != null)
					tagName += "/" + context.Type;
				template.AddMember(new NamedElementMember(tagName, context.Id));
			}

			if (noContentTags.Contains(node.Name)) {
				if (Utils.GetNumChildNodes(node) > 0)
					throw ParserUtils.TemplateErrorException("The tag " + node.Name + " can not have children.");
				currentRenderFunction.AddFragment(new LiteralFragment("/>"));
			}
			else {
				currentRenderFunction.AddFragment(new LiteralFragment(">"));
				Utils.DoForEachChild(node, delegate(XmlNode child) {
					docProcessor.ProcessRecursive(child, template, currentRenderFunction);
				});
				currentRenderFunction.AddFragment(new LiteralFragment("</" + node.Name + ">"));
			}

			return true;
		}
开发者ID:fiinix00,项目名称:Saltarelle,代码行数:31,代码来源:GenericElementProcessor.Shared.cs

示例2: StatsModule

        public StatsModule(ITemplate tmpl, IIdGenerator idgen, SavegameStorage storage)
        {
            Post["/games"] = _ =>
            {
                // Get the temporary location of the file on the server
                var file = Request.Headers["X-FILE"].FirstOrDefault();

                // Get the extension of the file when it was uploaded as the
                // temporary file doesn't have an extension
                var extension = Request.Headers["X-FILE-EXTENSION"].FirstOrDefault();
                if (file == null)
                    throw new ArgumentException("File can't be null");
                if (extension == null)
                    throw new ArgumentException("File extension can't be null");

                Save savegame;
                using (var stream = getStream(file, extension))
                using (parsingTimer.NewContext())
                    savegame = new Save(stream);

                // Turn the savegame into html and return the url for it
                var stats = statsTimer.Time(() => Aggregate(savegame));
                string contents = templateTimer.Time(() => tmpl.Render(stats));
                string id = idgen.NextId();
                return storage.Store(contents, id);
            };
        }
开发者ID:nickbabcock,项目名称:EU4.Savegame,代码行数:27,代码来源:StatsModule.cs

示例3: TryParse

		public IFragment TryParse(string markup, ITemplate template) {
			if (markup.StartsWith("code:"))
				return new CodeExpressionFragment(Utils.Substring(markup, 5, markup.Length - 5).Trim());
			else if (markup.StartsWith("{=") && markup.EndsWith("}"))
				return new CodeExpressionFragment(Utils.Substring(markup, 2, markup.Length - 3).Trim());
			return null;
		}
开发者ID:fiinix00,项目名称:Saltarelle,代码行数:7,代码来源:CodeUntypedMarkupParser.Shared.cs

示例4: Add

		/// <summary>
		/// Set template variable value with data from template (all occurrences will be replaced)
		/// </summary>
		/// <param name="variableName">Variable name in master template file</param>
		/// <param name="template">The template.</param>
		public void Add(string variableName, ITemplate template)
		{
			if (template == null)
				return;

			Add(variableName, template.Get());
		}
开发者ID:i4004,项目名称:Simplify.Web,代码行数:12,代码来源:DataCollector.cs

示例5: TemplateOveridingDefinitionTile

 public TemplateOveridingDefinitionTile(string name, ITemplate template, ITile extends,
                                    IEnumerable<TileAttribute> attributes)
     : base(name, template, attributes)
 {
     _extends = extends;
     Attributes.MergeTileLazy(_extends);
 }
开发者ID:rslijp,项目名称:sharptiles,代码行数:7,代码来源:TemplateOveridingDefinitionTile.cs

示例6: AddTemplateAsControl

        private void AddTemplateAsControl(ITemplate anyTemplate, object cuurentItem)
        {
            javascript.Visible = false;
            templateContentHolder  = new EbuyPopupContenido(cuurentItem);
            MensajePopUp.Text = Titulo;

            if (BotonCancelar)
                Cancelar.Visible = true;
            else
                Cancelar.Visible = false;
            if (BotonAceptar)
            {
                Aceptar.Visible = true;
                if (BotonAceptarDesapareceAlApretar)
                {
                    javascript.Visible = true;
                    Literal1.Text = this.ID;
                    Aceptar.OnClientClick += "javascript:BotonAceptarDesaparece"+this.ID+"();";
                }
            }
            else
                Aceptar.Visible = false;

            if (BotonOK)
                OK.Visible = true;
            else
                OK.Visible = false;
            Aceptar.Click += AceptarOnClick;
            anyTemplate.InstantiateIn(templateContentHolder);
            PanelContenedor.Controls.Add(templateContentHolder);
               // this.Controls.Add(PanelContenedor);
        }
开发者ID:marianoir,项目名称:ebuyplacenet,代码行数:32,代码来源:EbuyPopup.ascx.cs

示例7: DocumentParser

        public DocumentParser(ITemplate template)
        {
            Ensure.ArgumentNotNull(template, "template");

            _template = template;
            _markdown = new Markdown();
        }
开发者ID:ryanwentzel,项目名称:Proverb,代码行数:7,代码来源:DocumentParser.cs

示例8: Parse

		public TypedMarkupData Parse(string registeredPrefix, bool isArray, string value, ITemplate template) {
			if (isArray) {
				StringBuilder sb = new StringBuilder();
				sb.Append("new int[] {");
				int[] ints;
				if (value.Trim() != "") {
					string[] split = value.Split('|');
					ints = new int[split.Length];
					for (int i = 0; i < split.Length; i++) {
						if (Utils.RegexExec(split[i], Utils.IntRegex, "") == null)
							throw ParserUtils.TemplateErrorException(ParserUtils.MakeTypedMarkupErrorMessage(registeredPrefix, isArray, value));
						sb.Append(i > 0 ? ", " : " ");
						ints[i] = Utils.ParseInt(split[i]);
						sb.Append(Utils.ToStringInvariantInt(ints[i]));
					}
				}
				else
					ints = new int[0];
				sb.Append(" }");
				return new TypedMarkupData(sb.ToString(), delegate() { return ints; });
			}
			else {
				if (Utils.RegexExec(value, Utils.IntRegex, "") == null)
					throw ParserUtils.TemplateErrorException(ParserUtils.MakeTypedMarkupErrorMessage(registeredPrefix, isArray, value));
				int i = Utils.ParseInt(value);
				return new TypedMarkupData(Utils.ToStringInvariantInt(i), delegate() { return i; });
			}
		}
开发者ID:fiinix00,项目名称:Saltarelle,代码行数:28,代码来源:IntMarkupParser.Shared.cs

示例9: AddItemTemplate

 /// <summary>
 /// Adds an item with the specified template.
 /// </summary>
 /// <param name="template"></param>
 /// <param name="item"></param>
 /// <param name="itemNumber"></param>
 /// <param name="selected"></param>
 protected void AddItemTemplate(ITemplate template, PageData item, int itemNumber, bool selected)
 {
     if (AddSeparator)
         AddSeparatorTemplate();
     AddTemplate(new PageDataItemTemplateContainer(item, itemNumber, selected), template);
     Added = true;
 }
开发者ID:JohannesOstensjo,项目名称:EPiUtilities,代码行数:14,代码来源:TemplatedPageDataItemListControlBase.cs

示例10: Tpl

		/// <summary>
		/// Initializes a new instance of the <see cref="Tpl" /> class.
		/// </summary>
		/// <param name="template">The template.</param>
		/// <param name="title">The site title.</param>
		public Tpl(ITemplate template, string title)
		{
			if (template != null)
				Data = template.Get();

			Title = title;
		}
开发者ID:i4004,项目名称:Simplify.Web,代码行数:12,代码来源:Tpl.cs

示例11: RuntimeEntity

 public RuntimeEntity(int uniqueId, ITemplate template, IEventDispatcher eventDispatcher)
     : this(uniqueId, eventDispatcher, "") {
     foreach (DataAccessor accessor in template.SelectData()) {
         Data.IData data = template.Current(accessor);
         AddData_unlocked(accessor, data.Duplicate());
     }
 }
开发者ID:jyunfan2015,项目名称:forge,代码行数:7,代码来源:RuntimeEntity.cs

示例12: Parse

		public TypedMarkupData Parse(string registeredPrefix, bool isArray, string value, ITemplate template) {
			if (isArray) {
				StringBuilder sb = new StringBuilder();
				sb.Append("new Position[] {");
				Position[] positions;
				if (value.Trim() != "") {
					string[] split = value.Split('|');
					positions = new Position[split.Length];
					for (int i = 0; i < split.Length; i++) {
						StringPositionPair v = ParseSingle(split[i]);
						if (v == null)
							throw ParserUtils.TemplateErrorException(ParserUtils.MakeTypedMarkupErrorMessage(registeredPrefix, isArray, value));
						sb.Append(i > 0 ? ", " : " ");
						positions[i] = v.p;
						sb.Append(v.s);
					}
				}
				else
					positions = new Position[0];

				sb.Append(" }");
				return new TypedMarkupData(sb.ToString(), delegate() { return positions; });
			}
			else {
				StringPositionPair v = ParseSingle(value);
				if (v == null)
					throw ParserUtils.TemplateErrorException(ParserUtils.MakeTypedMarkupErrorMessage(registeredPrefix, isArray, value));
				return new TypedMarkupData(v.s, delegate { return v.p; });
			}
		}
开发者ID:fiinix00,项目名称:Saltarelle,代码行数:30,代码来源:PositionMarkupParser.Shared.cs

示例13: Render

		public void Render(ITemplate tpl, IInstantiatedTemplateControl ctl, StringBuilder sb) {
			if (IsCData)
				sb.Append("<![CDATA[");
			sb.Append(Text);
			if (IsCData)
				sb.Append("]]>");
		}
开发者ID:fiinix00,项目名称:Saltarelle,代码行数:7,代码来源:LiteralFragment.Shared.cs

示例14: ProbabilityCalculation

 public static double ProbabilityCalculation(ITemplate template, IDictionary<JointType, InputVector> input)
 {
     var end = template.EndCondition(input);
     var start = template.StartCondition(input);
     var motion = template.MotionCharacteristic(input);
     return end*start*motion;
 }
开发者ID:i2e-haw-hamburg,项目名称:gesture-recognition,代码行数:7,代码来源:ThreeDGestureRecognizer.cs

示例15: AddTemplate

 protected void AddTemplate(ITemplate template) {
     if (template != null) {
         TemplateItem i = new TemplateItem();
         template.InstantiateIn(i);
         Controls.Add(i);
     }
 }
开发者ID:cmarfia,项目名称:KalikoCMS.Core,代码行数:7,代码来源:BaseList.cs


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