示例#1
0
        private static bool Compare(object first, object second, int depth)
        {
            if (depth > 3)
            {
                return(true);
            }
            Brush firstBrush  = first as Brush;
            Brush secondBrush = second as Brush;

            if (firstBrush != null && secondBrush != null)
            {
                return(PropertyUtilities.CompareBrushes(firstBrush, secondBrush));
            }
            GradientStopCollection firstStops;
            GradientStopCollection secondStops;

            if ((firstStops = first as GradientStopCollection) != null && (secondStops = second as GradientStopCollection) != null)
            {
                return(PropertyUtilities.CompareGradientStops(firstStops, secondStops));
            }
            TextDecorationCollection firstTextDecorationCollection;
            TextDecorationCollection secondTextDecorationCollection;

            if ((firstTextDecorationCollection = first as TextDecorationCollection) != null && (secondTextDecorationCollection = second as TextDecorationCollection) != null)
            {
                return(PropertyUtilities.CompareTextDecorations(firstTextDecorationCollection, secondTextDecorationCollection));
            }
            AxisAngleRotation3D axisAngleRotation3D1;
            AxisAngleRotation3D axisAngleRotation3D2;

            if ((axisAngleRotation3D1 = first as AxisAngleRotation3D) != null && (axisAngleRotation3D2 = second as AxisAngleRotation3D) != null)
            {
                if (axisAngleRotation3D1.Angle == axisAngleRotation3D2.Angle)
                {
                    return(axisAngleRotation3D1.Axis == axisAngleRotation3D2.Axis);
                }
                return(false);
            }
            Material firstMaterial;
            Material secondMaterial;

            if ((firstMaterial = first as Material) != null && (secondMaterial = second as Material) != null)
            {
                return(PropertyUtilities.CompareMaterials(firstMaterial, secondMaterial));
            }
            Freezable firstFreezable;
            Freezable secondFreezable;

            if ((firstFreezable = first as Freezable) != null && (secondFreezable = second as Freezable) != null)
            {
                return(PropertyUtilities.CompareFreezables(firstFreezable, secondFreezable, depth));
            }
            return(object.Equals(first, second));
        }