/// <summary>
        /// Compiles a <see cref="UvssStoryboardAnimation"/> from the specified syntax node.
        /// </summary>
        private static UvssStoryboardAnimation CompileStoryboardAnimation(UvssAnimationSyntax node, CultureInfo culture)
        {
            var animatedProperty =
                new DependencyName(GetPropertyName(node.PropertyName));

            var navigationExpression = node.NavigationExpression == null ? null :
                                       CompileNavigationExpression(node.NavigationExpression);

            var keyframes = new List <UvssStoryboardKeyframe>();

            for (int i = 0; i < node.Body.Content.Count; i++)
            {
                var keyframeNode = (UvssAnimationKeyframeSyntax)node.Body.Content[i];
                var keyframe     = CompileStoryboardKeyframe(keyframeNode, culture);
                keyframes.Add(keyframe);
            }

            return(new UvssStoryboardAnimation(
                       animatedProperty,
                       navigationExpression,
                       new UvssStoryboardKeyframeCollection(keyframes)));
        }
Exemplo n.º 2
0
        /// <inheritdoc/>
        public override SyntaxNode VisitAnimation(UvssAnimationSyntax node)
        {
            var unchanged = true;

            var newAnimationKeyword = (SyntaxToken)Visit(node.AnimationKeyword);

            if (newAnimationKeyword != node.AnimationKeyword)
            {
                unchanged = false;
            }

            var newPropertyName = (UvssPropertyNameSyntax)Visit(node.PropertyName);

            if (newPropertyName != node.PropertyName)
            {
                unchanged = false;
            }

            var newNavigationExpression = (UvssNavigationExpressionSyntax)Visit(node.NavigationExpression);

            if (newNavigationExpression != node.NavigationExpression)
            {
                unchanged = false;
            }

            var newBody = (UvssBlockSyntax)Visit(node.Body);

            if (newBody != node.Body)
            {
                unchanged = false;
            }

            return(unchanged ? node : new UvssAnimationSyntax(
                       newAnimationKeyword,
                       newPropertyName,
                       newNavigationExpression,
                       newBody));
        }
 /// <summary>
 /// Visits the specified animation node.
 /// </summary>
 /// <param name="node">The node to visit.</param>
 /// <returns>A node which should replace the visited node, or a reference to the visited node
 /// itself if no changes were made.</returns>
 public virtual SyntaxNode VisitAnimation(UvssAnimationSyntax node)
 {
     return(VisitSyntaxNode(node));
 }