Пример #1
0
 T CacheAndInitializeCompositionObject <T>(Wd.CompositionObject key, T obj)
     where T : Wc.CompositionObject
 {
     Cache(key, obj);
     InitializeCompositionObject(key, obj);
     return(obj);
 }
Пример #2
0
        void InitializeCompositionObject(Wd.CompositionObject source, Wc.CompositionObject target)
        {
            // Get the CompositionPropertySet on this object. This has the side-effect of initializing
            // it and starting any animations.
            // Prevent infinite recursion - the Properties on a CompositionPropertySet is itself.
            if (source.Type != Wd.CompositionObjectType.CompositionPropertySet)
            {
                GetCompositionPropertySet(source.Properties);
            }

            if (source.Comment != null)
            {
                target.Comment = source.Comment;
            }
        }
Пример #3
0
 void StartAnimations(Wd.CompositionObject source, Wc.CompositionObject target)
 {
     foreach (var animator in source.Animators)
     {
         var animation = GetCompositionAnimation(animator.Animation);
         target.StartAnimation(animator.AnimatedProperty, animation);
         var controller = animator.Controller;
         if (controller != null)
         {
             var animationController = GetAnimationController(controller);
             if (controller.IsPaused)
             {
                 animationController.Pause();
             }
         }
     }
 }
 internal CompositionPropertySet(CompositionObject owner)
 {
     Owner = owner;
 }
Пример #5
0
        Wc.CompositionObject GetCompositionObject(Wd.CompositionObject obj)
        {
            switch (obj.Type)
            {
            case Wd.CompositionObjectType.AnimationController:
                return(GetAnimationController((Wd.AnimationController)obj));

            case Wd.CompositionObjectType.ColorKeyFrameAnimation:
                return(GetColorKeyFrameAnimation((Wd.ColorKeyFrameAnimation)obj));

            case Wd.CompositionObjectType.CompositionColorBrush:
                return(GetCompositionColorBrush((Wd.CompositionColorBrush)obj));

            case Wd.CompositionObjectType.CompositionContainerShape:
                return(GetCompositionContainerShape((Wd.CompositionContainerShape)obj));

            case Wd.CompositionObjectType.CompositionEllipseGeometry:
                return(GetCompositionEllipseGeometry((Wd.CompositionEllipseGeometry)obj));

            case Wd.CompositionObjectType.CompositionPathGeometry:
                return(GetCompositionPathGeometry((Wd.CompositionPathGeometry)obj));

            case Wd.CompositionObjectType.CompositionPropertySet:
                return(GetCompositionPropertySet((Wd.CompositionPropertySet)obj));

            case Wd.CompositionObjectType.CompositionRectangleGeometry:
                return(GetCompositionRectangleGeometry((Wd.CompositionRectangleGeometry)obj));

            case Wd.CompositionObjectType.CompositionRoundedRectangleGeometry:
                return(GetCompositionRoundedRectangleGeometry((Wd.CompositionRoundedRectangleGeometry)obj));

            case Wd.CompositionObjectType.CompositionSpriteShape:
                return(GetCompositionSpriteShape((Wd.CompositionSpriteShape)obj));

            case Wd.CompositionObjectType.CompositionViewBox:
                return(GetCompositionViewBox((Wd.CompositionViewBox)obj));

            case Wd.CompositionObjectType.ContainerVisual:
                return(GetContainerVisual((Wd.ContainerVisual)obj));

            case Wd.CompositionObjectType.CubicBezierEasingFunction:
                return(GetCubicBezierEasingFunction((Wd.CubicBezierEasingFunction)obj));

            case Wd.CompositionObjectType.ExpressionAnimation:
                return(GetExpressionAnimation((Wd.ExpressionAnimation)obj));

            case Wd.CompositionObjectType.InsetClip:
                return(GetInsetClip((Wd.InsetClip)obj));

            case Wd.CompositionObjectType.CompositionGeometricClip:
                return(GetCompositionGeometricClip((Wd.CompositionGeometricClip)obj));

            case Wd.CompositionObjectType.LinearEasingFunction:
                return(GetLinearEasingFunction((Wd.LinearEasingFunction)obj));

            case Wd.CompositionObjectType.PathKeyFrameAnimation:
                return(GetPathKeyFrameAnimation((Wd.PathKeyFrameAnimation)obj));

            case Wd.CompositionObjectType.ScalarKeyFrameAnimation:
                return(GetScalarKeyFrameAnimation((Wd.ScalarKeyFrameAnimation)obj));

            case Wd.CompositionObjectType.ShapeVisual:
                return(GetShapeVisual((Wd.ShapeVisual)obj));

            case Wd.CompositionObjectType.StepEasingFunction:
                return(GetStepEasingFunction((Wd.StepEasingFunction)obj));

            case Wd.CompositionObjectType.Vector2KeyFrameAnimation:
                return(GetVector2KeyFrameAnimation((Wd.Vector2KeyFrameAnimation)obj));

            case Wd.CompositionObjectType.Vector3KeyFrameAnimation:
                return(GetVector3KeyFrameAnimation((Wd.Vector3KeyFrameAnimation)obj));

            default:
                throw new InvalidOperationException();
            }
        }