-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainWindow.xaml
107 lines (98 loc) · 6.84 KB
/
MainWindow.xaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:av="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="av" x:Class="LogViewerApp.MainWindow"
Title="Enhanced Log Viewer" Width="800" Height="600">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="95*" />
<ColumnDefinition Width="50*" />
<ColumnDefinition Width="75*" />
<ColumnDefinition Width="342*" />
<ColumnDefinition Width="238*" />
</Grid.ColumnDefinitions>
<!-- Control Panel for Search, Filters, and Buttons -->
<StackPanel Orientation="Vertical" Margin="10,10,10,10" Grid.ColumnSpan="5">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch">
<Button Content="Load Log File" Click="LoadFileButton_Click" Margin="5" RenderTransformOrigin="5.153,0.71" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" />
<CheckBox Content="Encrypted" IsChecked="True" x:Name="Encrypted" Margin="5" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" />
<!-- Search Bar -->
<TextBox x:Name="SearchBox" Width="200" Margin="5" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" />
<Button Content="Search" Click="SearchButton_Click" Margin="5" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" />
<!-- Filter Checkboxes -->
<CheckBox Content="Log" IsChecked="True" x:Name="LogFilter" Margin="5" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" />
<CheckBox Content="Warning" IsChecked="True" x:Name="WarningFilter" Margin="5" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" />
<CheckBox Content="Error" IsChecked="True" x:Name="ErrorFilter" Margin="5" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" />
<CheckBox Content="Collapse" x:Name="CollapseFilter" Margin="5" VerticalAlignment="Center" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" />
</StackPanel>
<!-- Date Filters -->
<StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch" Margin="5,0,10,0">
<TextBlock Text="Start Date" VerticalAlignment="Center" />
<DatePicker x:Name="StartDatePicker" Width="150" Margin="5" SelectedDateFormat="Long" IsTodayHighlighted="False" />
<TextBlock Text="End Date" VerticalAlignment="Center" />
<DatePicker x:Name="EndDatePicker" Width="150" Margin="5" SelectedDateFormat="Long" IsTodayHighlighted="False" />
<Button Content="Filter" Click="FilterButton_Click" Margin="5" />
<Button x:Name="ExpandAllButton" Content="Expand All" Click="ExpandAllButton_Click" Margin="5" />
</StackPanel>
<!-- Load File and Expand/Collapse Button -->
<StackPanel Margin="10,5,5,5" Height="27" Orientation="Horizontal" HorizontalAlignment="Right">
<Button Content="Previous" Click="PreviousPage_Click" Height="24" />
<TextBlock x:Name="PageInfo" Text="{Binding PageInfo}" Margin="10,5,10,5" />
<Button Content="Next" Click="NextPage_Click" HorizontalContentAlignment="Right" Padding="10,1,10,1" VerticalContentAlignment="Center" RenderTransformOrigin="0,0.5" />
<ComboBox x:Name="PageSizeComboBox" RenderTransformOrigin="0.5,0.5" SelectionChanged="PageSizeComboBox_SelectionChanged" Margin="20,0,0,0">
</ComboBox>
</StackPanel>
</StackPanel>
<ListView x:Name="logListView" Margin="10,113,10,10" MouseDoubleClick="LogListView_MouseDoubleClick" av:ItemsSource="{av:SampleData ItemCount=5}" Grid.ColumnSpan="5">
<ListView.View>
<GridView>
<!-- Column for Timestamp -->
<GridViewColumn x:Name="TimeStampGVC" Header="Timestamp" DisplayMemberBinding="{Binding Timestamp}" Width="150" />
<GridViewColumn x:Name="LogLevelGVC" Header="LogLevel" DisplayMemberBinding="{Binding LogLevel}" Width="150" />
<GridViewColumn x:Name="MessageGVC" Header="Message" Width="300">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Message}" TextWrapping="Wrap" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn x:Name="StackTraceGVC" Header="StackTrace" Width="350">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding StackTrace}" TextWrapping="Wrap">
</TextBlock>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn x:Name="ClassStrackGVC" Header="ClassTrace" Width="150">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding ClassTrace}" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>
<!-- DataTemplate for ListView Item -->
<!-- ItemStyle to change background color based on LogLevel -->
<ListView.ItemContainerStyle>
<Style TargetType="{x:Type ListViewItem}">
<Style.Triggers>
<DataTrigger Binding="{Binding LogLevel}" Value="Warning">
<Setter Property="Background" Value="Yellow" />
<Setter Property="Foreground" Value="White" />
</DataTrigger>
<DataTrigger Binding="{Binding LogLevel}" Value="Error">
<Setter Property="Background" Value="Red" />
<Setter Property="Foreground" Value="White" />
</DataTrigger>
<DataTrigger Binding="{Binding LogLevel}" Value="Exception">
<Setter Property="Background" Value="Red" />
<Setter Property="Foreground" Value="White" />
</DataTrigger>
</Style.Triggers>
</Style>
</ListView.ItemContainerStyle>
</ListView>
</Grid>
</Window>