public virtual SourceProperty <T> SetValue([NotNull] SourceProperty <T> sourceProperty)
        {
            SetValue(sourceProperty.GetValue());

            if (sourceProperty.SourceTextNode != TextNode.Empty)
            {
                AddAdditionalSourceTextNode(sourceProperty.SourceTextNode);
            }

            foreach (var sourceTextNode in sourceProperty.AdditionalSourceTextNodes)
            {
                AddAdditionalSourceTextNode(sourceTextNode);
            }

            return(this);
        }
Beispiel #2
0
        protected SourceProperty <T> NewSourceProperty <T>([NotNull] string name, [NotNull] T defaultValue, SourcePropertyFlags flags = SourcePropertyFlags.None)
        {
            if (Locking == Locking.ReadOnly)
            {
                throw new InvalidOperationException("ProjectItem cannot be modified as it is frozen");
            }

            if (PropertyDictionary.ContainsKey(name))
            {
                throw new ArgumentException("A property with the same name already exists");
            }

            var sourceProperty = new SourceProperty <T>(this, name, defaultValue, flags);

            PropertyDictionary[name] = sourceProperty;
            return(sourceProperty);
        }