Esempio n. 1
0
        public override void Repair(DocumentNode node)
        {
            DocumentCompositeNode compositeNode = node as DocumentCompositeNode;
            IType codeBehindClass = this.stateNameChangeModel.ChangedNode.ViewModel.XamlDocument.CodeBehindClass;

            if (compositeNode == null)
            {
                return;
            }
            string       valueAsString = compositeNode.GetValueAsString(this.referentialProperty);
            DocumentNode targetElement = GoToStateActionNode.FindTargetElement(node, false);

            if (targetElement == null || !(this.stateNameChangeModel.OldReferenceValue == valueAsString))
            {
                return;
            }
            if (targetElement.DocumentRoot.CodeBehindClass == null && codeBehindClass == null || targetElement.DocumentRoot.CodeBehindClass.Equals((object)codeBehindClass) && targetElement.DocumentRoot.RootNode == this.stateNameChangeModel.ChangedNode.DocumentNode.DocumentRoot.RootNode)
            {
                this.stateNameChangeModel.NodesForLocalUpdate.Add((ChangedNodeInfo) new ChangedStateNameNodeInfo(compositeNode, this.referentialProperty));
            }
            else
            {
                if (codeBehindClass == null || !targetElement.Type.IsAssignableFrom((ITypeId)codeBehindClass))
                {
                    return;
                }
                this.stateNameChangeModel.NodesForExternalUpdate.Add((ChangedNodeInfo) new ChangedStateNameNodeInfo(compositeNode, this.referentialProperty));
            }
        }
        protected override string GetNameToValidate(DocumentCompositeNode compositeNode)
        {
            DocumentCompositeNode node = this.GetReferentialPropertyValueAsDocumentNode(compositeNode) as DocumentCompositeNode;

            if (node != null && BindingObjectReferenceVerifier.IsSupportedValue(node))
            {
                return(node.GetValueAsString(BindingSceneNode.ElementNameProperty));
            }
            return((string)null);
        }
Esempio n. 3
0
 protected override void ProcessDocument(SceneDocument document)
 {
     foreach (DocumentNode documentNode in document.DocumentRoot.RootNode.SelectDescendantNodes(ProjectNeutralTypes.VisualState))
     {
         DocumentCompositeNode documentCompositeNode = documentNode as DocumentCompositeNode;
         if (documentCompositeNode != null)
         {
             string valueAsString = documentCompositeNode.GetValueAsString((IPropertyId)documentCompositeNode.NameProperty);
             this.AddStateName((DocumentNode)documentCompositeNode, valueAsString);
         }
     }
 }
Esempio n. 4
0
        protected bool IsExplicitKeyframe(DocumentCompositeNode compositeNode)
        {
            bool flag;
            DocumentCompositeNode item;

            if (PlatformTypes.DoubleAnimationUsingKeyFrames.IsAssignableFrom(compositeNode.Type))
            {
                DocumentCompositeNode documentCompositeNode = compositeNode.Properties[KnownProperties.StoryboardTargetPropertyProperty] as DocumentCompositeNode;
                if (documentCompositeNode != null && PlatformTypes.PropertyPath.IsAssignableFrom(documentCompositeNode.Type))
                {
                    IProperty property = compositeNode.TypeResolver.ResolveProperty(compositeNode.TypeResolver.PlatformMetadata.KnownProperties.PropertyPathPathParameters);
                    if (property != null)
                    {
                        item = documentCompositeNode.Properties[property] as DocumentCompositeNode;
                    }
                    else
                    {
                        item = null;
                    }
                    DocumentCompositeNode documentCompositeNode1 = item;
                    if (documentCompositeNode1 == null || documentCompositeNode1.Children.Count <= 0)
                    {
                        string valueAsString = documentCompositeNode.GetValueAsString(documentCompositeNode.TypeResolver.PlatformMetadata.KnownProperties.PropertyPathPath);
                        if (valueAsString != null)
                        {
                            return(valueAsString.Contains(DesignTimeProperties.ExplicitAnimationPropertyName));
                        }
                    }
                    else
                    {
                        using (IEnumerator <DocumentNode> enumerator = documentCompositeNode1.Children.GetEnumerator())
                        {
                            while (enumerator.MoveNext())
                            {
                                if (!this.IsExplicitAnimationProperty(enumerator.Current))
                                {
                                    continue;
                                }
                                flag = true;
                                return(flag);
                            }
                            return(false);
                        }
                        return(flag);
                    }
                }
            }
            return(false);
        }
Esempio n. 5
0
        private static DocumentNode ResolveTargetFromBinding(DocumentNode actionNode, DocumentCompositeNode bindingNode)
        {
            string valueAsString = bindingNode.GetValueAsString(BindingSceneNode.ElementNameProperty);

            return(BehaviorHelper.FindNamedElement(actionNode, valueAsString));
        }
Esempio n. 6
0
        public static DocumentNode FindTargetElement(DocumentNode node, bool resolveTargetName)
        {
            DocumentCompositeNode documentCompositeNode1 = node as DocumentCompositeNode;

            if (documentCompositeNode1 != null)
            {
                DocumentNode documentNode1 = documentCompositeNode1.Properties[BehaviorTargetedTriggerActionNode.BehaviorTargetNameProperty];
                string       elementName   = !resolveTargetName || documentNode1 == null || !DocumentNodeUtilities.IsResource(documentNode1) ? documentCompositeNode1.GetValueAsString(BehaviorTargetedTriggerActionNode.BehaviorTargetNameProperty) : DocumentPrimitiveNode.GetValueAsString(ExpressionEvaluator.EvaluateExpression(documentNode1));
                IProperty    property1     = node.PlatformMetadata.ResolveProperty(BehaviorTargetedTriggerActionNode.BehaviorTargetObjectProperty);
                if (property1 != null)
                {
                    DocumentNode documentNode2 = documentCompositeNode1.Properties[(IPropertyId)property1];
                    if (documentNode2 != null)
                    {
                        if (DocumentNodeUtilities.IsMarkupExtension(documentNode2))
                        {
                            if (!DocumentNodeUtilities.IsBinding(documentNode2) || !GoToStateActionNode.CanResolveTargetFromBinding(documentNode2))
                            {
                                return(ExpressionEvaluator.EvaluateExpression(documentNode2));
                            }
                            documentNode2 = GoToStateActionNode.ResolveTargetFromBinding(node, (DocumentCompositeNode)documentNode2);
                        }
                        return(documentNode2);
                    }
                }
                if (!string.IsNullOrEmpty(elementName))
                {
                    return(BehaviorHelper.FindNamedElement(node, elementName));
                }
                DocumentNode documentNode3;
                for (documentNode3 = (DocumentNode)documentCompositeNode1; documentNode3 != null; documentNode3 = (DocumentNode)documentNode3.Parent)
                {
                    DocumentCompositeNode documentCompositeNode2 = documentNode3 as DocumentCompositeNode;
                    IProperty             property2 = node.TypeResolver.ResolveProperty(VisualStateManagerSceneNode.VisualStateGroupsProperty);
                    if (property2 == null)
                    {
                        return((DocumentNode)null);
                    }
                    if (documentCompositeNode2 != null && documentCompositeNode2.Properties[(IPropertyId)property2] != null)
                    {
                        break;
                    }
                }
                if (documentNode3 != null)
                {
                    DocumentCompositeNode parent = documentNode3.Parent;
                    if (parent != null && PlatformTypes.ICollection.IsAssignableFrom((ITypeId)parent.Type) && parent.Parent != null)
                    {
                        return((DocumentNode)parent.Parent);
                    }
                    return((DocumentNode)documentNode3.Parent);
                }
            }
            return((DocumentNode)null);
        }