Beispiel #1
0
 public void ApplyAmbientProperties(SceneNode node)
 {
     if (node == null || !Enumerable.Any <ITypeId>((IEnumerable <ITypeId>)AmbientPropertyManager.SupportedTypes, (Func <ITypeId, bool>)(type => type.IsAssignableFrom((ITypeId)node.Type))) || this.suppressApplyCount > 0)
     {
         return;
     }
     foreach (ReferenceStep referenceStep in this.GetResolvedAmbientProperties())
     {
         bool strictTypeCheck = true;
         PropertyReference propertyReference = SceneNodeObjectSet.FilterProperty(node, new PropertyReference(referenceStep), strictTypeCheck);
         if (propertyReference != null)
         {
             object       valueToSet    = this.InternalGetAmbientValue(referenceStep, node);
             DocumentNode documentNode1 = valueToSet as DocumentNode;
             if (documentNode1 != null)
             {
                 DocumentNode          documentNode2         = documentNode1.Clone(node.DocumentContext);
                 DocumentCompositeNode documentCompositeNode = documentNode2 as DocumentCompositeNode;
                 if (documentCompositeNode != null)
                 {
                     documentCompositeNode.ClearValue((IPropertyId)documentCompositeNode.Type.Metadata.NameProperty);
                 }
                 foreach (DocumentNode documentNode3 in documentNode2.SelectDescendantNodes((Predicate <DocumentNode>)(nodePredicate => nodePredicate.Parent.IsNameProperty((IPropertyId)nodePredicate.SitePropertyKey))))
                 {
                     documentNode3.Parent.ClearValue((IPropertyId)documentNode3.SitePropertyKey);
                 }
                 valueToSet = (object)documentNode2;
             }
             if (valueToSet == DependencyProperty.UnsetValue)
             {
                 node.ClearValueAsWpf(propertyReference);
             }
             else
             {
                 node.SetValueAsWpf(propertyReference, valueToSet);
             }
         }
     }
 }