Exemple #1
0
        /// <summary>
        /// Starts the new animation.
        /// </summary>
        /// <param name="animationDirection">The animation direction.</param>
        /// <param name="animationSource">The animation source.</param>
        /// <param name="data">The data.</param>
        /// <exception cref="Exception">Invalid MatAnimationDirection</exception>
        public void StartNewAnimation(MatAnimationDirection animationDirection, Point animationSource, object[] data = null)
        {
            if (!IsAnimating() || InterruptAnimation)
            {
                if (Singular && _animationDirections.Count > 0)
                {
                    _animationDirections[0] = animationDirection;
                }
                else
                {
                    _animationDirections.Add(animationDirection);
                }

                if (Singular && _animationSources.Count > 0)
                {
                    _animationSources[0] = animationSource;
                }
                else
                {
                    _animationSources.Add(animationSource);
                }

                if (!(Singular && _animationProgresses.Count > 0))
                {
                    switch (_animationDirections[_animationDirections.Count - 1])
                    {
                    case MatAnimationDirection.InOutRepeatingIn:
                    case MatAnimationDirection.InOutIn:
                    case MatAnimationDirection.In:
                        _animationProgresses.Add(MIN_VALUE);
                        break;

                    case MatAnimationDirection.InOutRepeatingOut:
                    case MatAnimationDirection.InOutOut:
                    case MatAnimationDirection.Out:
                        _animationProgresses.Add(MAX_VALUE);
                        break;

                    default:
                        throw new Exception("Invalid MatAnimationDirection");
                    }
                }

                if (Singular && _animationDatas.Count > 0)
                {
                    _animationDatas[0] = data ?? new object[] { };
                }
                else
                {
                    _animationDatas.Add(data ?? new object[] { });
                }
            }

            _animationTimer.Start();
        }
Exemple #2
0
        /// <summary>
        /// Sets the direction.
        /// </summary>
        /// <param name="direction">The direction.</param>
        /// <exception cref="Exception">
        /// Animation is not set to Singular.
        /// or
        /// Invalid animation
        /// </exception>
        public void SetDirection(MatAnimationDirection direction)
        {
            if (!Singular)
            {
                throw new Exception("Animation is not set to Singular.");
            }

            if (_animationProgresses.Count == 0)
            {
                throw new Exception("Invalid animation");
            }

            _animationDirections[0] = direction;
        }
Exemple #3
0
 /// <summary>
 /// Starts the new animation.
 /// </summary>
 /// <param name="animationDirection">The animation direction.</param>
 /// <param name="data">The data.</param>
 public void StartNewAnimation(MatAnimationDirection animationDirection, object[] data = null)
 {
     StartNewAnimation(animationDirection, new Point(0, 0), data);
 }