From b1f91f024e88b767f7853221a76a3afd8afbe836 Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Tue, 28 Sep 2010 14:16:20 +0200 Subject: [PATCH] Fixed some UI problems with the new CallStackPad. --- .../Debugger.AddIn/Pads/CallStackPad.xaml | 2 +- .../Debugger.AddIn/Pads/CallStackPad.xaml.cs | 23 +++++++++++++++---- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/AddIns/Debugger/Debugger.AddIn/Pads/CallStackPad.xaml b/src/AddIns/Debugger/Debugger.AddIn/Pads/CallStackPad.xaml index 0b4ab97bdb..ec0cf9aefb 100644 --- a/src/AddIns/Debugger/Debugger.AddIn/Pads/CallStackPad.xaml +++ b/src/AddIns/Debugger/Debugger.AddIn/Pads/CallStackPad.xaml @@ -3,7 +3,7 @@ xmlns:sd="http://icsharpcode.net/sharpdevelop/core" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> - + diff --git a/src/AddIns/Debugger/Debugger.AddIn/Pads/CallStackPad.xaml.cs b/src/AddIns/Debugger/Debugger.AddIn/Pads/CallStackPad.xaml.cs index 08fed0a7f6..b2a0e3bc53 100644 --- a/src/AddIns/Debugger/Debugger.AddIn/Pads/CallStackPad.xaml.cs +++ b/src/AddIns/Debugger/Debugger.AddIn/Pads/CallStackPad.xaml.cs @@ -3,11 +3,9 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Text; -using System.Windows; using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; @@ -84,8 +82,10 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads RefreshPad(); } - void ViewSelectionChanged(object sender, SelectionChangedEventArgs e) + void View_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { + if (debuggedProcess == null) + return; if (debuggedProcess.IsPaused) { CallStackItem item = view.SelectedItem as CallStackItem; @@ -105,6 +105,14 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads } } + void View_KeyDown(object sender, KeyEventArgs e) + { + if (e.Key == Key.Enter) { + View_MouseLeftButtonUp(sender, null); + e.Handled = true; + } + } + public void RefreshPad() { if (debuggedProcess == null || debuggedProcess.IsRunning || debuggedProcess.SelectedThread == null) { @@ -112,10 +120,13 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads return; } + List items = null; + StackFrame activeFrame = null; using(new PrintTimes("Callstack refresh")) { try { Utils.DoEvents(debuggedProcess); - view.ItemsSource = CreateItems(); + items = CreateItems().ToList(); + activeFrame = debuggedProcess.SelectedThread.SelectedStackFrame; } catch(AbortedBecauseDebuggeeResumedException) { } catch(System.Exception) { if (debuggedProcess == null || debuggedProcess.HasExited) { @@ -125,6 +136,8 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads } } } + view.ItemsSource = items; + view.SelectedItem = items != null ? items.FirstOrDefault(item => object.Equals(activeFrame, item.Frame)) : null; } IEnumerable CreateItems()