Example #1
0
 /// <summary>
 /// We remove the property with the info passed in from the transition.
 /// </summary>
 internal void RemoveProperty(TransitionedPropertyInfo info)
 {
     lock (_lock)
     {
         TransitionedProperties.Remove(info);
     }
 }
Example #2
0
        public void add(object target, string strPropertyName, object destinationValue)
        {
            var property = target.GetType().GetProperty(strPropertyName);

            if (property == null)
            {
                throw new Exception("Object: " + target + " does not have the property: " + strPropertyName);
            }
            var propertyType = property.PropertyType;

            if (!m_mapManagedTypes.ContainsKey(propertyType))
            {
                throw new Exception("Transition does not handle properties of type: " + propertyType);
            }
            if (!property.CanRead || !property.CanWrite)
            {
                throw new Exception("Property is not both getable and setable: " + strPropertyName);
            }
            var mapManagedType           = m_mapManagedTypes[propertyType];
            var transitionedPropertyInfo = new TransitionedPropertyInfo();

            transitionedPropertyInfo.endValue     = destinationValue;
            transitionedPropertyInfo.target       = target;
            transitionedPropertyInfo.propertyInfo = property;
            transitionedPropertyInfo.managedType  = mapManagedType;
            lock (m_Lock)
            {
                TransitionedProperties.Add(transitionedPropertyInfo);
            }
        }
Example #3
0
 /// <summary>
 /// We remove the property with the info passed in from the transition.
 /// </summary>
 internal void removeProperty(TransitionedPropertyInfo info)
 {
     lock (m_Lock)
     {
         m_listTransitionedProperties.Remove(info);
     }
 }
Example #4
0
            public TransitionedPropertyInfo copy()
            {
                TransitionedPropertyInfo info = new TransitionedPropertyInfo();

                info.startValue   = startValue;
                info.endValue     = endValue;
                info.target       = target;
                info.propertyInfo = propertyInfo;
                info.managedType  = managedType;
                return(info);
            }
Example #5
0
            public TransitionedPropertyInfo Copy()
            {
                var info = new TransitionedPropertyInfo
                {
                    StartValue   = StartValue,
                    EndValue     = EndValue,
                    Target       = Target,
                    PropertyInfo = PropertyInfo,
                    ManagedType  = ManagedType
                };

                return(info);
            }
Example #6
0
        /// <summary>
        /// Adds a property that should be animated as part of this transition.
        /// </summary>
        public Transition Add(object target, string propertyName, object destinationValue)
        {
            // We get the property info...
            var targetType   = target.GetType();
            var propertyInfo = targetType.GetProperty(propertyName);

            if (propertyInfo == null)
            {
                throw new InvalidOperationException($"Object: {target} does not have the property: {propertyName}");
            }

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

            if (!_mapManagedTypes.ContainsKey(propertyType))
            {
                throw new InvalidOperationException($"Transition does not handle properties of type: {propertyType}");
            }

            // We can only transition properties that are both getable and setable...
            if (!propertyInfo.CanRead || !propertyInfo.CanWrite)
            {
                throw new InvalidOperationException($"Property is not both getable and setable: {propertyName}");
            }

            var 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)
            {
                TransitionedProperties.Add(info);
            }

            return(this);
        }
        /// <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);
            }
        }
Example #8
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);
            }
        }
 public TransitionedPropertyInfo copy()
 {
     TransitionedPropertyInfo info = new TransitionedPropertyInfo();
     info.startValue = startValue;
     info.endValue = endValue;
     info.target = target;
     info.propertyInfo = propertyInfo;
     info.managedType = managedType;
     return info;
 }
 /// <summary>
 /// We remove the property with the info passed in from the transition.
 /// </summary>
 internal void removeProperty(TransitionedPropertyInfo info)
 {
     lock (m_Lock)
     {
         m_listTransitionedProperties.Remove(info);
     }
 }
		/// <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 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);
            }

            IManagedType 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;

            lock (m_Lock)
            {
                m_listTransitionedProperties.Add(info);
            }
		}
Example #12
0
 public TransitionedPropertyInfo Copy()
 {
     var info = new TransitionedPropertyInfo
                {
                    StartValue = StartValue,
                    EndValue = EndValue,
                    Target = Target,
                    PropertyInfo = PropertyInfo,
                    ManagedType = ManagedType
                };
     return info;
 }
Example #13
0
 /// <summary>
 /// We remove the property with the info passed in from the transition.
 /// </summary>
 internal void RemoveProperty(TransitionedPropertyInfo info)
 {
     lock (_lock)
     {
         _listTransitionedProperties.Remove(info);
     }
 }
Example #14
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);
            }
        }