public RepeatBehavior(System.TimeSpan duration)
 {
     if (duration < System.TimeSpan.Zero)
     {
         throw new ArgumentOutOfRangeException("Repeat duration cannot be negative");
     }
     this._repeatBehaviorType = RepeatBehavior.RepeatBehaviorType.RepeatDuration;
     this._iterationCount     = 0.0f;
     this._repeatDuration     = duration;
 }
 public RepeatBehavior(float count)
 {
     if (float.IsInfinity(count) || float.IsNaN(count) || count < 0.0f)
     {
         throw new ArgumentOutOfRangeException("Invalid iteration count");
     }
     this._repeatBehaviorType = RepeatBehavior.RepeatBehaviorType.IterationCount;
     this._iterationCount     = count;
     this._repeatDuration     = new TimeSpanStruct(0L);
 }
        public void Type_Set_GetReturnsExpected(RepeatBehaviorType type)
        {
            var repeatBehaviour = new RepeatBehavior(1)
            {
                Type = type
            };

            Assert.Equal(type == RepeatBehaviorType.Count, repeatBehaviour.HasCount);
            Assert.Equal(type == RepeatBehaviorType.Duration, repeatBehaviour.HasDuration);
        }
        public RepeatBehavior(TimeSpan duration)
        {
            if (duration < new TimeSpan(0))
            {
                throw new ArgumentOutOfRangeException(nameof(duration));
            }

            _Duration = duration;
            _Count    = 0.0;
            _Type     = RepeatBehaviorType.Duration;
        }
        public RepeatBehavior(double count)
        {
            if (!double.IsFinite(count) || count < 0.0)
            {
                throw new ArgumentOutOfRangeException(nameof(count));
            }

            _Duration = new TimeSpan(0);
            _Count    = count;
            _Type     = RepeatBehaviorType.Count;
        }
Exemple #6
0
        public RepeatBehavior(TimeSpan duration)
        {
            if (duration < new TimeSpan(0))
            {
                throw new ArgumentOutOfRangeException(nameof(duration));
            }

            _Duration = duration;
            _Count = 0.0;
            _Type = RepeatBehaviorType.Duration;
        }
Exemple #7
0
        /// <summary>
        /// Creates a new RepeatBehavior that represents a repeat duration for which a Timeline will repeat
        /// its simple duration.
        /// </summary>
        /// <param name="duration">A TimeSpan representing the repeat duration specified by this RepeatBehavior.</param>
        public RepeatBehavior(TimeSpan duration)
        {
            if (duration < new TimeSpan(0))
            {
                throw new ArgumentOutOfRangeException("duration", SR.Get(SRID.Timing_RepeatBehaviorInvalidRepeatDuration, duration));
            }

            _iterationCount = 0.0;
            _repeatDuration = duration;
            _type           = RepeatBehaviorType.RepeatDuration;
        }
        /// <summary>
        /// Creates a new RepeatBehavior that represents a repeat duration for which a Timeline will repeat
        /// its simple duration.
        /// </summary>
        /// <param name="duration">A TimeSpan representing the repeat duration specified by this RepeatBehavior.</param>
        public RepeatBehavior(TimeSpan duration)
        {
            if (duration < new TimeSpan(0))
            {
                throw new ArgumentOutOfRangeException("duration", SR.Get(SRID.Timing_RepeatBehaviorInvalidRepeatDuration, duration));
            }

            _iterationCount = 0.0;
            _repeatDuration = duration;
            _type = RepeatBehaviorType.RepeatDuration;
        }
Exemple #9
0
        public RepeatBehavior(double count)
        {
            if (Double.IsInfinity(count)
                || Double.IsNaN(count)
                || count < 0.0)
            {
                throw new ArgumentOutOfRangeException(nameof(count));
            }

            _Duration = new TimeSpan(0);
            _Count = count;
            _Type = RepeatBehaviorType.Count;
        }
Exemple #10
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RepeatBehavior"/>
        /// structure with the specified repeat duration.
        /// </summary>
        /// <param name="duration">
        /// The total length of time that the <see cref="Timeline"/> should
        /// play (its active duration).
        /// </param>
        /// <exception cref="ArgumentOutOfRangeException">
        /// duration evaluates to a negative number.
        /// </exception>
        public RepeatBehavior(TimeSpan duration)
        {
            if (duration < new TimeSpan(0))
            {
                throw new ArgumentOutOfRangeException(nameof(duration),
                                                      string.Format("'{0}' is not a valid RepeatDuration value for a RepeatBehavior structure. A RepeatDuration value must be a TimeSpan value greater than or equal to zero ticks.", duration)
                                                      );
            }

            _iterationCount = 0.0;
            _repeatDuration = duration;
            _type           = RepeatBehaviorType.Duration;
        }
Exemple #11
0
        public RepeatBehavior(double count)
        {
            if (Double.IsInfinity(count) ||
                Double.IsNaN(count) ||
                count < 0.0)
            {
                throw new ArgumentOutOfRangeException("count");
            }

            _Duration = new TimeSpan(0);
            _Count    = count;
            _Type     = RepeatBehaviorType.Count;
        }
Exemple #12
0
        /// <summary>
        /// Creates a new RepeatBehavior that represents and iteration count.
        /// </summary>
        /// <param name="count">The number of iterations specified by this RepeatBehavior.</param>
        public RepeatBehavior(double count)
        {
            if (Double.IsInfinity(count) ||
                DoubleUtil.IsNaN(count) ||
                count < 0.0)
            {
                throw new ArgumentOutOfRangeException("count", SR.Get(SRID.Timing_RepeatBehaviorInvalidIterationCount, count));
            }

            _repeatDuration = new TimeSpan(0);
            _iterationCount = count;
            _type           = RepeatBehaviorType.IterationCount;
        }
        /// <summary>
        /// Creates a new RepeatBehavior that represents and iteration count.
        /// </summary>
        /// <param name="count">The number of iterations specified by this RepeatBehavior.</param>
        public RepeatBehavior(double count)
        {
            if (   Double.IsInfinity(count)
                || DoubleUtil.IsNaN(count)
                || count < 0.0)
            {
                throw new ArgumentOutOfRangeException("count", SR.Get(SRID.Timing_RepeatBehaviorInvalidIterationCount, count));
            }

            _repeatDuration = new TimeSpan(0);
            _iterationCount = count;
            _type = RepeatBehaviorType.IterationCount;
        }
Exemple #14
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RepeatBehavior"/>
        /// structure with the specified iteration count.
        /// </summary>
        /// <param name="count">
        /// A number greater than or equal to 0 that specifies the number of iterations for
        /// an animation.
        /// </param>
        /// <exception cref="ArgumentOutOfRangeException">
        /// count evaluates to infinity, a value that is not a number, or is negative.
        /// </exception>
        public RepeatBehavior(double count)
        {
            if (double.IsInfinity(count) ||
                double.IsNaN(count) ||
                count < 0.0)
            {
                throw new ArgumentOutOfRangeException(nameof(count),
                                                      string.Format("'{0}' is not a valid IterationCount value for a RepeatBehavior structure. An IterationCount value must represent a number that is greater than or equal to zero but not infinite.", count)
                                                      );
            }

            _repeatDuration = new TimeSpan(0);
            _iterationCount = count;
            _type           = RepeatBehaviorType.Count;
        }
 public RepeatBehavior(RepeatBehaviorType type, int count)
 {
     Type  = type;
     Count = count;
 }