Skip to content
This repository has been archived by the owner on Oct 16, 2020. It is now read-only.

Commit

Permalink
Fixed some UI problems with the new CallStackPad.
Browse files Browse the repository at this point in the history
  • Loading branch information
dgrunwald committed Sep 28, 2010
1 parent b17ea8a commit b1f91f0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/AddIns/Debugger/Debugger.AddIn/Pads/CallStackPad.xaml
Expand Up @@ -3,7 +3,7 @@
xmlns:sd="http://icsharpcode.net/sharpdevelop/core"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<DockPanel>
<ListView Name="view" SelectionChanged="ViewSelectionChanged">
<ListView Name="view" MouseLeftButtonUp="View_MouseLeftButtonUp" KeyDown="View_KeyDown">
<ListView.View>
<GridView>
<GridViewColumn Header="{sd:Localize Global.Name}">
Expand Down
23 changes: 18 additions & 5 deletions src/AddIns/Debugger/Debugger.AddIn/Pads/CallStackPad.xaml.cs
Expand Up @@ -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;

Expand Down Expand Up @@ -84,8 +82,10 @@ void debuggedProcess_Paused(object sender, ProcessEventArgs e)
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;

Expand All @@ -105,17 +105,28 @@ void ViewSelectionChanged(object sender, SelectionChangedEventArgs e)
}
}

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) {
view.ItemsSource = null;
return;
}

List<CallStackItem> 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) {
Expand All @@ -125,6 +136,8 @@ public void RefreshPad()
}
}
}
view.ItemsSource = items;
view.SelectedItem = items != null ? items.FirstOrDefault(item => object.Equals(activeFrame, item.Frame)) : null;
}

IEnumerable<CallStackItem> CreateItems()
Expand Down

0 comments on commit b1f91f0

Please sign in to comment.