Esempio n. 1
0
        /// <summary>
        /// Registers a provided <see cref="AnimationBase"/> with an optional start time
        /// </summary>
        /// <param name="animation">An <see cref="AnimationBase"/></param>
        public void Remove(int id)
        {
            try
            {
                AnimationStoryModel animationStoryModel = this.GetAnimationById(id);

                if (animationStoryModel != null)
                {
                    this.Animations.Remove(animationStoryModel);
                    this.Animations.Sort();
                    _count--;
                }
            }
            catch (Exception exception)
            {
                Debug.WriteLine(exception.Message);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Registers a provided <see cref="StructAnimationBase{T}"/> and the associated <see cref="{T}"/> value
        /// </summary>
        /// <param name="animation">An <see cref="AnimationBase"/></param>
        /// <param name="value">A reference to a value type which will change during the animation progress</param>
        /// param name="start">The starting point in milliseconds</param>
        public void Add <T>(StructAnimationBase <T> animation, ref T value, double startTime = 0.0) where T : struct
        {
            try
            {
                int id = new Random().Next(_count, _count * 2);

                AnimationStoryModel animationModel = this.GetAnimationById(id);
                while (animationModel != null)
                {
                    id             = new Random().Next(_count, _count * 2);
                    animationModel = this.GetAnimationById(id);
                }

                AnimationStoryModel animationStoryModel = new AnimationStoryModel(animation, startTime);
                this.Animations.Add(animationStoryModel);
                this.Animations.Sort();
                _count++;
            }
            catch (Exception exception)
            {
                Debug.WriteLine(exception.Message);
            }
        }