private void ToggleParentNodes(bool isSelected, INodeProxy nodeProxy) { foreach (Guid parentNodeId in nodeProxy.ParentNodes) { if (ParentNavigatorView.ContextNode.Id == parentNodeId) { continue; //a map node shouldn't really ever get in this situation where it is transcluded within itself } if (ParentNavigatorView.NodeRenderers.ContainsKey(parentNodeId)) { NodeRenderer nodeRenderer = ParentNavigatorView.NodeRenderers[parentNodeId]; if (!IsParentInCurrentView(nodeProxy, nodeRenderer.Node)) { continue; } nodeRenderer.IsSelected = isSelected; INodeProxy parentNode = nodeRenderer.Node; foreach (IDescriptorProxy descriptor in parentNode.Descriptors.GetByDescriptorTypeName("To")) { if (descriptor.Relationship.RelationshipType.Name != "MapContainerRelationship" && IsParentRelationship(descriptor.Relationship, nodeProxy.Id) && ParentNavigatorView.RelationshipRenderers.ContainsKey(descriptor.Relationship.Id)) { IRelationshipRenderer relationshipRenderer = ParentNavigatorView.RelationshipRenderers[descriptor.Relationship.Id]; relationshipRenderer.IsSelected = isSelected; } } if (isSelected) { SelectParentNodes(parentNode); } else { UnselectParentNodes(parentNode); } } } }
private void ToggleChildNodes(bool isSelected, INodeProxy nodeProxy) { foreach (Guid childNodeId in GetAllChildNodes(nodeProxy)) { if (ParentNavigatorView.NodeRenderers.ContainsKey(childNodeId)) { NodeRenderer nodeRenderer = ParentNavigatorView.NodeRenderers[childNodeId]; if (nodeProxy.IsTransclusion && !IsChildInCurrentView(nodeProxy, nodeRenderer.Node.Id)) { continue; } nodeRenderer.IsSelected = isSelected; INodeProxy childNode = nodeRenderer.Node; foreach (IDescriptorProxy descriptor in childNode.Descriptors.GetByDescriptorTypeName("From")) { if (descriptor.Relationship.RelationshipType.Name != "MapContainerRelationship" && IsChildRelationship(descriptor.Relationship, nodeProxy.Id) && ParentNavigatorView.RelationshipRenderers.ContainsKey(descriptor.Relationship.Id)) { IRelationshipRenderer relationshipRenderer = ParentNavigatorView.RelationshipRenderers[descriptor.Relationship.Id]; relationshipRenderer.IsSelected = isSelected; } } if (isSelected) { SelectChildNodes(childNode); } else { UnselectChildNodes(childNode); } } } }