示例#1
0
        public override DocumentNode GetLocalValueAsDocumentNode(SceneNodeProperty property, GetLocalValueFlags flags, out bool isMixed)
        {
            DocumentNode documentNode = (DocumentNode)null;
            bool         flag         = false;

            foreach (SceneNode sceneNode1 in this.Objects)
            {
                PropertyReference propertyReference1 = SceneNodeObjectSet.FilterProperty(sceneNode1, property.Reference);
                if (propertyReference1 != null)
                {
                    DocumentNode other = (DocumentNode)null;
                    if ((flags & GetLocalValueFlags.CheckKeyframes) != GetLocalValueFlags.None && sceneNode1.ViewModel.AnimationEditor.ActiveStoryboardTimeline != null && this.ShouldAllowAnimation)
                    {
                        SceneNode         ancestor           = (SceneNode)null;
                        PropertyReference propertyReference2 = propertyReference1;
                        SceneNode         sceneNode2         = sceneNode1;
                        if (this.FindAncestor(sceneNode1, out ancestor, ref propertyReference2, new Predicate <SceneNode>(SceneNodeObjectSetBase.IsAnimationParent)))
                        {
                            sceneNode2 = ancestor;
                        }
                        foreach (TimelineSceneNode timelineSceneNode in (IEnumerable <TimelineSceneNode>)sceneNode1.ViewModel.AnimationEditor.ActiveStoryboardTimeline.Children)
                        {
                            TimelineSceneNode.PropertyNodePair elementAndProperty = timelineSceneNode.TargetElementAndProperty;
                            if (elementAndProperty.SceneNode == sceneNode2 && elementAndProperty.PropertyReference != null)
                            {
                                PropertyReference propertyReference3 = SceneNodeObjectSet.FilterProperty(elementAndProperty.SceneNode, elementAndProperty.PropertyReference);
                                if (propertyReference2.Equals((object)propertyReference3))
                                {
                                    KeyFrameAnimationSceneNode animationSceneNode1 = timelineSceneNode as KeyFrameAnimationSceneNode;
                                    FromToAnimationSceneNode   animationSceneNode2 = timelineSceneNode as FromToAnimationSceneNode;
                                    if (animationSceneNode1 != null)
                                    {
                                        KeyFrameSceneNode keyFrameAtTime = animationSceneNode1.GetKeyFrameAtTime(sceneNode1.ViewModel.AnimationEditor.AnimationTime);
                                        if (keyFrameAtTime != null)
                                        {
                                            using ((flags & GetLocalValueFlags.Resolve) == GetLocalValueFlags.None ? this.ViewModel.ForceBaseValue() : (IDisposable)null)
                                            {
                                                other = keyFrameAtTime.ValueNode;
                                                break;
                                            }
                                        }
                                        else
                                        {
                                            break;
                                        }
                                    }
                                    else if (animationSceneNode2 != null)
                                    {
                                        double animationTime = sceneNode1.ViewModel.AnimationEditor.AnimationTime;
                                        using ((flags & GetLocalValueFlags.Resolve) == GetLocalValueFlags.None ? this.ViewModel.ForceBaseValue() : (IDisposable)null)
                                        {
                                            DocumentNodePath documentNodePath = (DocumentNodePath)null;
                                            if (animationTime == animationSceneNode2.Begin + animationSceneNode2.Duration)
                                            {
                                                documentNodePath = animationSceneNode2.GetLocalValueAsDocumentNode(animationSceneNode2.ToProperty);
                                            }
                                            else if (animationTime == animationSceneNode2.Begin)
                                            {
                                                documentNodePath = animationSceneNode2.GetLocalValueAsDocumentNode(animationSceneNode2.FromProperty);
                                            }
                                            other = documentNodePath != null ? documentNodePath.Node : (DocumentNode)null;
                                            break;
                                        }
                                    }
                                    else
                                    {
                                        break;
                                    }
                                }
                            }
                        }
                    }
                    if (other == null)
                    {
                        if ((flags & GetLocalValueFlags.Resolve) != GetLocalValueFlags.None)
                        {
                            DocumentNodePath valueAsDocumentNode = sceneNode1.GetLocalValueAsDocumentNode(propertyReference1);
                            if (valueAsDocumentNode != null)
                            {
                                other = valueAsDocumentNode.Node;
                            }
                        }
                        else
                        {
                            other = (DocumentNode)sceneNode1.GetLocalValue(propertyReference1, PropertyContext.AsDocumentNodes);
                        }
                    }
                    if (!flag)
                    {
                        if (other == null && (flags & GetLocalValueFlags.SkipCheckIfMixed) != GetLocalValueFlags.None)
                        {
                            isMixed = false;
                            return((DocumentNode)null);
                        }
                        flag         = true;
                        documentNode = other;
                    }
                    else if (documentNode == null && other != null || documentNode != null && !documentNode.Equals(other))
                    {
                        isMixed = true;
                        return((DocumentNode)null);
                    }
                }
            }
            isMixed = false;
            return(documentNode);
        }