예제 #1
0
        public void HighlightProperty(PropertyReference propertyReference)
        {
            if (propertyReference.Count < 4 || !propertyReference[1].Equals((object)PathElement.FiguresProperty))
            {
                return;
            }
            IndexedClrPropertyReferenceStep propertyReferenceStep1 = propertyReference[2] as IndexedClrPropertyReferenceStep;

            if (propertyReferenceStep1 == null)
            {
                return;
            }
            this.HighlightFigureIndex = propertyReferenceStep1.Index;
            if (propertyReference.Count == 4 && propertyReference[3].Equals((object)PathElement.PathFigureStartPointProperty))
            {
                this.HighlightSegmentPointIndex = 0;
                this.HighlightSegmentIndex      = -1;
                this.RenderHighlight            = true;
            }
            else
            {
                if (propertyReference.Count != 6 || !propertyReference[3].Equals((object)PathElement.PathFigureSegmentsProperty))
                {
                    return;
                }
                IndexedClrPropertyReferenceStep propertyReferenceStep2 = propertyReference[4] as IndexedClrPropertyReferenceStep;
                if (propertyReferenceStep2 == null)
                {
                    return;
                }
                this.HighlightSegmentIndex      = propertyReferenceStep2.Index;
                this.HighlightSegmentPointIndex = PathElement.GetPointIndexFromPointProperty((IPropertyId)propertyReference[5]);
                this.RenderHighlight            = true;
            }
        }
예제 #2
0
        private void SetPathGeometryUsingMinimalDiff(PathGeometry path, PathGeometry currentGeometry)
        {
            PropertyReference propertyReference = new PropertyReference(this.platformMetadata.ResolveProperty((IPropertyId)this.pathProperty) as ReferenceStep).Append(PathElement.FiguresProperty);

            for (int index = 0; index < path.Figures.Count; ++index)
            {
                ReferenceStep     step            = (ReferenceStep)IndexedClrPropertyReferenceStep.GetReferenceStep((IPlatformMetadata)this.platformMetadata, PlatformTypes.PathFigureCollection, index);
                PropertyReference figureReference = propertyReference.Append(step);
                PathFigure        currentFigure   = currentGeometry.Figures[index];
                this.SetFigureUsingMinimalDiff(path.Figures[index], currentFigure, figureReference);
            }
        }
예제 #3
0
        private static void TransferPathFigureAnimations(PathElement oldElement, PathElement newElement, PropertyReference pathProperty, int oldFigureIndex, int newFigureIndex, Transform transform, PathAnimationMovePackage animationMove)
        {
            IProjectContext   projectContext             = newElement.ProjectContext;
            IType             type                       = projectContext.ResolveType(PlatformTypes.PathFigureCollection);
            PropertyReference propertyReference          = pathProperty.Append(PathElement.FiguresProperty);
            ReferenceStep     step1                      = (ReferenceStep)IndexedClrPropertyReferenceStep.GetReferenceStep((ITypeResolver)projectContext, type.RuntimeType, oldFigureIndex);
            PropertyReference sourceReferencePrefix      = propertyReference.Append(step1);
            ReferenceStep     step2                      = (ReferenceStep)IndexedClrPropertyReferenceStep.GetReferenceStep((ITypeResolver)projectContext, type.RuntimeType, newFigureIndex);
            PropertyReference destinationReferencePrefix = propertyReference.Append(step2);

            PathCommandHelper.MoveVertexAnimations((SceneElement)oldElement, sourceReferencePrefix, (SceneElement)newElement, destinationReferencePrefix, transform, animationMove);
        }
예제 #4
0
        private void SetPolyLineSegmentUsingMinimalDiff(PolyLineSegment currentSegment, PolyLineSegment pathSegment, PropertyReference segmentReference)
        {
            PropertyReference propertyReference1 = segmentReference.Append(PathElement.PolyLineSegmentPointsProperty);

            for (int index = 0; index < currentSegment.Points.Count; ++index)
            {
                ReferenceStep     step = (ReferenceStep)IndexedClrPropertyReferenceStep.GetReferenceStep((IPlatformMetadata)this.platformMetadata, PlatformTypes.PointCollection, index);
                PropertyReference propertyReference2 = propertyReference1.Append(step);
                if (!VectorUtilities.ArePathPointsVeryClose(currentSegment.Points[index], pathSegment.Points[index]))
                {
                    this.targetElement.SetValueAsWpf(propertyReference2, (object)pathSegment.Points[index]);
                }
            }
        }
예제 #5
0
            private ReferenceStep GetProperty(string propertyName)
            {
                if (string.IsNullOrEmpty(propertyName))
                {
                    return((ReferenceStep)null);
                }
                if (propertyName == "\\")
                {
                    return((ReferenceStep)IndexedClrPropertyReferenceStep.GetReferenceStep(this.ancestorNode.TypeResolver, this.ancestorNode.TargetType, 0, false));
                }
                MemberAccessTypes allowableMemberAccess = TypeHelper.GetAllowableMemberAccess(this.ancestorNode.TypeResolver, this.ancestorNode.Type);

                return(this.ancestorNode.Type.GetMember(MemberType.Property, propertyName, allowableMemberAccess) as ReferenceStep);
            }
        private PropertyEntry CreatePropertyEntryForCondition(SceneNode condition)
        {
            List <ReferenceStep> steps     = new List <ReferenceStep>();
            IProperty            property1 = condition.ProjectContext.ResolveProperty(BehaviorHelper.BehaviorsProperty);

            steps.Add(property1 as ReferenceStep);
            ISceneNodeCollection <SceneNode> collectionForProperty = this.behaviorTriggerBaseNode.GetCollectionForProperty(BehaviorHelper.BehaviorsProperty);

            steps.Add((ReferenceStep)IndexedClrPropertyReferenceStep.GetReferenceStep((ITypeResolver)condition.ProjectContext, ProjectNeutralTypes.BehaviorCollection, collectionForProperty.IndexOf((SceneNode)this.conditionBehaviorNode)));
            IProperty property2 = condition.ProjectContext.ResolveProperty(ConditionBehaviorNode.ConditionProperty);

            steps.Add(property2 as ReferenceStep);
            IProperty property3 = condition.ProjectContext.ResolveProperty(ConditionalExpressionNode.ConditionsProperty);

            steps.Add(property3 as ReferenceStep);
            steps.Add((ReferenceStep)IndexedClrPropertyReferenceStep.GetReferenceStep((ITypeResolver)condition.ProjectContext, ProjectNeutralTypes.ConditionCollection, this.conditions.IndexOf(condition)));
            return((PropertyEntry)this.objectSet.CreateProperty(new PropertyReference(steps), (AttributeCollection)null));
        }
예제 #7
0
        public static ReferenceStep GetReferenceStep(DocumentNodeMarker marker)
        {
            Type type;

            if (marker.Parent == null)
            {
                return(null);
            }
            if (!marker.IsChild)
            {
                IPropertyId   property      = marker.Property;
                ReferenceStep referenceStep = property as ReferenceStep ?? marker.DocumentContext.TypeResolver.ResolveProperty(property) as ReferenceStep;
                return(referenceStep);
            }
            int childIndex            = marker.ChildIndex;
            DocumentNodeMarker parent = marker.Parent;

            type = (parent.Node == null ? PlatformTypeHelper.GetPropertyType(parent.Property) : parent.Node.TargetType);
            return(IndexedClrPropertyReferenceStep.GetReferenceStep(marker.DocumentContext.TypeResolver, type, childIndex, false));
        }
예제 #8
0
        public GradientStopEditor(BrushEditor brushEditor, SceneNodeProperty basisProperty, int propertyIndex)
            : base(brushEditor, basisProperty)
        {
            ITypeResolver typeResolver = (ITypeResolver)basisProperty.SceneNodeObjectSet.ProjectContext;
            IType         type         = typeResolver.ResolveType(PlatformTypes.GradientStopCollection);

            if (type == null)
            {
                return;
            }
            IndexedClrPropertyReferenceStep referenceStep = IndexedClrPropertyReferenceStep.GetReferenceStep(typeResolver, type.RuntimeType, propertyIndex);
            PropertyReference propertyReference           = basisProperty.Reference.Append((ReferenceStep)referenceStep);

            this.gradientStopProperty = basisProperty.SceneNodeObjectSet.CreateSceneNodeProperty(propertyReference, (AttributeCollection)null);
            ReferenceStep step1 = (ReferenceStep)typeResolver.ResolveProperty(GradientStopNode.ColorProperty);
            ReferenceStep step2 = (ReferenceStep)typeResolver.ResolveProperty(GradientStopNode.OffsetProperty);

            this.colorProperty  = this.RequestUpdates(propertyReference.Append(step1), new PropertyChangedEventHandler(this.OnColorChanged));
            this.offsetProperty = this.RequestUpdates(propertyReference.Append(step2), new PropertyChangedEventHandler(this.OnOffsetChanged));
            this.propertyIndex  = propertyIndex;
        }
예제 #9
0
        private void Rebuild()
        {
            if (this.TriggerNodeView == null)
            {
                return;
            }
            int currentPosition = this.TriggerNodeView.CurrentPosition;

            this.ClearTriggerPropertiesList();
            ISceneNodeCollection <SceneNode> collectionForProperty = this.behaviorNode.GetCollectionForProperty(BehaviorHelper.BehaviorTriggersProperty);

            foreach (SceneNode sceneNode in (IEnumerable <SceneNode>)collectionForProperty)
            {
                BehaviorTriggerBaseNode behaviorTriggerBaseNode = (BehaviorTriggerBaseNode)sceneNode;
                foreach (BehaviorTriggerActionNode triggerActionNode in (IEnumerable <SceneNode>)behaviorTriggerBaseNode.Actions)
                {
                    InvokeCommandActionNode commandActionNode = triggerActionNode as InvokeCommandActionNode;
                    if (commandActionNode != null && commandActionNode.IsAttached && string.Compare(commandActionNode.CommandName, this.CategoryName, StringComparison.OrdinalIgnoreCase) == 0)
                    {
                        PropertyReference propertyReference = new PropertyReference(new List <ReferenceStep>()
                        {
                            this.behaviorNode.GetPropertyForChild((SceneNode)behaviorTriggerBaseNode) as ReferenceStep,
                            (ReferenceStep)IndexedClrPropertyReferenceStep.GetReferenceStep((ITypeResolver)sceneNode.ProjectContext, ProjectNeutralTypes.BehaviorTriggerCollection, collectionForProperty.IndexOf((SceneNode)behaviorTriggerBaseNode))
                        });
                        if (!Enumerable.Any <PropertyEntry>((IEnumerable <PropertyEntry>) this.TriggerNodes, (Func <PropertyEntry, bool>)(existingProperty => ((PropertyReferenceProperty)existingProperty).Reference.Equals((object)propertyReference))))
                        {
                            this.TriggerNodes.Add((PropertyEntry)this.CreateProperty(propertyReference));
                        }
                    }
                }
            }
            if (currentPosition >= this.TriggerNodes.Count)
            {
                return;
            }
            this.TriggerNodeView.MoveCurrentToPosition(currentPosition);
        }
예제 #10
0
 public override object CreateType(Type type)
 {
     if (type == (Type)null)
     {
         SceneNodeProperty sceneNodeProperty = this.Host.PropertyValue.get_ParentProperty() as SceneNodeProperty;
         if (sceneNodeProperty != null)
         {
             SceneViewModel viewModel             = sceneNodeProperty.SceneNodeObjectSet.ViewModel;
             ReferenceStep  step                  = (ReferenceStep)IndexedClrPropertyReferenceStep.GetReferenceStep((ITypeResolver)viewModel.ProjectContext, ((PropertyEntry)sceneNodeProperty).get_PropertyType(), 0);
             Type           propertyType          = sceneNodeProperty.Reference.Append(step).ValueType;
             Type           genericCollectionType = CollectionAdapterDescription.GetGenericCollectionType(((PropertyEntry)sceneNodeProperty).get_PropertyType());
             if (genericCollectionType != (Type)null && propertyType.IsAssignableFrom(genericCollectionType))
             {
                 propertyType = genericCollectionType;
             }
             SceneNode typeForProperty = this.CreateTypeForProperty(viewModel, propertyType);
             if (typeForProperty != null)
             {
                 return((object)typeForProperty.DocumentNode);
             }
         }
     }
     return(null);
 }
예제 #11
0
        public static DocumentPropertyNodeReferenceBase CreateCompositeOrCollectionNodePropertyReference(SceneNode referenceSource, DocumentCompositeNode parent, IPropertyId propertyKey, BaseTriggerNode trigger, DocumentNodeResolver.ShouldUseTrigger shouldUseTrigger, bool visualTriggerOnly)
        {
            IndexedClrPropertyReferenceStep referenceStep = propertyKey as IndexedClrPropertyReferenceStep;

            return(referenceStep == null ? (trigger == null || shouldUseTrigger == null || !shouldUseTrigger(trigger, propertyKey) ? (referenceSource == null ? (DocumentPropertyNodeReferenceBase) new DocumentPropertyNodeReference(parent, propertyKey) : referenceSource.CreateLocalDocumentPropertyNodeReference(parent, propertyKey)) : (DocumentPropertyNodeReferenceBase) new TriggerSetterNodeReference(trigger, parent, propertyKey, visualTriggerOnly)) : (!parent.SupportsChildren || referenceStep.Index < 0 || referenceStep.Index >= parent.Children.Count ? (DocumentPropertyNodeReferenceBase)null : (DocumentPropertyNodeReferenceBase) new DocumentIndexedPropertyNodeReference(parent, referenceStep)));
        }
예제 #12
0
 public DocumentIndexedPropertyNodeReference(DocumentCompositeNode parent, IndexedClrPropertyReferenceStep referenceStep)
 {
     this.parent        = parent;
     this.referenceStep = referenceStep;
 }
예제 #13
0
        private void ApplyAnimationChanges(PathGeometry oldGeometry, PathGeometry newGeometry, PathAction action)
        {
            PropertyReference propertyReference1 = new PropertyReference(this.platformMetadata.ResolveProperty((IPropertyId)this.pathProperty) as ReferenceStep).Append(PathElement.FiguresProperty);
            ReferenceStep     step1 = (ReferenceStep)IndexedClrPropertyReferenceStep.GetReferenceStep((IPlatformMetadata)this.platformMetadata, PlatformTypes.PathFigureCollection, action.Figure);
            PropertyReference propertyReference2 = propertyReference1.Append(step1);

            propertyReference2.Append(PathElement.PathFigureSegmentsProperty);
            Dictionary <TimelineSceneNode, StoryboardTimelineSceneNode> toRemove1             = new Dictionary <TimelineSceneNode, StoryboardTimelineSceneNode>();
            Dictionary <TimelineSceneNode, StoryboardTimelineSceneNode> dictionary1           = new Dictionary <TimelineSceneNode, StoryboardTimelineSceneNode>();
            Dictionary <TimelineSceneNode, StoryboardTimelineSceneNode> subdivisionProperties = new Dictionary <TimelineSceneNode, StoryboardTimelineSceneNode>();

            foreach (PathStructureChange pathStructureChange in action.PathStructureChanges)
            {
                int index1 = action.Figure;
                int index2 = action.Figure;
                PropertyReference propertyReference3 = propertyReference2;
                PropertyReference propertyReference4 = propertyReference2;
                if (pathStructureChange.OldFigureIndex != -1)
                {
                    ReferenceStep step2 = (ReferenceStep)IndexedClrPropertyReferenceStep.GetReferenceStep((IPlatformMetadata)this.platformMetadata, PlatformTypes.PathFigureCollection, pathStructureChange.OldFigureIndex);
                    propertyReference3 = propertyReference1.Append(step2);
                    index1             = pathStructureChange.OldFigureIndex;
                }
                if (pathStructureChange.NewFigureIndex != -1)
                {
                    ReferenceStep step2 = (ReferenceStep)IndexedClrPropertyReferenceStep.GetReferenceStep((IPlatformMetadata)this.platformMetadata, PlatformTypes.PathFigureCollection, pathStructureChange.NewFigureIndex);
                    propertyReference4 = propertyReference1.Append(step2);
                    index2             = pathStructureChange.NewFigureIndex;
                }
                PropertyReference propertyReference5 = propertyReference3.Append(PathElement.PathFigureSegmentsProperty);
                PropertyReference propertyReference6 = propertyReference4.Append(PathElement.PathFigureSegmentsProperty);
                PropertyReference propertyReference7 = (PropertyReference)null;
                bool flag1 = false;
                if (pathStructureChange.OldSegmentIndex == PathStructureChange.StartPointIndex)
                {
                    propertyReference7 = propertyReference3.Append(PathElement.PathFigureStartPointProperty);
                    flag1 = true;
                }
                else if (pathStructureChange.OldSegmentIndex != PathStructureChange.DeletedPointIndex)
                {
                    ReferenceStep step2 = (ReferenceStep)IndexedClrPropertyReferenceStep.GetReferenceStep((IPlatformMetadata)this.platformMetadata, PlatformTypes.PathSegmentCollection, pathStructureChange.OldSegmentIndex);
                    propertyReference7 = propertyReference5.Append(step2);
                    if (pathStructureChange.OldPointProperty != null)
                    {
                        ReferenceStep step3 = (ReferenceStep)PathDiff.GetReferenceStepFromWpf(this.targetElement.DesignerContext, this.targetElement.Platform, pathStructureChange.OldPointProperty.OwnerType, pathStructureChange.OldPointProperty);
                        propertyReference7 = propertyReference7.Append(step3);
                        flag1 = true;
                    }
                    else if (pathStructureChange.NewSegmentIndex == PathStructureChange.StartPointIndex)
                    {
                        if (pathStructureChange.OldSegmentIndex < oldGeometry.Figures[index1].Segments.Count)
                        {
                            propertyReference7 = propertyReference7.Append(this.LastPointProperty(oldGeometry.Figures[index1].Segments[pathStructureChange.OldSegmentIndex]));
                            flag1 = true;
                        }
                        else
                        {
                            continue;
                        }
                    }
                }
                PropertyReference propertyReference8 = (PropertyReference)null;
                bool flag2 = false;
                if (pathStructureChange.NewSegmentIndex == PathStructureChange.StartPointIndex)
                {
                    propertyReference8 = propertyReference4.Append(PathElement.PathFigureStartPointProperty);
                    flag2 = true;
                }
                else if (pathStructureChange.NewSegmentIndex != PathStructureChange.DeletedPointIndex)
                {
                    ReferenceStep step2 = (ReferenceStep)IndexedClrPropertyReferenceStep.GetReferenceStep((IPlatformMetadata)this.platformMetadata, PlatformTypes.PathSegmentCollection, pathStructureChange.NewSegmentIndex);
                    propertyReference8 = propertyReference6.Append(step2);
                    if (pathStructureChange.NewPointProperty != null)
                    {
                        ReferenceStep step3 = (ReferenceStep)PathDiff.GetReferenceStepFromWpf(this.targetElement.DesignerContext, this.targetElement.Platform, pathStructureChange.NewPointProperty.OwnerType, pathStructureChange.NewPointProperty);
                        propertyReference8 = propertyReference8.Append(step3);
                        flag2 = true;
                    }
                    else if (pathStructureChange.OldSegmentIndex == PathStructureChange.StartPointIndex)
                    {
                        if (pathStructureChange.NewSegmentIndex < newGeometry.Figures[index2].Segments.Count)
                        {
                            propertyReference8 = propertyReference8.Append(this.LastPointProperty(newGeometry.Figures[index2].Segments[pathStructureChange.NewSegmentIndex]));
                            flag2 = true;
                        }
                        else
                        {
                            continue;
                        }
                    }
                }
                Dictionary <TimelineSceneNode, StoryboardTimelineSceneNode> toRemove2 = pathStructureChange.PathChangeType == PathChangeType.Move ? toRemove1 : (Dictionary <TimelineSceneNode, StoryboardTimelineSceneNode>)null;
                Dictionary <TimelineSceneNode, StoryboardTimelineSceneNode> toAdd     = pathStructureChange.PathChangeType == PathChangeType.InferSubdivision ? subdivisionProperties : dictionary1;
                if (pathStructureChange.NewSegmentIndex == PathStructureChange.DeletedPointIndex)
                {
                    this.RemoveAnimation(propertyReference7, toRemove1);
                }
                else if (pathStructureChange.NewSegmentIndex == PathStructureChange.StartPointIndex || pathStructureChange.OldSegmentIndex == PathStructureChange.StartPointIndex)
                {
                    this.ChangeAnimationProperty(propertyReference7, propertyReference8, toAdd, toRemove2);
                    if (pathStructureChange.NewSegmentIndex == PathStructureChange.StartPointIndex && pathStructureChange.NewSegmentIndex != pathStructureChange.OldSegmentIndex)
                    {
                        this.RemoveAnimation(propertyReference8, toRemove1);
                    }
                }
                else if (pathStructureChange.OldSegmentIndex >= 0 && pathStructureChange.OldSegmentIndex < oldGeometry.Figures[index1].Segments.Count && (pathStructureChange.NewSegmentIndex >= 0 && pathStructureChange.NewSegmentIndex < newGeometry.Figures[index2].Segments.Count))
                {
                    if (oldGeometry.Figures[index1].Segments[pathStructureChange.OldSegmentIndex].GetType() != newGeometry.Figures[index2].Segments[pathStructureChange.NewSegmentIndex].GetType())
                    {
                        if (!flag1)
                        {
                            propertyReference7 = propertyReference7.Append(this.LastPointProperty(oldGeometry.Figures[index1].Segments[pathStructureChange.OldSegmentIndex]));
                        }
                        if (!flag2)
                        {
                            propertyReference8 = propertyReference8.Append(this.LastPointProperty(newGeometry.Figures[index2].Segments[pathStructureChange.NewSegmentIndex]));
                        }
                        this.ChangeAnimationProperty(propertyReference7, propertyReference8, toAdd, toRemove2);
                        if (pathStructureChange.OldPointProperty == null && pathStructureChange.PathChangeType == PathChangeType.Move)
                        {
                            ReferenceStep step2 = (ReferenceStep)IndexedClrPropertyReferenceStep.GetReferenceStep((IPlatformMetadata)this.platformMetadata, PlatformTypes.PathSegmentCollection, pathStructureChange.OldSegmentIndex);
                            this.RemoveAnimation(propertyReference5.Append(step2), toRemove1);
                        }
                    }
                    else if (pathStructureChange.OldPointProperty == null && pathStructureChange.NewPointProperty == null)
                    {
                        this.ChangeAnimationProperty(propertyReference7, propertyReference8, toAdd, toRemove2, false);
                    }
                    else
                    {
                        if (!flag1)
                        {
                            propertyReference7 = propertyReference7.Append(this.LastPointProperty(oldGeometry.Figures[index1].Segments[pathStructureChange.OldSegmentIndex]));
                        }
                        if (!flag2)
                        {
                            propertyReference8 = propertyReference8.Append(this.LastPointProperty(newGeometry.Figures[index2].Segments[pathStructureChange.NewSegmentIndex]));
                        }
                        this.ChangeAnimationProperty(propertyReference7, propertyReference8, toAdd, toRemove2);
                    }
                }
            }
            if (action.Action == PathActionType.InsertPoint)
            {
                this.SubdivideSegment(oldGeometry, action.Figure, action.Segment, action.PointIndex, action.Parameter, subdivisionProperties);
            }
            foreach (KeyValuePair <TimelineSceneNode, StoryboardTimelineSceneNode> keyValuePair in toRemove1)
            {
                keyValuePair.Value.Children.Remove(keyValuePair.Key);
            }
            foreach (KeyValuePair <TimelineSceneNode, StoryboardTimelineSceneNode> keyValuePair in dictionary1)
            {
                keyValuePair.Value.Children.Add(keyValuePair.Key);
            }
            Dictionary <StoryboardTimelineSceneNode, HashSet <TimelineSceneNode.PropertyNodePair> > dictionary2 = new Dictionary <StoryboardTimelineSceneNode, HashSet <TimelineSceneNode.PropertyNodePair> >();

            foreach (KeyValuePair <TimelineSceneNode, StoryboardTimelineSceneNode> keyValuePair in subdivisionProperties)
            {
                HashSet <TimelineSceneNode.PropertyNodePair> hashSet = (HashSet <TimelineSceneNode.PropertyNodePair>)null;
                if (!dictionary2.TryGetValue(keyValuePair.Value, out hashSet))
                {
                    hashSet = new HashSet <TimelineSceneNode.PropertyNodePair>();
                    dictionary2[keyValuePair.Value] = hashSet;
                }
                if (!hashSet.Contains(keyValuePair.Key.TargetElementAndProperty))
                {
                    hashSet.Add(keyValuePair.Key.TargetElementAndProperty);
                    keyValuePair.Value.Children.Add(keyValuePair.Key);
                }
            }
        }
예제 #14
0
        private void UpdateProperties()
        {
            if (this.rotationAnglesProperty != null)
            {
                this.rotationAnglesProperty.OnRemoveFromCategory();
                this.rotationAnglesProperty = (PropertyReferenceProperty)null;
            }
            if (this.rotationProperty != null)
            {
                this.rotationProperty.PropertyReferenceChanged -= new Microsoft.Expression.DesignSurface.Documents.PropertyReferenceChangedEventHandler(this.OnRotationProperty_PropertyReferenceChanged);
                this.rotationProperty.OnRemoveFromCategory();
                this.rotationProperty = (PropertyReferenceProperty)null;
            }
            if (this.transformGroupRotationProperty != null)
            {
                this.transformGroupRotationProperty.PropertyReferenceChanged -= new Microsoft.Expression.DesignSurface.Documents.PropertyReferenceChangedEventHandler(this.OnRotationProperty_PropertyReferenceChanged);
                this.transformGroupRotationProperty.OnRemoveFromCategory();
                this.transformGroupRotationProperty = (PropertyReferenceProperty)null;
            }
            if (this.objectSet == null)
            {
                return;
            }
            IPlatform         platform           = this.objectSet.ProjectContext.Platform;
            PropertyReference propertyReference1 = new PropertyReference((ReferenceStep)platform.Metadata.GetProperty(platform.Metadata.DefaultTypeResolver, typeof(Transform3DGroup), MemberType.LocalProperty, "Children"), (ReferenceStep)IndexedClrPropertyReferenceStep.GetReferenceStep(platform.Metadata.DefaultTypeResolver, typeof(Transform3DCollection), CanonicalTransformOrder.RotateIndex));
            PropertyReference drotationReference = platform.Metadata.CommonProperties.RotateTransform3DRotationReference;
            ReferenceStep     step = (ReferenceStep)DesignTimeProperties.ResolveDesignTimeReferenceStep(DesignTimeProperties.EulerAnglesProperty, (IPlatformMetadata)platform.Metadata);
            PropertyReference propertyReference2 = platform.Metadata.CommonProperties.RotateTransform3DReference.Append(step);

            if (this.objectSet is SceneNodeObjectSet)
            {
                this.rotationAnglesReference = this.propertyReference.Append(propertyReference2);
                this.rotationReference       = this.propertyReference.Append(drotationReference);
                propertyReference1           = this.propertyReference.Append(propertyReference1);
            }
            else
            {
                this.rotationAnglesReference = propertyReference2;
                this.rotationReference       = drotationReference;
            }
            this.rotationAnglesProperty = this.objectSet.CreateProperty(this.rotationAnglesReference, (AttributeCollection)null);
            this.rotationProperty       = this.objectSet.CreateProperty(this.rotationReference, (AttributeCollection)null);
            this.rotationProperty.PropertyReferenceChanged += new Microsoft.Expression.DesignSurface.Documents.PropertyReferenceChangedEventHandler(this.OnRotationProperty_PropertyReferenceChanged);
            this.transformGroupRotationProperty             = this.objectSet.CreateProperty(propertyReference1, (AttributeCollection)null);
            this.transformGroupRotationProperty.PropertyReferenceChanged += new Microsoft.Expression.DesignSurface.Documents.PropertyReferenceChangedEventHandler(this.OnRotationProperty_PropertyReferenceChanged);
            this.OnPropertyChanged("EulerX");
            this.OnPropertyChanged("EulerY");
            this.OnPropertyChanged("EulerZ");
            this.OnPropertyChanged("OrientationFromEulerAngles");
        }
예제 #15
0
 public static PropertyReference PropertyReferenceFromVisual3D(Base3DElement item, PropertyReference propertyReference)
 {
     for (Base3DElement base3Delement = item.ParentElement as Base3DElement; base3Delement != null; base3Delement = item.ParentElement as Base3DElement)
     {
         if (base3Delement is ModelVisual3DElement)
         {
             if (item is Model3DElement)
             {
                 propertyReference = new PropertyReference((ReferenceStep)item.ProjectContext.ResolveProperty(ModelVisual3DElement.ContentProperty)).Append(propertyReference);
                 break;
             }
             break;
         }
         if (base3Delement is ModelUIElement3DElement)
         {
             if (item is Model3DElement)
             {
                 propertyReference = new PropertyReference((ReferenceStep)item.ProjectContext.ResolveProperty(ModelUIElement3DElement.ModelProperty)).Append(propertyReference);
                 break;
             }
             break;
         }
         int siteChildIndex = item.DocumentNode.SiteChildIndex;
         PropertyReference propertyReference1 = new PropertyReference((ReferenceStep)IndexedClrPropertyReferenceStep.GetReferenceStep((ITypeResolver)item.ProjectContext, typeof(Model3DCollection), siteChildIndex));
         propertyReference = new PropertyReference((ReferenceStep)item.ProjectContext.ResolveProperty(Model3DGroupElement.ChildrenProperty)).Append(propertyReference1).Append(propertyReference);
         item = base3Delement;
     }
     return(propertyReference);
 }
예제 #16
0
 private void SetFigureUsingMinimalDiff(PathFigure pathFigure, PathFigure currentFigure, PropertyReference figureReference)
 {
     if (!VectorUtilities.ArePathPointsVeryClose(currentFigure.StartPoint, pathFigure.StartPoint))
     {
         this.targetElement.SetValueAsWpf(figureReference.Append(PathElement.PathFigureStartPointProperty), (object)pathFigure.StartPoint);
     }
     for (int index = 0; index < pathFigure.Segments.Count; ++index)
     {
         PathSegment       currentSegment    = currentFigure.Segments[index];
         PathSegment       pathSegment       = pathFigure.Segments[index];
         PropertyReference segmentsReference = figureReference.Append(PathElement.PathFigureSegmentsProperty).Append((ReferenceStep)IndexedClrPropertyReferenceStep.GetReferenceStep((IPlatformMetadata)this.platformMetadata, PlatformTypes.PathSegmentCollection, index));
         this.SetSegmentUsingMinimalDiff(pathSegment, currentSegment, segmentsReference);
     }
 }
예제 #17
0
        public override void Draw(DrawingContext context, Matrix matrix)
        {
            if (this.Hidden || !this.ShouldDraw || !PlatformTypes.IsInstance(this.PlatformBrush, PlatformTypes.GradientBrush, (ITypeResolver)this.Element.ProjectContext))
            {
                return;
            }
            Matrix            matrix1            = this.GetCompleteBrushTransformMatrix(true) * matrix;
            PropertyReference propertyReference1 = this.AdornerSet.BrushPropertyReference.Append(GradientBrushNode.GradientStopsProperty);
            int   num1 = (int)this.Element.GetComputedValue(propertyReference1.Append(GradientStopCollectionNode.CountProperty));
            Point startPoint;
            Point endPoint;

            if (!this.GetBrushEndpoints(out startPoint, out endPoint) || this.Index < 0 || this.Index >= num1)
            {
                return;
            }
            PropertyReference propertyReference2 = propertyReference1.Append((ReferenceStep)IndexedClrPropertyReferenceStep.GetReferenceStep((IPlatformMetadata)this.Element.ViewModel.ProjectContext.Platform.Metadata, PlatformTypes.GradientStopCollection, this.Index));
            PropertyReference propertyReference3 = propertyReference2.Append(GradientStopNode.OffsetProperty);
            PropertyReference propertyReference4 = propertyReference2.Append(GradientStopNode.ColorProperty);
            double            num2 = (double)this.Element.GetComputedValue(propertyReference3);
            int    index           = this.DesignerContext.GradientToolSelectionService.Index;
            Point  point           = (endPoint - startPoint) * num2 + startPoint;
            double num3            = 3.5;
            Color  color           = (Color)this.Element.GetComputedValueAsWpf(propertyReference4);

            color.A = byte.MaxValue;
            SolidColorBrush solidColorBrush = new SolidColorBrush(color);
            Pen             pen             = this.ThinPen;

            if (index == this.Index)
            {
                pen  = this.ThickPen;
                num3 = 4.5;
            }
            context.DrawEllipse((Brush)Brushes.Transparent, (Pen)null, point * matrix1, num3 + 4.0, num3 + 4.0);
            context.DrawEllipse((Brush)solidColorBrush, pen, point * matrix1, num3, num3);
        }
예제 #18
0
        private PropertyReference CreatePropertyReference(int figureIndex, int segmentIndex)
        {
            PropertyReference propertyReference = new PropertyReference((ReferenceStep)this.platformMetadata.ResolveProperty((IPropertyId)this.pathProperty)).Append(PathElement.FiguresProperty).Append((ReferenceStep)IndexedClrPropertyReferenceStep.GetReferenceStep((IPlatformMetadata)this.platformMetadata, PlatformTypes.PathFigureCollection, figureIndex));

            if (segmentIndex == PathStructureChange.StartPointIndex)
            {
                return(propertyReference.Append(PathElement.PathFigureStartPointProperty));
            }
            return(propertyReference.Append(PathElement.PathFigureSegmentsProperty).Append((ReferenceStep)IndexedClrPropertyReferenceStep.GetReferenceStep((IPlatformMetadata)this.platformMetadata, PlatformTypes.PathSegmentCollection, segmentIndex)));
        }
예제 #19
0
 protected override bool OnDragEnd(Point dragStartPosition, Point dragEndPosition)
 {
     if (this.isDraggedOff)
     {
         PropertyReference propertyReference1 = this.GetBrushPropertyReference((SceneNode)this.EditingElement).Append(GradientBrushNode.GradientStopsProperty);
         PropertyReference propertyReference2 = propertyReference1.Append((ReferenceStep)IndexedClrPropertyReferenceStep.GetReferenceStep((IPlatformMetadata)this.ActiveView.ViewModel.ProjectContext.Platform.Metadata, PlatformTypes.GradientStopCollection, this.ActiveAdorner.Index));
         foreach (SceneElement sceneElement in this.ActiveView.ElementSelectionSet.Selection)
         {
             if (sceneElement.IsSet(propertyReference2) == PropertyState.Set)
             {
                 sceneElement.RemoveValueAt(propertyReference1, this.ActiveAdorner.Index);
             }
         }
         this.isDraggedOff = false;
     }
     if (this.HasMouseMovedAfterDown)
     {
         this.CommitEditTransaction();
     }
     this.isDragInterrupted = false;
     return(base.OnDragEnd(dragStartPosition, dragEndPosition));
 }
예제 #20
0
        private void UpdateTranslation()
        {
            SceneViewModel    viewModel          = this.ActiveView.ViewModel;
            PropertyReference propertyReference1 = this.GetBrushPropertyReference((SceneNode)this.EditingElement);

            if (propertyReference1 == null)
            {
                return;
            }
            Matrix matrixToAdornerLayer = this.ActiveAdorner.AdornerSet.GetTransformMatrixToAdornerLayer();

            this.EnsureEditTransaction();
            Point startPoint;
            Point endPoint;

            if (PlatformTypes.IsInstance(this.ActiveAdorner.PlatformBrush, PlatformTypes.GradientBrush, (ITypeResolver)this.EditingElement.ProjectContext) && this.ActiveAdorner.GetBrushEndpoints(out startPoint, out endPoint))
            {
                if (!this.HasMouseMovedAfterDown)
                {
                    this.CopyPrimaryBrushToSelection();
                }
                PropertyReference      propertyReference2     = propertyReference1.Append(GradientBrushNode.GradientStopsProperty);
                PropertyReference      propertyReference3     = propertyReference2.Append((ReferenceStep)IndexedClrPropertyReferenceStep.GetReferenceStep((IPlatformMetadata)viewModel.ProjectContext.Platform.Metadata, PlatformTypes.GradientStopCollection, this.ActiveAdorner.Index));
                PropertyReference      propertyReference4     = propertyReference3.Append(GradientStopNode.OffsetProperty);
                PropertyReference      propertyReference5     = propertyReference3.Append(GradientStopNode.ColorProperty);
                Matrix                 matrix                 = this.ActiveAdorner.GetCompleteBrushTransformMatrix(true) * this.ActiveView.GetComputedTransformToRoot(this.EditingElement);
                GradientStopCollection gradientStopCollection = (GradientStopCollection)this.EditingElement.GetComputedValueAsWpf(propertyReference2);
                GradientStop           gradientStop           = gradientStopCollection[this.ActiveAdorner.Index];
                Vector                 perpendicular;
                double                 num1   = GradientStopBehavior.VectorProjection(startPoint * matrix, endPoint * matrix, this.dragCurrentPosition, gradientStop.Offset, out perpendicular);
                double                 length = (perpendicular * matrixToAdornerLayer).Length;
                int index = this.ActiveAdorner.Index + 1;
                if (index >= gradientStopCollection.Count)
                {
                    index = this.ActiveAdorner.Index - 1;
                }
                if (length > 30.0 && !this.isDraggedOff && gradientStopCollection.Count > 2)
                {
                    this.isDraggedOff         = true;
                    this.ActiveAdorner.Hidden = true;
                    this.saveDraggedOffColor  = gradientStop.Color;
                    this.SetBrushValue(propertyReference5, (object)gradientStopCollection[index].Color);
                    this.SetBrushValue(propertyReference4, (object)gradientStopCollection[index].Offset);
                    this.Cursor = ToolCursors.MinusArrowCursor;
                }
                if (length <= 30.0 && this.isDraggedOff)
                {
                    this.isDraggedOff         = false;
                    this.ActiveAdorner.Hidden = false;
                    this.SetBrushValue(propertyReference5, (object)this.saveDraggedOffColor);
                    this.Cursor = this.ActiveAdorner.AdornerSet.GetCursor((IAdorner)this.ActiveAdorner);
                }
                if (!this.isDraggedOff)
                {
                    double num2 = RoundingHelper.RoundLength(gradientStop.Offset + num1);
                    if (num2 > 1.0)
                    {
                        num2 = 1.0;
                    }
                    else if (num2 < 0.0)
                    {
                        num2 = 0.0;
                    }
                    this.SetBrushValue(propertyReference4, (object)num2);
                }
                else
                {
                    this.SetBrushValue(propertyReference4, (object)gradientStopCollection[index].Offset);
                }
            }
            if (!this.HasMouseMovedAfterDown)
            {
                this.SetSelectedStopIndex(this.ActiveAdorner.Index);
            }
            this.UpdateEditTransaction();
        }
예제 #21
0
 protected override bool OnClickEnd(Point pointerPosition, int clickCount)
 {
     if (clickCount > 1)
     {
         PropertyReferenceProperty colorProperty = this.EditingElement.ViewModel.DesignerContext.PropertyInspectorModel.SceneNodeObjectSet.CreateProperty(this.GetBrushPropertyReference((SceneNode)this.EditingElement).Append(GradientBrushNode.GradientStopsProperty).Append((ReferenceStep)IndexedClrPropertyReferenceStep.GetReferenceStep((IPlatformMetadata)this.ActiveView.ViewModel.ProjectContext.Platform.Metadata, PlatformTypes.GradientStopCollection, this.ActiveAdorner.Index)).Append(GradientStopNode.ColorProperty), (AttributeCollection)null);
         this.CopyPrimaryBrushToSelection();
         GradientStopColorPopup gradientStopColorPopup = new GradientStopColorPopup(colorProperty, this.EditingElement.DesignerContext);
         gradientStopColorPopup.SynchronousClosed += (EventHandler)((sender, e) =>
         {
             colorProperty.OnRemoveFromCategory();
             this.CommitEditTransaction();
         });
         gradientStopColorPopup.IsOpen = true;
     }
     return(base.OnClickEnd(pointerPosition, clickCount));
 }
예제 #22
0
        public static void DeleteBehavior(BehaviorBaseNode node)
        {
            Stack <ReferenceStep> input   = new Stack <ReferenceStep>();
            SceneNode             parent1 = node.Parent;
            SceneNode             child1  = (SceneNode)node;

            while (true)
            {
                ReferenceStep referenceStep = (ReferenceStep)parent1.GetPropertyForChild(child1);
                if (parent1.IsCollectionProperty((IPropertyId)referenceStep))
                {
                    int index = parent1.GetCollectionForProperty((IPropertyId)referenceStep).IndexOf(child1);
                    input.Push((ReferenceStep)IndexedClrPropertyReferenceStep.GetReferenceStep((ITypeResolver)node.ProjectContext, (ITypeId)referenceStep.PropertyType, index));
                }
                input.Push(referenceStep);
                if (!(parent1 is SceneElement))
                {
                    child1  = parent1;
                    parent1 = parent1.Parent;
                }
                else
                {
                    break;
                }
            }
            SceneElement      sceneElement      = (SceneElement)parent1;
            SceneNode         parent2           = node.Parent;
            PropertyReference propertyReference = new PropertyReference(input);

            node.ViewModel.AnimationEditor.DeleteAllAnimations((SceneNode)sceneElement, propertyReference.ToString());
            SceneNode child2 = (SceneNode)node;
            int       num    = propertyReference.Count - 1;
            ISceneNodeCollection <SceneNode> collectionForChild;
            int endIndex;

            while (true)
            {
                SceneNode parent3 = child2.Parent;
                if (sceneElement != child2 && parent3 != null)
                {
                    ReferenceStep referenceStep = (ReferenceStep)parent3.GetPropertyForChild(child2);
                    collectionForChild = parent3.GetCollectionForChild(child2);
                    DocumentNodeHelper.PreserveFormatting(child2.DocumentNode);
                    endIndex = propertyReference.ReferenceSteps.IndexOf(referenceStep);
                    if (collectionForChild.Count == 1)
                    {
                        child2.Remove();
                        child2 = parent3;
                    }
                    else
                    {
                        goto label_10;
                    }
                }
                else
                {
                    break;
                }
            }
            sceneElement.ClearValue((IPropertyId)propertyReference.FirstStep);
            goto label_11;
label_10:
            int index1 = collectionForChild.IndexOf(child2);

            child2.ViewModel.AnimationEditor.ValidateAnimations((SceneNode)sceneElement, propertyReference.Subreference(0, endIndex), index1, false);
            child2.Remove();
label_11:
            node.ViewModel.Document.OnUpdatedEditTransaction();
        }
예제 #23
0
        public static DocumentNodePath ResolveValue(DocumentNodePath source, IList <IProperty> propertyPath, SceneNode referenceSource, int numberOfStepsToResolve, bool evaluateExpressions, bool visualTriggerOnly, BaseTriggerNode trigger, DocumentNodeResolver.ShouldUseTrigger shouldUseTrigger, out int stepsResolved)
        {
            if (source.Node is DocumentPrimitiveNode)
            {
                stepsResolved = 0;
                return(source);
            }
            List <DocumentNode> list1     = (List <DocumentNode>)null;
            List <IProperty>    list2     = (List <IProperty>)null;
            List <DocumentNode> list3     = (List <DocumentNode>)null;
            DocumentNode        childNode = source.Node;
            int index;

            for (index = 0; index < numberOfStepsToResolve; ++index)
            {
                IProperty             property1 = propertyPath[index];
                DocumentCompositeNode documentCompositeNode1 = childNode as DocumentCompositeNode;
                if (documentCompositeNode1 != null)
                {
                    DocumentNode documentNode1 = childNode;
                    IProperty    property2     = property1;
                    IndexedClrPropertyReferenceStep propertyReferenceStep = property1 as IndexedClrPropertyReferenceStep;
                    DocumentNode documentNode2;
                    if (propertyReferenceStep != null)
                    {
                        if (documentCompositeNode1.SupportsChildren && propertyReferenceStep.Index >= 0 && propertyReferenceStep.Index < documentCompositeNode1.Children.Count)
                        {
                            documentNode2 = documentCompositeNode1.Children[propertyReferenceStep.Index];
                        }
                        else
                        {
                            break;
                        }
                    }
                    else if (property1.TargetType != (Type)null && property1.TargetType.IsAssignableFrom(childNode.TargetType))
                    {
                        if (trigger != null && (shouldUseTrigger == null || shouldUseTrigger(trigger, (IPropertyId)property1)))
                        {
                            documentNode2 = trigger.GetDocumentNodeValue(documentCompositeNode1, (IPropertyId)property1, visualTriggerOnly);
                            if (documentNode2 != null)
                            {
                                documentNode1 = (DocumentNode)documentNode2.Parent;
                                property2     = documentNode2.SitePropertyKey;
                            }
                        }
                        else
                        {
                            documentNode2 = documentCompositeNode1.Properties[(IPropertyId)property1];
                        }
                    }
                    else
                    {
                        DocumentNodeReference documentNodeReference = (DocumentNodeReference)DocumentNodeResolver.CreateCompositeOrCollectionNodePropertyReference(referenceSource, documentCompositeNode1, (IPropertyId)property1, trigger, shouldUseTrigger, visualTriggerOnly);
                        documentNode2 = documentNodeReference != null ? documentNodeReference.Node : (DocumentNode)null;
                        if (documentNode2 != null)
                        {
                            documentNode1 = (DocumentNode)documentNode2.Parent;
                            property2     = documentNode2.SitePropertyKey;
                        }
                    }
                    bool flag = false;
                    if (documentNode2 != null && documentNode2.Type.IsExpression && evaluateExpressions)
                    {
                        DocumentNodePath context       = DocumentNodeResolver.RecreatePath(source, (IList <DocumentNode>)list1, (IList <DocumentNode>)list3, (IList <IProperty>)list2, documentNode2);
                        DocumentNode     documentNode3 = new ExpressionEvaluator((IDocumentRootResolver)documentNode2.Context).EvaluateExpression(context, documentNode2);
                        if (documentNode3 != null && documentNode3 != documentNode2)
                        {
                            flag          = true;
                            documentNode2 = documentNode3;
                        }
                    }
                    if (documentNode2 != null)
                    {
                        DocumentCompositeNode documentCompositeNode2 = documentNode2 as DocumentCompositeNode;
                        if ((flag || PlatformTypes.Style.IsAssignableFrom((ITypeId)property1.PropertyType) || PlatformTypes.FrameworkTemplate.IsAssignableFrom((ITypeId)property1.PropertyType)) && documentCompositeNode2 != null)
                        {
                            if (list1 == null)
                            {
                                list1 = new List <DocumentNode>();
                                list2 = new List <IProperty>();
                                list3 = new List <DocumentNode>();
                            }
                            list1.Add(documentNode2);
                            list3.Add(documentNode1);
                            list2.Add(property2);
                        }
                        childNode = documentNode2;
                    }
                    else
                    {
                        break;
                    }
                }
                else
                {
                    break;
                }
            }
            stepsResolved = index;
            if (stepsResolved == 0)
            {
                return(source);
            }
            return(DocumentNodeResolver.RecreatePath(source, (IList <DocumentNode>)list1, (IList <DocumentNode>)list3, (IList <IProperty>)list2, childNode));
        }
 private SceneNodeProperty CreatePropertyForIndex(int index)
 {
     return((SceneNodeProperty)this.objectSet.CreateProperty(new PropertyReference((ReferenceStep)IndexedClrPropertyReferenceStep.GetReferenceStep((ITypeResolver)this.objectSet.ViewModel.ProjectContext, this.parentProperty.PropertyType, index)), (AttributeCollection)null));
 }
예제 #25
0
        private BehaviorCommandCategory.PropertyEntryCollectionWrapper GetTriggerProperties(PropertyEntry triggerProperty)
        {
            BehaviorCommandCategory.PropertyEntryCollectionWrapper collectionWrapper = new BehaviorCommandCategory.PropertyEntryCollectionWrapper(triggerProperty.PropertyValue.SubProperties);
            SceneNodeProperty       sceneNodeProperty       = (SceneNodeProperty)triggerProperty;
            BehaviorTriggerBaseNode behaviorTriggerBaseNode = (BehaviorTriggerBaseNode)this.behaviorNode.GetLocalValueAsSceneNode(sceneNodeProperty.Reference);

            foreach (BehaviorTriggerActionNode triggerActionNode in (IEnumerable <SceneNode>)behaviorTriggerBaseNode.Actions)
            {
                if (ProjectNeutralTypes.InvokeCommandAction.IsAssignableFrom((ITypeId)triggerActionNode.Type) && ((InvokeCommandActionNode)triggerActionNode).CommandName.Equals(this.CategoryName, StringComparison.Ordinal))
                {
                    PropertyReference propertyReference = sceneNodeProperty.Reference.Append(BehaviorTriggerBaseNode.BehaviorActionsProperty).Append((ReferenceStep)IndexedClrPropertyReferenceStep.GetReferenceStep((ITypeResolver)triggerActionNode.ProjectContext, ProjectNeutralTypes.BehaviorTriggerActionCollection, behaviorTriggerBaseNode.Actions.IndexOf((SceneNode)triggerActionNode))).Append(InvokeCommandActionNode.CommandParameterProperty);
                    collectionWrapper.AddCustomProperty(sceneNodeProperty.SceneNodeObjectSet.CreateProperty(propertyReference, propertyReference.LastStep.Attributes));
                    break;
                }
            }
            return(collectionWrapper);
        }
예제 #26
0
        private void SubdivideSegment(PathGeometry oldGeometry, int figure, int segment, int pointIndex, double parameter, Dictionary <TimelineSceneNode, StoryboardTimelineSceneNode> subdivisionProperties)
        {
            PropertyReference propertyReference1 = new PropertyReference(this.pathProperty).Append(PathElement.FiguresProperty).Append((ReferenceStep)IndexedClrPropertyReferenceStep.GetReferenceStep((IPlatformMetadata)this.platformMetadata, PlatformTypes.PathFigureCollection, figure));
            PropertyReference propertyReference2 = propertyReference1.Append(PathElement.PathFigureSegmentsProperty);
            PropertyReference propertyReference3 = segment != oldGeometry.Figures[figure].Segments.Count ? propertyReference2.Append((ReferenceStep)IndexedClrPropertyReferenceStep.GetReferenceStep((IPlatformMetadata)this.platformMetadata, PlatformTypes.PathSegmentCollection, segment)) : propertyReference1.Append(PathElement.PathFigureStartPointProperty);
            PropertyReference propertyReference4;

            if (segment == 0)
            {
                propertyReference4 = propertyReference1.Append(PathElement.PathFigureStartPointProperty);
            }
            else
            {
                ReferenceStep step = (ReferenceStep)IndexedClrPropertyReferenceStep.GetReferenceStep((IPlatformMetadata)this.platformMetadata, PlatformTypes.PathSegmentCollection, segment - 1);
                propertyReference4 = propertyReference2.Append(step).Append(this.LastPointProperty(oldGeometry.Figures[figure].Segments[segment - 1]));
            }
            PropertyReference propertyReference5 = (PropertyReference)null;

            if (segment == oldGeometry.Figures[figure].Segments.Count - 1 && PathFigureUtilities.IsClosed(oldGeometry.Figures[figure]) && PathFigureUtilities.IsCloseSegmentDegenerate(oldGeometry.Figures[figure]))
            {
                propertyReference5 = propertyReference1.Append(PathElement.PathFigureStartPointProperty);
            }
            foreach (StoryboardTimelineSceneNode timelineSceneNode1 in this.targetElement.ViewModel.AnimationEditor.EnumerateStoryboardsForContainer(this.targetElement.StoryboardContainer))
            {
                Dictionary <double, List <KeyFrameSceneNode> > keyFrames1 = new Dictionary <double, List <KeyFrameSceneNode> >();
                foreach (KeyValuePair <TimelineSceneNode, StoryboardTimelineSceneNode> keyValuePair in subdivisionProperties)
                {
                    if (keyValuePair.Value == timelineSceneNode1)
                    {
                        KeyFrameAnimationSceneNode keyFrameNode = keyValuePair.Key as KeyFrameAnimationSceneNode;
                        if (keyFrameNode != null)
                        {
                            this.RecordKeyFrames(keyFrames1, keyFrameNode);
                        }
                    }
                }
                Dictionary <double, List <KeyFrameSceneNode> > keyFrames2 = new Dictionary <double, List <KeyFrameSceneNode> >();
                foreach (TimelineSceneNode timelineSceneNode2 in (IEnumerable <TimelineSceneNode>)timelineSceneNode1.Children)
                {
                    if (timelineSceneNode2.TargetElement == this.targetElement && timelineSceneNode2.TargetProperty != null && (propertyReference3.Equals((object)timelineSceneNode2.TargetProperty) || propertyReference3.IsPrefixOf(timelineSceneNode2.TargetProperty) || propertyReference4.Equals((object)timelineSceneNode2.TargetProperty) || propertyReference5 != null && propertyReference5.Equals((object)timelineSceneNode2.TargetProperty)))
                    {
                        KeyFrameAnimationSceneNode keyFrameNode = timelineSceneNode2 as KeyFrameAnimationSceneNode;
                        if (keyFrameNode != null)
                        {
                            this.RecordKeyFrames(keyFrames2, keyFrameNode);
                        }
                    }
                }
                foreach (KeyValuePair <double, List <KeyFrameSceneNode> > keyValuePair in keyFrames2)
                {
                    PathGeometry       path = oldGeometry.Clone();
                    PathGeometryEditor pathGeometryEditor = new PathGeometryEditor(path);
                    foreach (KeyFrameSceneNode keyFrameSceneNode in keyValuePair.Value)
                    {
                        PropertyReference propertyReference6 = this.targetElement.ViewModel.DefaultView.ConvertToWpfPropertyReference(keyFrameSceneNode.TargetProperty.Subreference(1));
                        object            valueToSet         = this.targetElement.ViewModel.DefaultView.ConvertToWpfValue(keyFrameSceneNode.Value);
                        propertyReference6.SetValue((object)path, valueToSet);
                    }
                    pathGeometryEditor.SubdivideSegment(figure, pointIndex, parameter);
                    List <KeyFrameSceneNode> list;
                    if (keyFrames1.TryGetValue(keyValuePair.Key, out list))
                    {
                        foreach (KeyFrameSceneNode keyFrameSceneNode in list)
                        {
                            object obj = this.targetElement.ViewModel.DefaultView.ConvertFromWpfValue(this.targetElement.ViewModel.DefaultView.ConvertToWpfPropertyReference(keyFrameSceneNode.TargetProperty.Subreference(1)).GetCurrentValue((object)path));
                            keyFrameSceneNode.Value = obj;
                        }
                    }
                }
            }
        }
예제 #27
0
        private static PropertyReference ResolvePropertyPathParts(ITypeResolver typeResolver, string path, Collection <object> parameters, SceneNode pathRoot)
        {
            if (path == "(0)")
            {
                if (parameters == null || parameters.Count == 0)
                {
                    return((PropertyReference)null);
                }
                DependencyProperty dependencyProperty = parameters[0] as DependencyProperty;
                if (dependencyProperty == null)
                {
                    return((PropertyReference)null);
                }
                Type targetType = pathRoot != null ? pathRoot.TargetType : dependencyProperty.OwnerType;
                DependencyPropertyReferenceStep referenceStep = DependencyPropertyReferenceStep.GetReferenceStep(typeResolver, targetType, dependencyProperty);
                if (referenceStep == null)
                {
                    return((PropertyReference)null);
                }
                return(new PropertyReference((ReferenceStep)referenceStep));
            }
            List <ReferenceStep> list = new List <ReferenceStep>();
            object obj = (object)null;

            if (typeResolver.IsCapabilitySet(PlatformCapability.SupportTypelessPropertyPath) && pathRoot != null && pathRoot.IsViewObjectValid)
            {
                obj = pathRoot.ViewObject.PlatformSpecificObject;
            }
            IType typeId = obj == null ? (pathRoot == null ? (parameters == null || parameters.Count <= 0 || !(parameters[0] is DependencyProperty) ? typeResolver.ResolveType(PlatformTypes.Object) : typeResolver.GetType(((DependencyProperty)parameters[0]).OwnerType)) : pathRoot.Type) : typeResolver.GetType(obj.GetType());

            for (int index1 = 0; index1 < path.Length; ++index1)
            {
                ReferenceStep referenceStep = (ReferenceStep)null;
                char          ch            = path[index1];
                switch (ch)
                {
                case '(':
                    int num1 = path.IndexOf(')', index1 + 1);
                    if (num1 < 0)
                    {
                        return((PropertyReference)null);
                    }
                    string s = path.Substring(index1 + 1, num1 - index1 - 1);
                    int    result1;
                    if (int.TryParse(s, out result1))
                    {
                        if (parameters == null || result1 < 0 || result1 >= parameters.Count)
                        {
                            return((PropertyReference)null);
                        }
                        DependencyProperty dependencyProperty = parameters[result1] as DependencyProperty;
                        if (dependencyProperty == null)
                        {
                            return((PropertyReference)null);
                        }
                        referenceStep = (ReferenceStep)DependencyPropertyReferenceStep.GetReferenceStep(typeResolver, typeId.NearestResolvedType.RuntimeType, dependencyProperty);
                        if (referenceStep == null)
                        {
                            PlatformTypes platformTypes = (PlatformTypes)typeResolver.PlatformMetadata;
                            Type          runtimeType   = typeId.NearestResolvedType.RuntimeType;
                            Type          ownerType     = dependencyProperty.OwnerType;
                            referenceStep = (ReferenceStep)(platformTypes.GetProperty(typeResolver, ownerType, MemberType.LocalProperty, dependencyProperty.Name) as DependencyPropertyReferenceStep);
                            if (referenceStep == null || !runtimeType.IsAssignableFrom(ownerType))
                            {
                                return((PropertyReference)null);
                            }
                        }
                    }
                    else
                    {
                        int    length = s.IndexOf('.');
                        string typeName;
                        if (length < 0)
                        {
                            if (!typeResolver.IsCapabilitySet(PlatformCapability.SupportTypelessPropertyPath))
                            {
                                return((PropertyReference)null);
                            }
                            typeName = typeId.Name;
                            length   = -1;
                        }
                        else
                        {
                            typeName = s.Substring(0, length);
                        }
                        string str = s.Substring(length + 1);
                        if (string.IsNullOrEmpty(typeName))
                        {
                            return((PropertyReference)null);
                        }
                        IType type = typeResolver.GetType((IXmlNamespace)typeResolver.GetCapabilityValue(PlatformCapability.DefaultXmlns), typeName);
                        if (type == null)
                        {
                            IProperty designTimeProperty = typeResolver.PlatformMetadata.GetDesignTimeProperty(str, (IType)null);
                            if (designTimeProperty != null && designTimeProperty.DeclaringType.Name == typeName)
                            {
                                referenceStep = (ReferenceStep)designTimeProperty;
                            }
                        }
                        if (referenceStep == null)
                        {
                            if (type == null)
                            {
                                type = typeId;
                            }
                            referenceStep = type.GetMember(MemberType.Property, str, MemberAccessTypes.Public) as ReferenceStep ?? TimelineSceneNode.ResolveReferenceStepFromValue(typeResolver, pathRoot, list, str);
                        }
                        if (referenceStep == null)
                        {
                            return((PropertyReference)null);
                        }
                    }
                    index1 = num1;
                    break;

                case '[':
                    int num2 = path.IndexOf(']', index1 + 1);
                    if (num2 < 0)
                    {
                        return((PropertyReference)null);
                    }
                    int result2;
                    if (!int.TryParse(path.Substring(index1 + 1, num2 - index1 - 1), out result2))
                    {
                        return((PropertyReference)null);
                    }
                    referenceStep = (ReferenceStep)IndexedClrPropertyReferenceStep.GetReferenceStep(typeResolver, typeId.RuntimeType, result2, false);
                    index1        = num2;
                    if (referenceStep == null)
                    {
                        return((PropertyReference)null);
                    }
                    break;

                default:
                    int startIndex = index1;
                    if ((int)ch == 46)
                    {
                        ++startIndex;
                    }
                    if (index1 >= path.Length - 1)
                    {
                        return((PropertyReference)null);
                    }
                    int index2 = index1 + 1;
                    if ((int)path[index2] != 40)
                    {
                        for (; index2 < path.Length; ++index2)
                        {
                            switch (path[index2])
                            {
                            case '.':
                            case '[':
                                goto label_52;

                            default:
                                goto default;
                            }
                        }
label_52:
                        if (index1 >= index2 - 1)
                        {
                            return((PropertyReference)null);
                        }
                        string str = path.Substring(startIndex, index2 - startIndex);
                        referenceStep = typeId.GetMember(MemberType.LocalProperty | MemberType.Field, str, TypeHelper.GetAllowableMemberAccess(typeResolver, typeId)) as ReferenceStep;
                        if (referenceStep == null)
                        {
                            referenceStep = TimelineSceneNode.ResolveReferenceStepFromValue(typeResolver, pathRoot, list, str);
                            if (referenceStep == null)
                            {
                                return((PropertyReference)null);
                            }
                        }
                        index1 = index2 - 1;
                        break;
                    }
                    break;
                }
                if (referenceStep != null)
                {
                    list.Add(referenceStep);
                    typeId = referenceStep.PropertyType;
                }
            }
            if (list == null || list.Count <= 0)
            {
                return((PropertyReference)null);
            }
            return(new PropertyReference(list));
        }