Ejemplo n.º 1
0
 /// <summary>
 /// Create a dynamic_template for mapping.
 /// </summary>
 /// <param name="name">Sets the name of the dynamic_template.</param>
 /// <param name="mapping">Sets the mapping for this dynamic_template.</param>
 /// <param name="pattern">Sets the pattern.</param>
 /// <param name="isMatchingPattern">Sets if the pattern is for matching or "un" matching.</param>
 /// <param name="isPathPattern">Sets if the pattern is a path pattern.</param>
 public DynamicTemplate(string name, IDocumentProperty mapping, string pattern = "*", bool isMatchingPattern = true, bool isPathPattern = false)
     : this(name, pattern, isMatchingPattern, isPathPattern)
 {           
     if (mapping == null)
         throw new ArgumentNullException("mapping", "DynamicTemplate requires a mapping value.");
     Mapping = mapping; 
 }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="property"></param>
        /// <returns></returns>
        public IDocumentProperty set(IDocumentProperty property)
        {
            IDocumentProperty oldProperty = property;
            if (this.properties.Keys.Contains<string>(property.name))
            {
                oldProperty = this.properties[property.name];
                this.properties.Remove(property.name);
            }

            this.properties.Add(property.name, property);

            return oldProperty;
        }
        public bool refreshDDSP(IDocumentProperty property)
        {
            bool result = false;
            if (property.name.Equals(WordDocumentProperties.DataSourceLibPathPropertyName))
            {
                if (!string.IsNullOrWhiteSpace(property.value.ToString()))
                {
                    this.provider = DDSP.DynamicDataSourceProvider.newInstance(property.value.ToString(), AddInManager.instance.getDocumentDetails());
                    result = true;
                }
            }

            return result;
        }