public void RefreshContent() { if (Workspace == null) { return; } if (Workspace.CurrentGraph == null) { return; } if (Workspace.CurrentGraph != DiagramDrawer.DiagramViewModel.DataObject) { LoadDiagram(Workspace.CurrentGraph); } else { if (DiagramViewModel != null) { //TODO Micah, please check if it is valid to refresh it here //Doing this on Load does not handle shit like renaming DiagramViewModel.NavigationViewModel.Refresh(); } if (DiagramDrawer != null) { DiagramDrawer.Refresh(InvertGraphEditor.PlatformDrawer); } } }
public void LoadDiagram(IGraphData diagram) { InvertGraphEditor.DesignerWindow = this; if (diagram == null) { return; } try { DiagramDrawer = new DiagramDrawer(new DiagramViewModel(diagram)); DiagramDrawer.Dirty = true; //DiagramDrawer.Data.ApplyFilter(); DiagramDrawer.Refresh(InvertGraphEditor.PlatformDrawer); } catch (Exception ex) { InvertApplication.LogException(ex); InvertApplication.Log("Either a plugin isn't installed or the file could no longer be found. See Exception error"); } }
private DiagramDrawer DiagramDrawer(GraphNode node) { var window = InvertGraphEditor.DesignerWindow as ElementsDesigner; var diagramViewModel = new DiagramViewModel(node.Graph); diagramViewModel.NavigateTo(node.Identifier); var drawer = new DiagramDrawer(diagramViewModel); drawer.Refresh(InvertGraphEditor.PlatformDrawer); var screenshotVM = diagramViewModel.AllViewModels.OfType <DiagramNodeViewModel>().FirstOrDefault(p => p.GraphItemObject.Identifier == node.Identifier); if (screenshotVM == null) { return(null); } this.position = new Rect(this.position.x, this.position.y, screenshotVM.Bounds.width + 20f, screenshotVM.Bounds.height + 20f); var position = screenshotVM.Position - new Vector2(10f, 10f); Debug.Log(diagramViewModel.GraphData.CurrentFilter.Name + " " + position.x + ": " + position.y); foreach (var item in drawer.Children.OrderBy(p => p.ZOrder)) { //item.Refresh(InvertGraphEditor.PlatformDrawer, new Vector2(item.Bounds.x - screenshotVM.Bounds.x, item.Bounds.y - screenshotVM.Bounds.y)); if (item == null) { continue; } if (item.ViewModelObject != null) { item.IsSelected = false; item.ViewModelObject.ShowHelp = true; } item.Bounds = new Rect(item.Bounds.x - position.x, item.Bounds.y - position.y, item.Bounds.width, item.Bounds.height); foreach (var child in item.Children) { if (child == null) { continue; } child.Bounds = new Rect(child.Bounds.x - position.x, child.Bounds.y - position.y, child.Bounds.width, child.Bounds.height); if (child.ViewModelObject != null) { var cb = child.ViewModelObject.ConnectorBounds; child.ViewModelObject.ConnectorBounds = new Rect(cb.x - position.x, cb.y - position.y, cb.width, cb.height); } //child.Refresh(InvertGraphEditor.PlatformDrawer, new Vector2(item.Bounds.x - screenshotVM.Bounds.x, item.Bounds.y - screenshotVM.Bounds.y)); } } return(drawer); }