コード例 #1
0
ファイル: Container.cs プロジェクト: gitter-badger/Test2d
 /// <summary>
 /// Gets or sets property Value using Name as key for Properties array values. If property with the specified key does not exist it is created.
 /// </summary>
 /// <param name="name">The property name value.</param>
 /// <returns>The property Value.</returns>
 public object this[string name]
 {
     get
     {
         var result = _properties.FirstOrDefault(p => p.Name == name);
         if (result != null)
         {
             return(result.Value);
         }
         return(null);
     }
     set
     {
         if (value != null)
         {
             var result = _properties.FirstOrDefault(p => p.Name == name);
             if (result != null)
             {
                 result.Value = value;
             }
             else
             {
                 var property = ShapeProperty.Create(name, value);
                 Properties = Properties.Add(property);
             }
         }
     }
 }
コード例 #2
0
ファイル: Observer.cs プロジェクト: monocraft/Test2d
        /// <summary>
        /// 
        /// </summary>
        /// <param name="property"></param>
        public void Add(ShapeProperty property)
        {
            if (property == null)
                return;

            property.PropertyChanged += PropertyObserver;
            Verbose("Add Property: " + property.Name + ", type: " + property.Value.GetType());
        }