public static SceneNode FindNode(SceneNode node, string name) { if (node != null) { DocumentNode byName = SceneElementHelper.FindByName(node.DocumentNode, name); if (byName != null) { return(node.ViewModel.GetSceneNode(byName)); } } return((SceneNode)null); }
public static bool ApplyProperties(SceneNode propertyTarget, Dictionary <IPropertyId, SceneNode> properties) { bool flag1 = true; foreach (KeyValuePair <IPropertyId, SceneNode> keyValuePair in properties) { IProperty propertyKey = (IProperty)keyValuePair.Key; SceneNode valueNode = keyValuePair.Value; ReferenceStep referenceStep = propertyKey as ReferenceStep; if (referenceStep != null) { ReferenceStep appliedReferenceStep; if (SceneElementHelper.DoesPropertyApply(propertyTarget, referenceStep, valueNode, out appliedReferenceStep)) { if (propertyTarget.IsSet((IPropertyId)appliedReferenceStep) == PropertyState.Unset) { propertyTarget.SetValueAsSceneNode((IPropertyId)appliedReferenceStep, valueNode); } else { flag1 = false; } } } else { bool flag2 = false; bool flag3 = true; DocumentCompositeNode documentCompositeNode = propertyTarget.DocumentNode as DocumentCompositeNode; if (documentCompositeNode != null) { flag2 = documentCompositeNode.Properties.Contains(propertyKey); ITypeId typeId = (ITypeId)documentCompositeNode.TypeResolver.GetType(propertyKey.TargetType); flag3 = typeId != null && typeId.IsAssignableFrom((ITypeId)documentCompositeNode.Type); } if (!flag2 && flag3) { propertyTarget.SetValueAsSceneNode((IPropertyId)propertyKey, valueNode); } else { flag1 = false; } } } return(flag1); }
public static Dictionary <IPropertyId, SceneNode> StoreProperties(SceneNode sourceNode, bool detachProperties) { return(SceneElementHelper.StoreProperties(sourceNode, (IEnumerable <IPropertyId>)null, detachProperties)); }