public void SetSceneRootNodeAsTheBasisNode(SceneViewModel viewModel) { if (viewModel.RootNode == null) { this.ClearBasisNodes(); } else { DocumentNodeMarkerSortedListOf <SceneNodeSubscription <basisT, pathT> .BasisNodeHolder> newBasisNodeList = new DocumentNodeMarkerSortedListOf <SceneNodeSubscription <basisT, pathT> .BasisNodeHolder>(); newBasisNodeList.Add(viewModel.RootNode.DocumentNode.Marker, (SceneNodeSubscription <basisT, pathT> .BasisNodeHolder)null); this.SetBasisNodesWorker(viewModel, newBasisNodeList); } }
public void SetBasisNodes(SceneViewModel viewModel, IEnumerable <SceneNode> basisNodes) { DocumentNodeMarkerSortedListOf <SceneNodeSubscription <basisT, pathT> .BasisNodeHolder> newBasisNodeList = new DocumentNodeMarkerSortedListOf <SceneNodeSubscription <basisT, pathT> .BasisNodeHolder>(); foreach (SceneNode sceneNode in basisNodes) { if (sceneNode != null) { newBasisNodeList.Add(sceneNode.DocumentNode.Marker, (SceneNodeSubscription <basisT, pathT> .BasisNodeHolder)null); } } this.SetBasisNodesWorker(viewModel, newBasisNodeList); }
public void ChainUpdate(SceneViewModel viewModel, DocumentNodeMarkerSortedListBase newBasisNodes, IEnumerable <SceneNode> bonusBasisNodes, DocumentNodeChangeList damage, uint damageChangeStamp) { this.ValidateBasisNodeStateWithViewModel(viewModel); if (this.currentViewModel == null) { return; } SearchScope searchScope = (SearchScope)6; SearchScope scope = this.path.Scope; bool flag1 = (scope & searchScope) != scope; bool flag2 = false; if (this.path.NumberOfSteps == 1) { SearchStep searchStep = this.path.Step(0); if (searchStep.Axis == SearchAxis.DocumentDescendant && (searchStep.Predicate.AnalysisScope & (SearchScope)6) == searchStep.Predicate.AnalysisScope) { flag2 = true; } } if (newBasisNodes != null || bonusBasisNodes != null) { DocumentNodeMarkerSortedListOf <SceneNodeSubscription <basisT, pathT> .BasisNodeHolder> newBasisNodeList = new DocumentNodeMarkerSortedListOf <SceneNodeSubscription <basisT, pathT> .BasisNodeHolder>(newBasisNodes.Count); if (newBasisNodes != null) { for (int index = 0; index < newBasisNodes.Count; ++index) { newBasisNodeList.Add(newBasisNodes.MarkerAt(index), (SceneNodeSubscription <basisT, pathT> .BasisNodeHolder)null); } } if (bonusBasisNodes != null) { foreach (SceneNode sceneNode in bonusBasisNodes) { newBasisNodeList.Add(sceneNode.DocumentNode.Marker, (SceneNodeSubscription <basisT, pathT> .BasisNodeHolder)null); } } this.SetBasisNodesWorker(viewModel, newBasisNodeList); } foreach (DocumentNodeMarkerSortedListBase.IntersectionResult intersectionResult in this.pathNodeList.Intersect((DocumentNodeMarkerSortedListBase)damage, DocumentNodeMarkerSortedListBase.Flags.Contains)) { this.OnPathNodeContentChanged(this.pathNodeList.ValueAt(intersectionResult.LeftHandSideIndex), damage.MarkerAt(intersectionResult.RightHandSideIndex), damage.ValueAt(intersectionResult.RightHandSideIndex)); } if (flag1) { this.Recalculate(viewModel); } else { for (int index = this.basisNodeList.Count - 1; index >= 0; --index) { if (this.basisNodeList.MarkerAt(index).IsDeleted) { this.RemoveBasisNode(index); } else if (flag2) { this.IncrementalRecalculateBasisNode(index, damage, damageChangeStamp); } else { this.RecalculateBasisNode(index); } } } }
public void Update(SceneViewModel targetViewModel, SceneViewModel.ViewStateBits viewStateBits) { bool flag1 = (viewStateBits & SceneViewModel.ViewStateBits.ElementSelection) != SceneViewModel.ViewStateBits.None; if (targetViewModel != null && !targetViewModel.Document.IsEditable) { targetViewModel = (SceneViewModel)null; } if (targetViewModel != this.lastViewModel) { if (this.subscription == null || targetViewModel == null || this.subscription.ProjectContext != targetViewModel.ProjectContext) { if (this.subscription != null) { this.subscription.PathNodeInserted -= new XamlProjectSubscription.DocumentNodeInsertedHandler(this.Subscription_PathNodeInserted); this.subscription.PathNodeRemoved -= new XamlProjectSubscription.DocumentNodeRemovedHandler(this.Subscription_PathNodeRemoved); this.subscription.CatastrophicUpdate -= new EventHandler(this.Subscription_Refresh); this.subscription.Dispose(); this.subscription = (XamlProjectSubscription)null; } if (targetViewModel != null) { this.subscription = new XamlProjectSubscription(this.ResourceManager.DesignerContext, targetViewModel.ProjectContext, new SearchPath(new SearchStep[2] { new SearchStep((SearchAxis) new DelegateAxis(new DelegateAxis.EnumerationHandler(this.FilterScopeEnumerator), SearchScope.NodeTreeSelf)), new SearchStep((SearchAxis) new DelegateAxis(new DelegateAxis.EnumerationHandler(this.FilteredResourceEnumerator), SearchScope.NodeTreeDescendant)) }), new XamlProjectSubscription.DocumentNodeFilter(this.FilteredDocumentNodeEnumerator)); this.subscription.PathNodeInserted += new XamlProjectSubscription.DocumentNodeInsertedHandler(this.Subscription_PathNodeInserted); this.subscription.PathNodeRemoved += new XamlProjectSubscription.DocumentNodeRemovedHandler(this.Subscription_PathNodeRemoved); this.subscription.CatastrophicUpdate += new EventHandler(this.Subscription_Refresh); } } else { this.subscription.Clear(); } this.ClearItems(); this.lastViewModel = targetViewModel; this.lastSelection.Clear(); flag1 = true; } if (this.lastViewModel == null || !flag1) { return; } DocumentNodeMarkerSortedListOf <DocumentNodePath> newBasisNodes = new DocumentNodeMarkerSortedListOf <DocumentNodePath>(this.Selection.Count); foreach (SceneNode sceneNode in this.Selection.Selection) { DocumentNodeMarker marker = sceneNode.DocumentNode.Marker; DocumentNodePath documentNodePath = this.lastSelection.Find(marker) ?? sceneNode.DocumentNodePath; newBasisNodes.Add(marker, documentNodePath); } bool flag2 = true; foreach (DocumentNodeMarker marker in this.lastSelection.Markers) { if (newBasisNodes.Find(marker) == null) { flag2 = false; break; } } if (!flag2) { this.subscription.Clear(); this.ClearItems(); } this.subscription.SetBasisNodes(newBasisNodes); this.lastSelection = newBasisNodes; this.subscription.Update(); this.ResourceManager.SelectedItems.RemoveSelection((ResourceEntryBase)this); this.OnPropertyChanged("Name"); this.OnPropertyChanged("Type"); this.OnPropertyChanged("UniqueId"); this.OnPropertyChanged("ToolTip"); }