Пример #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));
        }
Пример #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);
 }