private void ExecuteMethod(string s) { if (fileService == null) { fileService = _container.Resolve <IOpenDocumentService>(); } fileService.OpenFromID(s, true); }
public void LoadLayout() { XmlLayoutSerializer layoutSerializer = new XmlLayoutSerializer(dockManager); layoutSerializer.LayoutSerializationCallback += (s, e) => { if (e.Model is LayoutAnchorable anchorable) { IWorkspace workspace = _container.Resolve <IWorkspace>(); ToolViewModel model = workspace.Tools.FirstOrDefault( f => f.ContentId == e.Model.ContentId); if (model != null) { e.Content = model; model.IsVisible = anchorable.IsVisible; model.IsActive = anchorable.IsActive; model.IsSelected = anchorable.IsSelected; } else { e.Cancel = true; } } if (e.Model is LayoutDocument document) { IOpenDocumentService fileService = _container.Resolve <IOpenDocumentService>(); ContentViewModel model = fileService.OpenFromID(e.Model.ContentId); if (model != null) { e.Content = model; model.IsActive = document.IsActive; model.IsSelected = document.IsSelected; } else { e.Cancel = true; } } }; try { layoutSerializer.Deserialize(@".\AvalonDock.Layout.config"); } catch (Exception) { } }
public void Execute(object parameter) { IWorkspace workspace = VEFModule.UnityContainer.Resolve <AbstractWorkspace>(); IOpenDocumentService odS = VEFModule.UnityContainer.Resolve <IOpenDocumentService>(); AnimationEditorViewModel openValue = odS.OpenFromID("AnimationEditorID:##:", true) as AnimationEditorViewModel; ////item.ContentID, true); var model = openValue.Model as AnimationEditorModel; model.AnimationBlendTree = _AnimationBlendTree; AnimationEditorManager AnimationEditorService = VEFModule.UnityContainer.Resolve(typeof(AnimationEditorManager), "") as AnimationEditorManager; AnimationEditorService.AnimationEditors[0].GraphViewModel.Elements = _AnimationBlendTree.AnimNodes; AnimationEditorService.AnimationEditors[0].GraphViewModel.Connections = _AnimationBlendTree.NodeConnections; if (!AnimationEditorService.AnimationEditors[0].GraphViewModel.Elements.Where(x => x is OutputNodeViewModel).Any()) { AnimationEditorService.AnimationEditors[0].GraphViewModel.AddElement <OutputNodeViewModel>(300, 200); } //foreach(var connection in _AnimationComponent.FB_AnimationComponent.NodeConnections) //{ // if (connection.OutputConnectorID != 0) // { // var resultOutputConnector = _AnimationComponent.FB_AnimationComponent.AnimNodes.Where(x => x.OutputConnector.ConnectorID == connection.OutputConnectorID); // if (resultOutputConnector.Any()) // connection.From = resultOutputConnector.First().OutputConnector; // } // else if (connection.InputConnectorID != 0) // { // foreach(var ele in _AnimationComponent.FB_AnimationComponent.AnimNodes) // { // var resultInputConnector = ele.InputConnectors.Where(x => x.ConnectorID == connection.InputConnectorID); // if (resultInputConnector.Any()) // connection.To = resultInputConnector.First(); // } // } //} //GraphViewModel test = new GraphViewModel(); //// openValue.GraphViewModel //test.Elements = _AnimationComponent.FB_AnimationComponent.AnimNodes; //test.Connections = _AnimationComponent.FB_AnimationComponent.AnimNodes; // _AnimationComponent.SendToSocket(); }