Пример #1
0
        private static IEnumerable <ReferenceStep> GetPropertiesForSceneNode(SceneNode node)
        {
            TextRangeElement textRange = node as TextRangeElement;

            if (textRange != null)
            {
                foreach (IPropertyId propertyId in textRange.RangeProperties)
                {
                    DependencyPropertyReferenceStep dp = node.ProjectContext.ResolveProperty(propertyId) as DependencyPropertyReferenceStep;
                    if (dp != null)
                    {
                        yield return((ReferenceStep)dp);
                    }
                }
            }
            else
            {
                foreach (IProperty property in ITypeExtensions.GetProperties(PropertyMerger.GetTypeFromSceneNode(node), MemberAccessTypes.Public, true))
                {
                    ReferenceStep referenceStep = property as ReferenceStep;
                    if (referenceStep != null)
                    {
                        DependencyPropertyReferenceStep dependencyPropertyReferenceStep = referenceStep as DependencyPropertyReferenceStep;
                        if (dependencyPropertyReferenceStep == null || !dependencyPropertyReferenceStep.IsAttachable)
                        {
                            yield return(referenceStep);
                        }
                    }
                }
            }
        }
Пример #2
0
        private void FireSelectivePropertyChangedEvents(SceneUpdatePhaseEventArgs args)
        {
            SceneNode[] selectedNodes = this.designerContext.SelectionManager.SelectedNodes;
            DocumentNodeMarkerSortedList markerSortedList;

            if (selectedNodes == null)
            {
                markerSortedList = new DocumentNodeMarkerSortedList();
            }
            else
            {
                markerSortedList = new DocumentNodeMarkerSortedList(selectedNodes.Length);
                foreach (SceneNode sceneNode in selectedNodes)
                {
                    TextRangeElement          textRangeElement  = sceneNode as TextRangeElement;
                    BehaviorTriggerActionNode triggerActionNode = sceneNode as BehaviorTriggerActionNode;
                    if (textRangeElement != null)
                    {
                        this.FireAllPropertyChangedEvents(args);
                        return;
                    }
                    if (triggerActionNode != null && triggerActionNode.Parent != null)
                    {
                        markerSortedList.Add(triggerActionNode.Parent.DocumentNode.Marker);
                    }
                    markerSortedList.Add(sceneNode.DocumentNode.Marker);
                }
            }
            foreach (DocumentNodeChange documentNodeChange in args.DocumentChanges.DistinctChanges)
            {
                if (SceneView.HandleAnimationChanges(args.ViewModel, documentNodeChange, new SceneView.HandleAnimationChange(this.InvalidatePropertyFromAnimationChange)) == SceneView.AnimationChangeResult.InvalidateAll)
                {
                    this.FireAllPropertyChangedEvents(args);
                    return;
                }
            }
            if (this.designerContext.SelectionManager.SecondarySelectedNodes != null)
            {
                foreach (SceneNode sceneNode in this.designerContext.SelectionManager.SecondarySelectedNodes)
                {
                    if (sceneNode.DocumentNode.Marker != null)
                    {
                        markerSortedList.Add(sceneNode.DocumentNode.Marker);
                    }
                }
            }
            foreach (DocumentNodeMarkerSortedListBase.IntersectionResult intersectionResult in args.DocumentChanges.Intersect((DocumentNodeMarkerSortedListBase)markerSortedList, DocumentNodeMarkerSortedListBase.Flags.ContainedBy))
            {
                Stack <ReferenceStep> input = DocumentNodeMarkerUtilities.PropertyReferencePath(args.DocumentChanges.MarkerAt(intersectionResult.LeftHandSideIndex), markerSortedList.MarkerAt(intersectionResult.RightHandSideIndex));
                if (input.Count > 0)
                {
                    PropertyReference propertyReference1 = new PropertyReference(input);
                    this.AddPropertyReferenceToSortedList(propertyReference1, this.changedPropertyReferences);
                    if (PlatformTypes.Style.IsAssignableFrom(propertyReference1.FirstStep.DeclaringTypeId))
                    {
                        int startIndex;
                        for (startIndex = 0; startIndex < propertyReference1.Count; ++startIndex)
                        {
                            if (PlatformTypes.Setter.IsAssignableFrom(propertyReference1.ReferenceSteps[startIndex].DeclaringTypeId))
                            {
                                ++startIndex;
                                break;
                            }
                        }
                        foreach (SceneChange sceneChange in SceneChange.ChangesOfType <SceneChange>(args.DocumentChanges, args.ViewModel.RootNode))
                        {
                            PropertyReferenceSceneChange referenceSceneChange = sceneChange as PropertyReferenceSceneChange;
                            if (referenceSceneChange != null && referenceSceneChange.PropertyChanged != null)
                            {
                                PropertyReference propertyReference2 = referenceSceneChange.PropertyChanged.Subreference(0);
                                if (startIndex < propertyReference1.Count)
                                {
                                    propertyReference2 = propertyReference2.Append(propertyReference1.Subreference(startIndex));
                                }
                                this.AddPropertyReferenceToSortedList(propertyReference2, this.changedPropertyReferences);
                            }
                        }
                    }
                }
            }
            this.FireSelectivePropertyChangedEventsWorker(args.DirtyViewState);
        }