Skip to content

Instantly share code, notes, and snippets.

View CommandHistoryWindow.cs
[NamedPartMetadata("CommandHistoryWindow"), Export(typeof(IDbgToolWindow))]
public class CommandHistoryWindow : IDbgToolWindow
View CommandHistoryWindow.cs
public Control GetToolWindowView(object parameter)
{
return new HistoryControl { DataContext = this };
}
View HistoryControl.xaml
<ui:ToolWindowView
x:Class="WinDbgExt.History.HistoryControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:ui="clr-namespace:DbgX.Interfaces.UI;assembly=DbgX.Interfaces"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
ui:ToolWindowView.TabTitle="History"
mc:Ignorable="d"
View CommandHistoryWindow.cs
using System;
using System.Collections.ObjectModel;
using System.ComponentModel.Composition;
using System.Text;
using System.Windows.Controls;
using DbgX.Interfaces;
using DbgX.Interfaces.Listeners;
using DbgX.Interfaces.Services;
namespace WinDbgExt.History
View HistoryControl.xaml
<ui:ToolWindowView
x:Class="WinDbgExt.History.HistoryControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:ui="clr-namespace:DbgX.Interfaces.UI;assembly=DbgX.Interfaces"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
ui:ToolWindowView.TabTitle="History"
mc:Ignorable="d"
View CommandHistoryWindow.cs
[Import]
private IDbgToolWindowManager _toolWindowManager;
public CommandHistoryWindow()
{
History = new ObservableCollection<Tuple<string, string>>();
OpenCommand = new DelegateCommand<string>(Open);
}
public DelegateCommand<string> OpenCommand { get; }
View HistoryControl.xaml
<ListBox x:Name="HistoryList" ItemsSource="{Binding Path=History}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseDoubleClick">
<i:InvokeCommandAction Command="{Binding Path=OpenCommand}" CommandParameter="{Binding Path=SelectedItem.Item2, ElementName=HistoryList}" />
</i:EventTrigger>
</i:Interaction.Triggers>
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=Item1}" />
</DataTemplate>
View CommandWindow.cs
using System.ComponentModel.Composition;
using System.Windows.Controls;
using DbgX.Interfaces;
using DbgX.Interfaces.Services;
namespace WinDbgExt.History
{
[NamedPartMetadata("CommandWindow"), Export(typeof(IDbgToolWindow))]
public class CommandWindow : IDbgToolWindow
{
View CommandControl.xaml
<UserControl x:Class="WinDbgExt.History.CommandControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
View CommandControl.xaml.cs
private void AppendDmlOutput(string content)
{
var paragraph = new Paragraph();
ContentTextBox.Document.Blocks.Add(paragraph);