forked from Misaki/GhostEngine
Added new RHI abstraction layer;
Added new console debug page to UnitTest;
This commit is contained in:
120
Ghost.UnitTest/Controls/DebugConsole.xaml
Normal file
120
Ghost.UnitTest/Controls/DebugConsole.xaml
Normal file
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<UserControl
|
||||
x:Class="Ghost.UnitTest.Controls.DebugConsole"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="using:Ghost.UnitTest.Controls"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<UserControl.Resources>
|
||||
<local:LogLevelToColorConverter x:Key="LogLevelToColorConverter" />
|
||||
<local:LogLevelToSymbolConverter x:Key="LogLevelToSymbolConverter" />
|
||||
|
||||
<DataTemplate x:Key="LogItemTemplate">
|
||||
<Border Padding="8,4" Background="Transparent">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock
|
||||
Grid.Column="0"
|
||||
Margin="0,0,8,0"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="Segoe UI Symbol"
|
||||
Foreground="{Binding Level, Converter={StaticResource LogLevelToColorConverter}}"
|
||||
Text="{Binding Level, Converter={StaticResource LogLevelToSymbolConverter}}" />
|
||||
|
||||
<TextBlock
|
||||
Grid.Column="1"
|
||||
Margin="0,0,8,0"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="Consolas"
|
||||
Foreground="Gray"
|
||||
Text="{Binding Timestamp}" />
|
||||
|
||||
<TextBlock
|
||||
Grid.Column="2"
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding Message}"
|
||||
TextWrapping="Wrap" />
|
||||
</Grid>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</UserControl.Resources>
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Toolbar -->
|
||||
<Border
|
||||
Grid.Row="0"
|
||||
Background="{ThemeResource SystemControlBackgroundAltMediumBrush}"
|
||||
BorderBrush="{ThemeResource SystemControlForegroundBaseLowBrush}"
|
||||
BorderThickness="0,0,0,1">
|
||||
<StackPanel Margin="8,4" Orientation="Horizontal">
|
||||
<Button
|
||||
x:Name="ClearButton"
|
||||
Margin="0,0,8,0"
|
||||
Click="ClearButton_Click"
|
||||
Content="Clear" />
|
||||
<CheckBox
|
||||
x:Name="AutoScrollCheckBox"
|
||||
Margin="0,0,8,0"
|
||||
Content="Auto Scroll"
|
||||
IsChecked="True" />
|
||||
<CheckBox
|
||||
x:Name="ShowStackTraceCheckBox"
|
||||
Margin="0,0,8,0"
|
||||
Checked="ShowStackTraceCheckBox_Checked"
|
||||
Content="Stack Trace"
|
||||
Unchecked="ShowStackTraceCheckBox_Unchecked" />
|
||||
|
||||
<!-- Log level filters -->
|
||||
<TextBlock
|
||||
Margin="16,0,8,0"
|
||||
VerticalAlignment="Center"
|
||||
Text="Show:" />
|
||||
<CheckBox
|
||||
x:Name="ShowInfoCheckBox"
|
||||
Margin="0,0,4,0"
|
||||
Content="Info"
|
||||
IsChecked="True" />
|
||||
<CheckBox
|
||||
x:Name="ShowWarningCheckBox"
|
||||
Margin="0,0,4,0"
|
||||
Content="Warning"
|
||||
IsChecked="True" />
|
||||
<CheckBox
|
||||
x:Name="ShowErrorCheckBox"
|
||||
Margin="0,0,4,0"
|
||||
Content="Error"
|
||||
IsChecked="True" />
|
||||
<CheckBox
|
||||
x:Name="ShowDebugCheckBox"
|
||||
Margin="0,0,4,0"
|
||||
Content="Debug"
|
||||
IsChecked="True" />
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- Log display -->
|
||||
<ScrollViewer
|
||||
x:Name="LogScrollViewer"
|
||||
Grid.Row="1"
|
||||
HorizontalScrollBarVisibility="Auto"
|
||||
HorizontalScrollMode="Auto"
|
||||
VerticalScrollBarVisibility="Auto"
|
||||
VerticalScrollMode="Auto"
|
||||
ZoomMode="Disabled">
|
||||
<ItemsRepeater x:Name="LogItemsRepeater" ItemTemplate="{StaticResource LogItemTemplate}" />
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
Reference in New Issue
Block a user