Exemplo n.º 1
0
 /// <summary>
 /// Starts the playing of the animation
 /// </summary>
 /// <param name="frameCallback">The callback to get invoked at each frame</param>
 /// <param name="endCallback">The callback to get invoked at the end of the animation</param>
 public void Play(SafeInvoker <Float3D> frameCallback, SafeInvoker endCallback)
 {
     Stop();
     FrameCallback = frameCallback;
     EndCallback   = endCallback;
     IsEnded       = false;
     HorizontalAnimator.Play(
         new SafeInvoker <float>(
             value =>
     {
         XValue = value;
         InvokeSetter();
     }),
         new SafeInvoker(InvokeFinisher));
     VerticalAnimator.Play(
         new SafeInvoker <float>(
             value =>
     {
         YValue = value;
         InvokeSetter();
     }),
         new SafeInvoker(InvokeFinisher));
     DepthAnimator.Play(
         new SafeInvoker <float>(
             value =>
     {
         ZValue = value;
         InvokeSetter();
     }),
         new SafeInvoker(InvokeFinisher));
 }
 /// <summary>
 /// Starts the playing of the animation
 /// </summary>
 /// <param name="frameCallback">The callback to get invoked at each frame</param>
 /// <param name="endCallback">The callback to get invoked at the end of the animation</param>
 public virtual void Play(SafeInvoker <int> frameCallback, SafeInvoker endCallback)
 {
     Stop();
     FrameCallbackInt = frameCallback;
     EndCallback      = endCallback;
     _timer.ResetClock();
     lock (_tempPaths)
     {
         _tempPaths.AddRange(_paths);
     }
     _timer.Start();
 }
        /// <summary>
        /// Starts the playing of the animation
        /// </summary>
        /// <param name="targetObject">The target object to change the property</param>
        /// <param name="propertyName">The name of the property to change</param>
        /// <param name="endCallback">The callback to get invoked at the end of the animation</param>
        /// <param name="type">Redundant value. Enter 1</param>
        public virtual void Play(object targetObject, string propertyName, SafeInvoker endCallback, int type)
        {
            TargetObject = targetObject;
            var prop = TargetObject.GetType()
                       .GetProperty(
                propertyName,
                BindingFlags.IgnoreCase | BindingFlags.Static | BindingFlags.Public | BindingFlags.Instance |
                BindingFlags.SetProperty);

            if (prop == null)
            {
                return;
            }
            Play(
                new SafeInvoker <int>(
                    value => prop.SetValue(TargetObject, Convert.ChangeType(value, prop.PropertyType), null),
                    TargetObject),
                endCallback);
        }
Exemplo n.º 4
0
 /// <summary>
 /// Starts the playing of the animation
 /// </summary>
 /// <param name="frameCallback">The callback to get invoked at each frame</param>
 public void Play(SafeInvoker <Float3D> frameCallback)
 {
     Play(frameCallback, (SafeInvoker)null);
 }
Exemplo n.º 5
0
 /// <summary>
 /// Starts the playing of the animation
 /// </summary>
 /// <param name="targetObject">The target object to change the property</param>
 /// <param name="property">The property to change</param>
 /// <param name="endCallback">The callback to get invoked at the end of the animation</param>
 public void Play(object targetObject, KnownProperties property, SafeInvoker endCallback)
 {
     Play(targetObject, property.ToString(), endCallback);
 }
Exemplo n.º 6
0
        /// <summary>
        /// Starts the playing of the animation
        /// </summary>
        /// <typeparam name="T">Any object containing a property</typeparam>
        /// <param name="targetObject">The target object to change the property</param>
        /// <param name="propertySetter">The expression that represents the property of the target object</param>
        /// <param name="endCallback">The callback to get invoked at the end of the animation</param>
        /// <exception cref="ArgumentException">propertySetter</exception>
        public virtual void Play <T>(T targetObject, Expression <Func <T, object> > propertySetter, SafeInvoker endCallback)
        {
            if (propertySetter == null)
            {
                return;
            }
            TargetObject = targetObject;

            var property =
                ((propertySetter.Body as MemberExpression) ??
                 (((UnaryExpression)propertySetter.Body).Operand as MemberExpression))?.Member as PropertyInfo;

            if (property == null)
            {
                throw new ArgumentException(nameof(propertySetter));
            }

            Play(
                new SafeInvoker <Float3D>(
                    value =>
                    property.SetValue(TargetObject, Convert.ChangeType(value, property.PropertyType), null),
                    TargetObject),
                endCallback);
        }
 /// <summary>
 /// Starts the playing of the animation
 /// </summary>
 /// <param name="frameCallback">The callback to get invoked at each frame</param>
 public virtual void Play(SafeInvoker <int> frameCallback)
 {
     Play(frameCallback, (SafeInvoker <int>)null);
 }