From b19d776a51a8f7e9ce5ec24f69d982e4d3c8b18d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Srbeck=C3=BD?= Date: Mon, 15 May 2006 15:30:32 +0000 Subject: [PATCH] Debugger tooltips work if they are hidden and then shown again git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.0@1412 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../Src/Service/DynamicTreeDebuggerRow.cs | 36 +++++++++++-------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/DynamicTreeDebuggerRow.cs b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/DynamicTreeDebuggerRow.cs index d8153b1548..652fc5073f 100644 --- a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/DynamicTreeDebuggerRow.cs +++ b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/DynamicTreeDebuggerRow.cs @@ -55,16 +55,19 @@ namespace ICSharpCode.SharpDevelop.Services if (variable == null) throw new ArgumentNullException("variable"); this.variable = variable; - this.variable.ValueChanged += Update; - this.Hidden += delegate { this.variable.ValueChanged -= Update; }; + this.Shown += delegate { + this.variable.ValueChanged += Update; + DoInPausedState( delegate { Update(); } ); + }; + this.Hidden += delegate { + this.variable.ValueChanged -= Update; + }; DebuggerGridControl.AddColumns(this.ChildColumns); this[1].Paint += OnIconPaint; this[3].FinishLabelEdit += OnLabelEdited; this[3].MouseDown += OnMouseDown; - - Update(); } void Update(object sender, DebuggerEventArgs e) @@ -146,16 +149,21 @@ namespace ICSharpCode.SharpDevelop.Services protected override void OnExpanding(DynamicListEventArgs e) { if (!populated) { - if (Variable.Debugger.IsPaused) { - Populate(); - } else { - EventHandler populate = null; - populate = delegate { - Populate(); - Variable.Debugger.DebuggingPaused -= populate; - }; - Variable.Debugger.DebuggingPaused += populate; - } + DoInPausedState(delegate { Populate(); }); + } + } + + void DoInPausedState(MethodInvoker action) + { + if (Variable.Debugger.IsPaused) { + action(); + } else { + EventHandler onDebuggingPaused = null; + onDebuggingPaused = delegate { + action(); + Variable.Debugger.DebuggingPaused -= onDebuggingPaused; + }; + Variable.Debugger.DebuggingPaused += onDebuggingPaused; } }