示例#1
0
        /// <summary>
        /// Adds the specified property to the <see cref="NItemCollection"/>.
        /// </summary>
        /// <param name="property">The property to add.</param>
        public void AddProperty(INProperty property)
        {
            if (HasProperty(property))
            {
                return;
            }

            property.SetParent(Owner);
            Add(property);

            OnPropertyAdded(new PropertyAddedEventArgs(this, property));
        }
示例#2
0
 public PropertyValueChangedEventArgs
 (
     [NotNull] INItemCollection collection,
     [NotNull] INProperty property,
     [CanBeNull] object oldValue,
     [CanBeNull] object newValue) : base(
         collection
         )
 {
     Property = property;
     OldValue = oldValue;
     NewValue = newValue;
 }
示例#3
0
        /// <summary>
        /// Finds and returns a property with the specified name.
        /// </summary>
        /// <param name="propertyName">The name of the property to find.</param>
        /// <param name="result">The resulting property.</param>
        /// <returns><c>true</c> if the property was found; otherwise, <c>false</c>.</returns>
        public bool TryGetProperty(string propertyName, [CanBeNull] out INProperty result)
        {
            if (!TryGetItem(propertyName, out var item))
            {
                result = null;
                return(false);
            }

            if (!(item is INProperty property))
            {
                result = null;
                return(false);
            }

            result = property;
            return(true);
        }
示例#4
0
 /// <summary>
 /// Returns a value indicating whether the specified property exists.
 /// </summary>
 /// <param name="property">The property to find.</param>
 /// <returns><c>true</c> if the property was found; otherwise, <c>false</c>.</returns>
 public bool HasProperty(INProperty property)
 {
     return(HasProperty(property.Name));
 }
示例#5
0
 public PropertyAddedEventArgs([NotNull] INItemCollection collection, [NotNull] INProperty property) : base(collection)
 {
     Property = property;
 }