public override void Execute() { if (this.target.DocumentRoot == null) { return; } GoToXamlCommand.GoToXaml((SceneXamlDocument)this.target.DocumentRoot, new List <DocumentNode>() { this.target }); }
private void OnViewXamlCommand() { List <DocumentNode> itemsDocumentNodes = this.GetSelectedItemsDocumentNodes(); if (itemsDocumentNodes == null || itemsDocumentNodes.Count <= 0) { return; } IProjectItem projectItem = (IProjectItem)null; foreach (IProject project in this.projectManager.CurrentSolution.Projects) { projectItem = project.FindItem(DocumentReferenceLocator.GetDocumentReference(itemsDocumentNodes[0].Context)); if (projectItem != null) { break; } } SceneView sceneView = projectItem.OpenView(true) as SceneView; if (sceneView == null) { return; } DocumentNode rootNode = itemsDocumentNodes[0].DocumentRoot.RootNode; if (itemsDocumentNodes.Count == 1 && itemsDocumentNodes[0] == rootNode) { sceneView.EnsureXamlEditorVisible(); } else { if (itemsDocumentNodes.Contains(rootNode)) { itemsDocumentNodes.Remove(rootNode); } GoToXamlCommand.GoToXaml(sceneView.ViewModel.XamlDocument, itemsDocumentNodes); } }