/// <summary>
        /// Reifies an instance of the <see cref="UvssStoryboard"/> class into a new instance of the <see cref="Storyboard"/> class.
        /// </summary>
        /// <param name="uv">The Ultraviolet context.</param>
        /// <param name="storyboardDefinition">The storyboard definition to reify.</param>
        /// <returns>The new instance of <see cref="Storyboard"/> that was created.</returns>
        public static Storyboard ReifyStoryboard(UltravioletContext uv, UvssStoryboard storyboardDefinition)
        {
            Contract.Require(uv, "uv");
            Contract.Require(storyboardDefinition, "storyboardDefinition");

            var storyboard = new Storyboard(uv);
            storyboard.LoopBehavior = storyboardDefinition.LoopBehavior;

            foreach (var targetDefinition in storyboardDefinition.Targets)
            {
                var target = ReifyStoryboardTarget(uv, targetDefinition);
                storyboard.Targets.Add(target);
            }

            return storyboard;
        }
Example #2
0
        /// <summary>
        /// Creates a new <see cref="Storyboard"/> instance from the specified storyboard definition.
        /// </summary>
        /// <param name="storyboardDefinition">The storyboard definition to instantiate.</param>
        /// <returns>The <see cref="Storyboard"/> instance that was created.</returns>
        private Storyboard InstantiateStoryboard(UvssStoryboard storyboardDefinition)
        {
            var storyboardInstance = new Storyboard(
                Ultraviolet, storyboardDefinition.LoopBehavior);

            foreach (var targetDefinition in storyboardDefinition.Targets)
            {
                var targetInstance = InstantiateStoryboardTarget(targetDefinition);
                storyboardInstance.Targets.Add(targetInstance);
            }

            return storyboardInstance;
        }