Exemplo n.º 1
0
        public CustomTag CreateTagInstance(string tag, string markup, RootElementMaster rootMaster)
        {
            if (string.IsNullOrEmpty(tag))
            {
                throw new ArgumentNullException("Must specify tag");
            }

            if (!CustomTags.ContainsKey(tag))
            {
                return(null);
            }
            CustomTagTemplate template = CustomTags[tag];

            if (template != null)
            {
                if (template.MyRootMaster != rootMaster)
                {
                    template.MyRootMaster = rootMaster;
                    template.Parse();
                }
                else
                {
                    if (!template.IsParsed || template.Controls.Count == 0)
                    {
                        template.Parse();
                    }
                }
            }
            return(new CustomTag(tag, CustomTags[tag], markup));
        }
Exemplo n.º 2
0
 /// <summary>
 /// Registers a new custom tag to be available for use within a gadget.
 /// </summary>
 /// <param name="tagTemplate"></param>
 /// <returns></returns>
 public CustomTagTemplate RegisterCustomTag(CustomTagTemplate tagTemplate)
 {
     if (null == tagTemplate)
     {
         throw new ArgumentNullException();
     }
     if (string.IsNullOrEmpty(tagTemplate.Tag))
     {
         throw new ArgumentException("Custom template does not define a tag");
     }
     CustomTags.Add(tagTemplate.Tag, tagTemplate);
     if (!tagTemplate.IsParsed)
     {
         tagTemplate.Parse();
     }
     return(tagTemplate);
 }
Exemplo n.º 3
0
 public CustomTag(string tag, CustomTagTemplate template, string markup)
     : this(tag, template)
 {
     LoadTag(markup);
 }
Exemplo n.º 4
0
        /// <summary>
        /// Registers a new custom tag to be available for use within a gadget.
        /// </summary>
        /// <param name="tag"></param>
        /// <param name="tagTemplate"></param>
        /// <returns></returns>
        public CustomTagTemplate RegisterCustomTag(string tag, string tagTemplate)
        {
            CustomTagTemplate newTagDef = new CustomTagTemplate(tag, tagTemplate, MyRootMaster);

            return(RegisterCustomTag(newTagDef));
        }
Exemplo n.º 5
0
 public CustomTag(string tag, CustomTagTemplate template)
 {
     MyRootMaster     = template.MyRootMaster;
     this.MarkupTag   = tag;
     this.TagTemplate = template;
 }