Ejemplo n.º 1
0
        internal static PropertyReference FilterProperty(ITypeResolver typeResolver, IType type, PropertyReference propertyReference)
        {
            ReferenceStep referenceStep = propertyReference[0];
            ReferenceStep filteredStep  = SceneNodeObjectSet.FilterProperty(typeResolver, type, referenceStep);

            return(SceneNodeObjectSet.UpdatePropertyReference(propertyReference, referenceStep, filteredStep));
        }
Ejemplo n.º 2
0
        internal static PropertyReference FilterProperty(SceneNode node, PropertyReference propertyReference)
        {
            ReferenceStep referenceStep = propertyReference[0];
            ReferenceStep filteredStep  = SceneNodeObjectSet.FilterProperty(node, referenceStep);

            return(SceneNodeObjectSet.UpdatePropertyReference(propertyReference, referenceStep, filteredStep));
        }
Ejemplo n.º 3
0
        public override object GetValue(PropertyReference propertyReference, PropertyReference.GetValueFlags getValueFlags)
        {
            object second = null;
            bool   flag   = false;

            foreach (SceneNode sceneNode in this.Objects)
            {
                PropertyReference propertyReference1 = SceneNodeObjectSet.FilterProperty(sceneNode, propertyReference);
                if (propertyReference1 != null)
                {
                    object first;
                    if ((getValueFlags & PropertyReference.GetValueFlags.Computed) != PropertyReference.GetValueFlags.Local)
                    {
                        if (SceneNodeObjectSetBase.IsValidForGetComputedValue(sceneNode))
                        {
                            first = sceneNode.GetComputedValue(propertyReference1);
                        }
                        else
                        {
                            SceneNode         ancestor           = (SceneNode)null;
                            PropertyReference propertyReference2 = propertyReference1;
                            first = !this.ShouldWalkParentsForGetValue || !this.FindAncestor(sceneNode, out ancestor, ref propertyReference2, new Predicate <SceneNode>(SceneNodeObjectSetBase.IsValidForGetComputedValue)) ? sceneNode.GetLocalOrDefaultValue(propertyReference1) : ancestor.GetComputedValue(propertyReference2);
                        }
                    }
                    else
                    {
                        first = sceneNode.GetLocalOrDefaultValue(propertyReference1);
                    }
                    if (!flag)
                    {
                        second = first;
                        flag   = true;
                    }
                    else if (!PropertyUtilities.Compare(first, second, sceneNode.ViewModel.DefaultView))
                    {
                        second = MixedProperty.Mixed;
                        break;
                    }
                }
            }
            if (!flag)
            {
                ReferenceStep referenceStep = propertyReference[propertyReference.Count - 1];
                if (this.designerContext.ActiveView != null)
                {
                    second = referenceStep.GetDefaultValue(referenceStep.TargetType);
                }
            }
            return(second);
        }
Ejemplo n.º 4
0
        internal static PropertyReference FilterProperty(SceneNode node, PropertyReference propertyReference, bool strictTypeCheck)
        {
            PropertyReference propertyReference1 = SceneNodeObjectSet.FilterProperty(node, propertyReference);

            if (strictTypeCheck && propertyReference1 != null && (propertyReference1.LastStep.MemberType & MemberType.LocalProperty) != MemberType.None)
            {
                IType type = node.ProjectContext.GetType(propertyReference.LastStep.TargetType);
                if (type == null || propertyReference1.LastStep.DeclaringType.PlatformMetadata != type.PlatformMetadata || !propertyReference1.LastStep.DeclaringType.IsAssignableFrom((ITypeId)type))
                {
                    propertyReference1 = (PropertyReference)null;
                }
            }
            return(propertyReference1);
        }
Ejemplo n.º 5
0
        protected override void ModifyValue(PropertyReferenceProperty property, object valueToSet, Modification modification, int index)
        {
            if (this.ViewModel == null)
            {
                return;
            }
            string description = string.Format((IFormatProvider)CultureInfo.CurrentCulture, StringTable.PropertyChangeUndoDescription, new object[1]
            {
                (object)((PropertyEntry)property).get_PropertyName()
            });

            if (!this.ViewModel.DefaultView.Document.IsEditable)
            {
                return;
            }
            using (SceneEditTransaction editTransaction = this.ViewModel.CreateEditTransaction(description, false, SceneEditTransactionType.NestedInAutoClosing))
            {
                try
                {
                    foreach (SceneNode sceneNode1 in this.Objects)
                    {
                        PropertyReference propertyReference1 = SceneNodeObjectSet.FilterProperty(sceneNode1, property.Reference);
                        if (propertyReference1 != null)
                        {
                            SceneNode sceneNode2 = sceneNode1;
                            if (this.ShouldAllowAnimation)
                            {
                                SceneNode         ancestor           = (SceneNode)null;
                                PropertyReference propertyReference2 = propertyReference1;
                                if (this.FindAncestor(sceneNode1, out ancestor, ref propertyReference2, new Predicate <SceneNode>(SceneNodeObjectSetBase.IsAnimationParent)))
                                {
                                    sceneNode2         = ancestor;
                                    propertyReference1 = propertyReference2;
                                }
                            }
                            using (SceneNode.DisableEnsureTransform(PlatformTypes.TransformGroup.IsAssignableFrom((ITypeId)propertyReference1.LastStep.DeclaringType)))
                            {
                                if (modification == Modification.InsertValue)
                                {
                                    sceneNode2.InsertValue(propertyReference1, index, valueToSet);
                                }
                                else if (modification == Modification.ClearValue)
                                {
                                    this.ClearAnimations(sceneNode2, propertyReference1);
                                    sceneNode2.ClearValue(propertyReference1);
                                }
                                else if (modification == Modification.RemoveValue)
                                {
                                    SceneElement element = sceneNode2.GetLocalValueAsSceneNode(propertyReference1).GetChildren()[index] as SceneElement;
                                    if (element != null)
                                    {
                                        element.ViewModel.AnimationEditor.DeleteAllAnimationsInSubtree(element);
                                    }
                                    sceneNode2.RemoveValueAt(propertyReference1, index);
                                }
                                else if (modification == Modification.SetValue)
                                {
                                    this.ClearAnimations(sceneNode2, propertyReference1);
                                    using (LayoutRoundingHelper.IsUseLayoutRoundingProperty(sceneNode2, (IProperty)propertyReference1.LastStep) ? sceneNode2.ViewModel.ForceDefaultSetValue() : (IDisposable)null)
                                        sceneNode2.SetValue(propertyReference1, valueToSet);
                                }
                                LayoutRoundingHelper.ExplicitlyChangeLayoutRounding(sceneNode2, propertyReference1);
                            }
                        }
                    }
                    editTransaction.Commit();
                }
                catch (Exception ex)
                {
                    if (editTransaction != null)
                    {
                        editTransaction.Cancel();
                    }
                    int num = (int)this.DesignerContext.MessageDisplayService.ShowMessage(new MessageBoxArgs()
                    {
                        Message = StringTable.InvalidPropertyValueErrorNoException,
                        Button  = MessageBoxButton.OK,
                        Image   = MessageBoxImage.Hand
                    });
                }
            }
            this.TransactionContext.UpdateTransaction();
        }
Ejemplo n.º 6
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);
        }