Exemple #1
0
        public Stats(CompositionObject root)
        {
            var objectGraph = Graph.FromCompositionObject(root, includeVertices: false);

            CompositionPathCount = objectGraph.CompositionPathNodes.Count();
            CanvasGeometryCount  = objectGraph.CanvasGeometryNodes.Count();

            foreach (var n in objectGraph.CompositionObjectNodes)
            {
                CompositionObjectCount++;
                switch (n.Object.Type)
                {
                case CompositionObjectType.AnimationController:
                    AnimationControllerCount++;
                    break;

                case CompositionObjectType.ColorKeyFrameAnimation:
                    ColorKeyFrameAnimationCount++;
                    break;

                case CompositionObjectType.CompositionColorBrush:
                    ColorBrushCount++;
                    break;

                case CompositionObjectType.CompositionColorGradientStop:
                    ColorGradientStopCount++;
                    break;

                case CompositionObjectType.CompositionContainerShape:
                    ContainerShapeCount++;
                    break;

                case CompositionObjectType.CompositionEffectBrush:
                    EffectBrushCount++;
                    break;

                case CompositionObjectType.CompositionEllipseGeometry:
                    EllipseGeometryCount++;
                    break;

                case CompositionObjectType.CompositionGeometricClip:
                    GeometricClipCount++;
                    break;

                case CompositionObjectType.CompositionLinearGradientBrush:
                    LinearGradientBrushCount++;
                    break;

                case CompositionObjectType.CompositionPathGeometry:
                    PathGeometryCount++;
                    break;

                case CompositionObjectType.CompositionPropertySet:
                {
                    var propertyCount = ((CompositionPropertySet)n.Object).PropertyNames.Count();
                    if (propertyCount > 0)
                    {
                        PropertySetCount++;
                        PropertySetPropertyCount += propertyCount;
                    }
                }

                break;

                case CompositionObjectType.CompositionRadialGradientBrush:
                    RadialGradientBrushCount++;
                    break;

                case CompositionObjectType.CompositionRectangleGeometry:
                    RectangleGeometryCount++;
                    break;

                case CompositionObjectType.CompositionRoundedRectangleGeometry:
                    RoundedRectangleGeometryCount++;
                    break;

                case CompositionObjectType.CompositionSpriteShape:
                    SpriteShapeCount++;
                    break;

                case CompositionObjectType.CompositionSurfaceBrush:
                    SurfaceBrushCount++;
                    break;

                case CompositionObjectType.CompositionViewBox:
                    ViewBoxCount++;
                    break;

                case CompositionObjectType.CompositionVisualSurface:
                    VisualSurfaceCount++;
                    break;

                case CompositionObjectType.ContainerVisual:
                    ContainerVisualCount++;
                    break;

                case CompositionObjectType.CubicBezierEasingFunction:
                    CubicBezierEasingFunctionCount++;
                    break;

                case CompositionObjectType.ExpressionAnimation:
                    ExpressionAnimationCount++;
                    break;

                case CompositionObjectType.InsetClip:
                    InsetClipCount++;
                    break;

                case CompositionObjectType.LinearEasingFunction:
                    LinearEasingFunctionCount++;
                    break;

                case CompositionObjectType.PathKeyFrameAnimation:
                    PathKeyFrameAnimationCount++;
                    break;

                case CompositionObjectType.ScalarKeyFrameAnimation:
                    ScalarKeyFrameAnimationCount++;
                    break;

                case CompositionObjectType.ShapeVisual:
                    ShapeVisualCount++;
                    break;

                case CompositionObjectType.SpriteVisual:
                    SpriteVisualCount++;
                    break;

                case CompositionObjectType.StepEasingFunction:
                    StepEasingFunctionCount++;
                    break;

                case CompositionObjectType.Vector2KeyFrameAnimation:
                    Vector2KeyFrameAnimationCount++;
                    break;

                case CompositionObjectType.Vector3KeyFrameAnimation:
                    Vector3KeyFrameAnimationCount++;
                    break;

                case CompositionObjectType.Vector4KeyFrameAnimation:
                    Vector4KeyFrameAnimationCount++;
                    break;

                default:
                    throw new InvalidOperationException();
                }
            }
        }