コード例 #1
0
ファイル: BehaviorHelper.cs プロジェクト: radtek/Shopdrawing
 public static DocumentNode FindNamedElement(DocumentNode behaviorNode, string elementName)
 {
     if (!string.IsNullOrEmpty(elementName))
     {
         DocumentNodeNameScope containingNameScope = behaviorNode.FindContainingNameScope();
         if (containingNameScope == null)
         {
             return((DocumentNode)null);
         }
         DocumentNode node = containingNameScope.FindNode(elementName);
         if (node != null)
         {
             return(node);
         }
     }
     else
     {
         if (ProjectNeutralTypes.BehaviorTriggerAction.IsAssignableFrom((ITypeId)behaviorNode.Type))
         {
             return(BehaviorHelper.ValidateNodeTypeAndGetParent(BehaviorHelper.ValidateNodeTypeAndGetParent(BehaviorHelper.ValidateNodeTypeAndGetParent((DocumentNode)behaviorNode.Parent, ProjectNeutralTypes.BehaviorTriggerActionCollection), ProjectNeutralTypes.BehaviorTriggerBase), ProjectNeutralTypes.BehaviorTriggerCollection));
         }
         if (ProjectNeutralTypes.BehaviorTriggerBase.IsAssignableFrom((ITypeId)behaviorNode.Type))
         {
             return(BehaviorHelper.ValidateNodeTypeAndGetParent((DocumentNode)behaviorNode.Parent, ProjectNeutralTypes.BehaviorTriggerCollection));
         }
     }
     return((DocumentNode)null);
 }
コード例 #2
0
        private static ElementDataSourceInfo GetElementNameBinding(DocumentCompositeNode bindingNode)
        {
            DocumentNode node = bindingNode.Properties[BindingSceneNode.ElementNameProperty];

            if (node == null)
            {
                return((ElementDataSourceInfo)null);
            }
            string valueAsString = DocumentPrimitiveNode.GetValueAsString(node);

            if (string.IsNullOrEmpty(valueAsString))
            {
                return(ElementDataSourceInfo.Invalid);
            }
            DocumentCompositeNode namedElement = node.FindContainingNameScope().FindNode(valueAsString) as DocumentCompositeNode;

            if (namedElement == null)
            {
                return(ElementDataSourceInfo.Invalid);
            }
            string bindingPath = DataContextHelper.GetBindingPath(bindingNode);

            return(new ElementDataSourceInfo(namedElement, bindingPath));
        }
コード例 #3
0
        private bool AppliesToImpl(DocumentNode node)
        {
            DocumentNodeNameScope documentNodeNameScope = node.NameScope != null ? node.NameScope : node.FindContainingNameScope();

            if (this.ReferentialType.IsAssignableFrom((ITypeId)node.Type) && documentNodeNameScope.Equals((object)this.NameChangeModel.NameScope))
            {
                return(((DocumentCompositeNode)node).GetValueAsString(this.ReferentialProperty) == this.NameChangeModel.OldReferenceValue);
            }
            return(false);
        }
コード例 #4
0
 public static DocumentNode FindByName(DocumentNode node, string name)
 {
     return((node.NameScope != null ? node.NameScope : node.FindContainingNameScope()).FindNode(name));
 }
コード例 #5
0
        public override sealed bool Verify(DocumentNode node)
        {
            string nameToValidate = this.GetNameToValidate((DocumentCompositeNode)node);

            return(!string.IsNullOrEmpty(nameToValidate) && node.FindContainingNameScope().FindNode(nameToValidate) != null);
        }