public SourceProperty([NotNull] ILockable owner, [NotNull] string key, [NotNull] T defaultValue, SourcePropertyFlags flags)
        {
            Owner = owner;
            Key   = key;
            Flags = flags;

            _value        = defaultValue;
            _defaultValue = defaultValue;
            _additionalSourceTextNodes = new List <ITextNode>();
        }
Beispiel #2
0
 /// <summary>Creates a new property in the property bag.</summary>
 SourceProperty <T> ISourcePropertyBag.NewSourceProperty <T>(string name, T defaultValue, SourcePropertyFlags flags)
 {
     return(NewSourceProperty(name, defaultValue, flags));
 }
Beispiel #3
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);
        }