Browse Source

Fixed some UI problems with the new CallStackPad.

pull/1/head
Daniel Grunwald 15 years ago
parent
commit
b1f91f024e
  1. 2
      src/AddIns/Debugger/Debugger.AddIn/Pads/CallStackPad.xaml
  2. 23
      src/AddIns/Debugger/Debugger.AddIn/Pads/CallStackPad.xaml.cs

2
src/AddIns/Debugger/Debugger.AddIn/Pads/CallStackPad.xaml

@ -3,7 +3,7 @@
xmlns:sd="http://icsharpcode.net/sharpdevelop/core" xmlns:sd="http://icsharpcode.net/sharpdevelop/core"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<DockPanel> <DockPanel>
<ListView Name="view" SelectionChanged="ViewSelectionChanged"> <ListView Name="view" MouseLeftButtonUp="View_MouseLeftButtonUp" KeyDown="View_KeyDown">
<ListView.View> <ListView.View>
<GridView> <GridView>
<GridViewColumn Header="{sd:Localize Global.Name}"> <GridViewColumn Header="{sd:Localize Global.Name}">

23
src/AddIns/Debugger/Debugger.AddIn/Pads/CallStackPad.xaml.cs

@ -3,11 +3,9 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text; using System.Text;
using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Media; using System.Windows.Media;
@ -84,8 +82,10 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
RefreshPad(); RefreshPad();
} }
void ViewSelectionChanged(object sender, SelectionChangedEventArgs e) void View_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{ {
if (debuggedProcess == null)
return;
if (debuggedProcess.IsPaused) { if (debuggedProcess.IsPaused) {
CallStackItem item = view.SelectedItem as CallStackItem; 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() public void RefreshPad()
{ {
if (debuggedProcess == null || debuggedProcess.IsRunning || debuggedProcess.SelectedThread == null) { if (debuggedProcess == null || debuggedProcess.IsRunning || debuggedProcess.SelectedThread == null) {
@ -112,10 +120,13 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
return; return;
} }
List<CallStackItem> items = null;
StackFrame activeFrame = null;
using(new PrintTimes("Callstack refresh")) { using(new PrintTimes("Callstack refresh")) {
try { try {
Utils.DoEvents(debuggedProcess); Utils.DoEvents(debuggedProcess);
view.ItemsSource = CreateItems(); items = CreateItems().ToList();
activeFrame = debuggedProcess.SelectedThread.SelectedStackFrame;
} catch(AbortedBecauseDebuggeeResumedException) { } catch(AbortedBecauseDebuggeeResumedException) {
} catch(System.Exception) { } catch(System.Exception) {
if (debuggedProcess == null || debuggedProcess.HasExited) { 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<CallStackItem> CreateItems() IEnumerable<CallStackItem> CreateItems()

Loading…
Cancel
Save