void Refresh()
		{
			ClearErrorMessage();
			if (string.IsNullOrEmpty(txtExpression.Text)) {
				this.graphDrawer.ClearCanvas();
				return;
			}
			if (debuggerService.IsProcessRunning) {
				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();
			}
		}
Пример #2
0
		public void Refresh()
		{
			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) {
				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)
		{
			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);
		}
Пример #4
0
		private ObjectGraph buildGraphForValue(Value rootValue, GraphExpression rootExpression, ExpandedExpressions expandedNodes)
		{
			resultGraph = new ObjectGraph();
			//resultGraph.Root = buildGraphRecursive(debuggerService.GetValueFromName(expression).GetPermanentReference(), expandedNodes);
			resultGraph.Root = createNewNode(rootValue, rootExpression);
			loadContent(resultGraph.Root);
			loadNeighborsRecursive(resultGraph.Root, expandedNodes);
			return resultGraph;
		}
		void refreshGraph()
		{
			clearErrorMessage();
			if (string.IsNullOrEmpty(txtExpression.Text))
			{
				this.graphDrawer.ClearCanvas();
				return;
			}
			if (debuggerService.IsProcessRunning)		// "Process not paused" exception still occurs
			{
				showErrorMessage("Cannot inspect when the process is running.");
				return;
			}
			bool graphBuiltOk = true;
			try
			{
				this.objectGraph = rebuildGraph(txtExpression.Text);
			}
			catch(DebuggerVisualizerException ex)
			{
				graphBuiltOk = false;
				showErrorMessage(ex.Message);
			}
			catch(Debugger.GetValueException ex)
			{
				graphBuiltOk = false;
				showErrorMessage("Expression cannot be evaluated - " + ex.Message);
			}
			if (graphBuiltOk)
			{
				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;
			ICSharpCode.Core.LoggingService.Debug("Debugger visualizer: Calculating graph layout");
			this.currentPosGraph = this.layouter.CalculateLayout(graph, layoutViewModel.SelectedEnumValue, this.expanded);
			ICSharpCode.Core.LoggingService.Debug("Debugger visualizer: Graph layout done");
			registerExpandCollapseEvents(this.currentPosGraph);
			
			var graphDiff = new GraphMatcher().MatchGraphs(oldPosGraph, currentPosGraph);
			ICSharpCode.Core.LoggingService.Debug("Debugger visualizer: starting graph animation");
			this.graphDrawer.StartAnimation(oldPosGraph, currentPosGraph, graphDiff);
			//this.graphDrawer.Draw(this.currentPosGraph);	// buggy layout with NodeControlCache
		}
		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);
		}