コード例 #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);
        }
コード例 #2
0
        /// <summary>
        /// Adds a property that should be animated as part of this transition.
        /// </summary>
        public void add(object target, string strPropertyName, object destinationValue)
        {
            Type         targetType   = target.GetType();
            PropertyInfo propertyInfo = null;
            IManagedType managedType  = null;

            // We get the property info...
            propertyInfo = targetType.GetPropertyEx(strPropertyName);
            if (propertyInfo == null)
            {
                throw new Exception("Object: " + target.ToString() + " does not have the property: " + strPropertyName);
            }

            // We check that we support the property type...
            Type propertyType = propertyInfo.PropertyType;

            if (m_mapManagedTypes.ContainsKey(propertyType) == false)
            {
                throw new Exception("Transition does not handle properties of type: " + propertyType.ToString());
            }

            // We can only transition properties that are both getable and setable...
            if (propertyInfo.CanRead == false || propertyInfo.CanWrite == false)
            {
                throw new Exception("Property is not both getable and setable: " + strPropertyName);
            }
            managedType = m_mapManagedTypes[propertyType];

            // We can manage this type, so we store the information for the
            // transition of this property...
            TransitionedPropertyInfo info = new TransitionedPropertyInfo();

            info.endValue     = destinationValue;
            info.target       = target;
            info.propertyInfo = propertyInfo;
            info.managedType  = managedType;
            info.propertyPath = strPropertyName;
            info.IsComplex    = strPropertyName.Contains(".");

            lock (m_Lock)
            {
                m_listTransitionedProperties.Add(info);
            }
        }
コード例 #3
0
        /// <summary>
        /// Adds a property that should be animated as part of this transition.
        /// </summary>
        public void Add(object target, string strPropertyName, object destinationValue)
        {
            // We get the property info...
            Type         targetType   = target.GetType();
            PropertyInfo propertyInfo = targetType.GetProperty(strPropertyName);

            if (propertyInfo == null)
            {
                throw new ArgumentException("Object: " + target + " does not have the property: " + strPropertyName);
            }

            // We check that we support the property type...
            Type propertyType = propertyInfo.PropertyType;

            if (MapManagedTypes.ContainsKey(propertyType) == false)
            {
                throw new NotSupportedException("Transition does not handle properties of type: " + propertyType);
            }

            // We can only transition properties that are both getable and setable...
            if (propertyInfo.CanRead == false || propertyInfo.CanWrite == false)
            {
                throw new NotSupportedException("Property is not both getable and setable: " + strPropertyName);
            }

            IManagedType managedType = MapManagedTypes[propertyType];

            // We can manage this type, so we store the information for the
            // transition of this property...
            var info = new TransitionedPropertyInfo
            {
                EndValue     = destinationValue,
                Target       = target,
                PropertyInfo = propertyInfo,
                ManagedType  = managedType
            };

            lock (_lock)
            {
                _listTransitionedProperties.Add(info);
            }
        }
コード例 #4
0
        /// <summary>
        /// Registers a transition-type. We hold them in a map.
        /// </summary>
        private static void registerType(IManagedType transitionType)
        {
            Type type = transitionType.getManagedType();

            m_mapManagedTypes[type] = transitionType;
        }
コード例 #5
0
		/// <summary>
		/// Registers a transition-type. We hold them in a map.
		/// </summary>
		private static void registerType(IManagedType transitionType)
		{
			Type type = transitionType.getManagedType();
			m_mapManagedTypes[type] = transitionType;
		}
コード例 #6
0
ファイル: Transition.cs プロジェクト: nikeee/net-transitions
 /// <summary>
 /// Registers a transition-type. We hold them in a map.
 /// </summary>
 private static void RegisterType(IManagedType transitionType)
 {
     var type = transitionType.GetManagedType();
     MapManagedTypes[type] = transitionType;
 }
コード例 #7
0
        /// <summary>
        /// Registers a transition-type. We hold them in a map.
        /// </summary>
        private static void RegisterType(IManagedType transitionType)
        {
            var type = transitionType.GetManagedType();

            MapManagedTypes[type] = transitionType;
        }
コード例 #8
0
 private static void registerType(IManagedType transitionType)
 {
     System.Type managedType = transitionType.getManagedType();
     Transition.m_mapManagedTypes[managedType] = transitionType;
 }