Example #1
0
        public void add(object target, string strPropertyName, object destinationValue)
        {
            PropertyInfo property = target.GetType().GetProperty(strPropertyName);

            if (property == null)
            {
                throw new Exception("Đối tượng: " + target.ToString() + " không có thuộc tính: " + strPropertyName);
            }
            System.Type propertyType = property.PropertyType;
            if (!Transition.m_mapManagedTypes.ContainsKey(propertyType))
            {
                throw new Exception("Transition không thể handle các thuộc tính thuộc kiểu: " + propertyType.ToString());
            }
            if (!property.CanRead || !property.CanWrite)
            {
                throw new Exception("Modifier của thuộc tính phải cho phép đọc hoặc ghi: " + strPropertyName);
            }
            IManagedType mapManagedType = Transition.m_mapManagedTypes[propertyType];

            Transition.TransitionedPropertyInfo transitionedPropertyInfo = new Transition.TransitionedPropertyInfo();
            transitionedPropertyInfo.endValue     = destinationValue;
            transitionedPropertyInfo.target       = target;
            transitionedPropertyInfo.propertyInfo = property;
            transitionedPropertyInfo.managedType  = mapManagedType;
            lock (this.m_Lock)
                this.m_listTransitionedProperties.Add(transitionedPropertyInfo);
        }
Example #2
0
 internal void removeProperty(Transition.TransitionedPropertyInfo info)
 {
     lock (this.m_Lock)
         this.m_listTransitionedProperties.Remove(info);
 }