void LayoutGraph(ObjectGraph graph) { this.oldPosGraph = this.currentPosGraph; Log.Debug("Debugger visualizer: Calculating graph layout"); var layoutDirection = layoutViewModel.SelectedEnumValue; this.currentPosGraph = new TreeLayout(layoutDirection).CalculateLayout(graph, expanded); Log.Debug("Debugger visualizer: Graph layout done"); RegisterExpandCollapseEvents(this.currentPosGraph); var graphDiff = new GraphMatcher().MatchGraphs(oldPosGraph, currentPosGraph); Log.Debug("Debugger visualizer: starting graph animation"); this.graphDrawer.StartAnimation(oldPosGraph, currentPosGraph, graphDiff); }
public void Refresh() { // Almost all of the blocking is done ContentPropertyNode.Evaluate, // which is being called by WPF for all the properties. // It would be better if we were filling the node texts ourselves in a loop, // so that we could cancel any time. UI would redraw gradually thanks to INotifyPropertyChanged. try { Debugger.AddIn.TreeModel.Utils.DoEvents(debuggerService.DebuggedProcess); } catch (AbortedBecauseDebuggeeResumedException) { Log.Warn("Object graph - debuggee resumed, cancelling refresh."); this.graphDrawer.ClearCanvas(); return; } ClearErrorMessage(); if (string.IsNullOrEmpty(txtExpression.Text)) { this.graphDrawer.ClearCanvas(); return; } if (debuggerService.IsProcessRunning) { // "Process not paused" exception still occurs ErrorMessage("Cannot inspect when the process is running."); return; } bool isSuccess = true; try { this.objectGraph = RebuildGraph(txtExpression.Text); } catch (DebuggerVisualizerException ex) { isSuccess = false; ErrorMessage(ex.Message); } catch (Debugger.GetValueException ex) { isSuccess = false; ErrorMessage("Expression cannot be evaluated - " + ex.Message); } if (isSuccess) { LayoutGraph(this.objectGraph); } else { this.graphDrawer.ClearCanvas(); } }
void LayoutGraph(ObjectGraph graph) { if (this.oldPosGraph != null) { foreach (var oldNode in this.oldPosGraph.Nodes) { // controls from old graph would be garbage collected, reuse them NodeControlCache.Instance.ReturnForReuse(oldNode.NodeVisualControl); } } this.oldPosGraph = this.currentPosGraph; Log.Debug("Debugger visualizer: Calculating graph layout"); var layoutDirection = layoutViewModel.SelectedEnumValue; this.currentPosGraph = new TreeLayout(layoutDirection).CalculateLayout(graph, expanded); Log.Debug("Debugger visualizer: Graph layout done"); RegisterExpandCollapseEvents(this.currentPosGraph); var graphDiff = new GraphMatcher().MatchGraphs(oldPosGraph, currentPosGraph); Log.Debug("Debugger visualizer: starting graph animation"); this.graphDrawer.StartAnimation(oldPosGraph, currentPosGraph, graphDiff); }
ObjectGraph RebuildGraph(string expression) { this.objectGraphBuilder = new ObjectGraphBuilder(debuggerService); Log.Debug("Debugger visualizer: Building graph for expression: " + txtExpression.Text); return(this.objectGraphBuilder.BuildGraphForExpression(expression, expanded.Expressions)); }