private static bool CompareNodePaths(DocumentNodePath stored, DocumentNodePath fromViewNodeTree) { if (stored == fromViewNodeTree) { return(true); } if (stored.Count != fromViewNodeTree.Count && stored.Count + 1 != fromViewNodeTree.Count) { return(false); } int num = 0; int num1 = 0; while (num < stored.Count && num1 < fromViewNodeTree.Count) { NodePathEntry item = stored[num]; NodePathEntry nodePathEntry = fromViewNodeTree[num1]; if (!item.Equals(nodePathEntry)) { if (item.Container != nodePathEntry.Container || num1 + 1 >= fromViewNodeTree.Count || item.Target != fromViewNodeTree[num1 + 1].Target) { return(false); } num1++; } num1++; num++; } if (num != stored.Count) { return(false); } return(num1 == fromViewNodeTree.Count); }
public bool MoveTo(DocumentCompositeNode targetNode, IProperty targetProperty, bool makeCurrent) { if (targetNode == this.CurrentNode) { this.moveToNode = targetNode; this.moveToProperty = targetProperty; if (makeCurrent) { return(this.MoveNext()); } return(true); } if (this.currentIndex < 0) { this.currentIndex = 0; } for (; this.currentIndex < this.dataContextPath.Count; ++this.currentIndex) { NodePathEntry nodePathEntry = this.dataContextPath[this.currentIndex]; if (nodePathEntry.Container == null || nodePathEntry.Container.IsAncestorOf((DocumentNode)targetNode)) { this.moveToNode = targetNode; this.moveToProperty = targetProperty; if (makeCurrent) { return(this.MoveNext()); } return(true); } } return(false); }
private bool ScopeOut() { if (this.currentIndex >= this.dataContextPath.Count - 1) { return(false); } ++this.currentIndex; NodePathEntry nodePathEntry = this.dataContextPath[this.currentIndex]; this.currentNode = (DocumentCompositeNode)nodePathEntry.Target; this.currentProperty = nodePathEntry.PropertyKey; return(true); }
private DocumentNodePath InitializePath(SceneNode targetNode, IProperty targetProperty) { List <NodePathEntry> list = new List <NodePathEntry>(); List <EditContext> editContextChain = this.GetEditContextChain(targetNode.ViewModel); if (editContextChain.Count == 0) { return(new DocumentNodePath((IEnumerable <NodePathEntry>)list)); } DocumentNodePath editingContainerPath1 = editContextChain[editContextChain.Count - 1].EditingContainerPath; DocumentCompositeNode documentCompositeNode = targetNode.DocumentNode as DocumentCompositeNode; NodePathEntry nodePathEntry; if (documentCompositeNode != null) { nodePathEntry = new NodePathEntry(targetProperty, editingContainerPath1.ContainerNode, (DocumentNode)documentCompositeNode); list.Add(nodePathEntry); } for (int index = editContextChain.Count - 2; index >= 0; --index) { EditContext editContext1 = editContextChain[index]; EditContext editContext2 = editContextChain[index + 1]; if (editContext2.ParentElement != null && editContext2.ParentElement.PropertyKey != null) { DocumentNodePath nodePath = editContext2.ParentElement.NodePath; nodePathEntry = new NodePathEntry((IProperty)editContext2.ParentElement.PropertyKey, nodePath.ContainerNode, nodePath.Node); } else { DocumentNodePath editingContainerPath2 = editContext2.EditingContainerPath; nodePathEntry = new NodePathEntry(editingContainerPath2.ContainerOwnerProperty, editContext1.EditingContainerPath.ContainerOwner ?? editContext1.EditingContainerPath.Node, editingContainerPath2.ContainerOwner); } list.Add(nodePathEntry); } return(new DocumentNodePath((IEnumerable <NodePathEntry>)list)); }