blob: d1492c51324959c9f0c9bba80e2b0a10da1c3b19 (
plain)
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
|
<mahapps:MetroWindow x:Class="Tango.LogViewer.UI.MainWindow"
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:System="clr-namespace:System;assembly=mscorlib"
xmlns:local="clr-namespace:Tango.LogViewer.UI"
xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:fa="http://schemas.fontawesome.io/icons/"
xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI"
mc:Ignorable="d"
Title="Tango Log Viewer" WindowState="Maximized" ShowTitleBar="True" ShowCloseButton="True" DataContext="{StaticResource MainViewVM}">
<Window.Resources>
<converters:EnumToDescriptionConverter x:Key="EnumToDescriptionConverter"></converters:EnumToDescriptionConverter>
<converters:BooleanToVisibilityConverter x:Key="BoolToVisibilityConverter"/>
<converters:BooleanToVisibilityInverseConverter x:Key="BooleanToVisibilityInverseConverter"/>
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="28" />
<RowDefinition Height="Auto"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="28"/>
<RowDefinition Height="5"/>
</Grid.RowDefinitions>
<Menu Grid.Row="0" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="10,0,0,0" BorderBrush="Transparent" Background="Transparent">
<MenuItem Header="File" Background="Transparent">
<MenuItem Header="Open" Command="{Binding OpeFileLogCommand}"/>
<MenuItem Header="Exit" Click="Exit_MenuItem_Click" />
</MenuItem>
</Menu>
<Grid Grid.Row="1" Margin="0 20 0 20">
<DockPanel>
<StackPanel Orientation="Vertical" HorizontalAlignment="Left" Margin="10 0 0 0">
<TextBlock FontSize="10">Start Time:</TextBlock>
<mahapps:TimePicker x:Name="startTimePicker" SelectedTime="{Binding StartSelectedTime}" Width="160" VerticalAlignment="Center" FontSize="16" IsClockVisible="False" Culture="en-In"/>
</StackPanel>
<StackPanel Orientation="Vertical" HorizontalAlignment="Left" Margin="20 0 0 0">
<TextBlock FontSize="10">End Time:</TextBlock>
<mahapps:TimePicker x:Name="enddatePicker" SelectedTime="{Binding EndSelectedTime}" Width="160" VerticalAlignment="Center" FontSize="16" IsClockVisible="False" Culture="en-In" PickerVisibility="HourMinute" />
</StackPanel>
<Border BorderThickness="1" BorderBrush="#B9B9B9" VerticalAlignment="Center" Padding="10 7" CornerRadius="5" Margin="30 10 0 0">
<StackPanel>
<ItemsControl VerticalAlignment="Center" ItemsSource="{Binding SelectedLogCategories}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Margin="10 0 0 0">
<CheckBox IsChecked="{Binding IsSelected}" VerticalAlignment="Center"></CheckBox>
<TextBlock Text="{Binding Data}" Margin="5 0 0 0" VerticalAlignment="Center"></TextBlock>
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
</Border>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="20 10 30 0">
<fa:ImageAwesome Icon="Search" Width="24" Height="24" />
<TextBox VerticalAlignment="Center" Margin="10 0 0 0" Width="300" Text="{Binding Filter,UpdateSourceTrigger=PropertyChanged}" />
</StackPanel>
</DockPanel>
</Grid>
<Grid Grid.Row="2" >
<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="28"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2.5*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBox FontSize="14" Grid.Row="0" FontFamily="Segoe UI">Log</TextBox>
<TextBox FontSize="14" Grid.Row="0" Grid.Column="2" Margin="10 0 0 0" FontFamily="Segoe UI">Message</TextBox>
<Border Visibility="{Binding IsEmbeddedLog, Converter={StaticResource BooleanToVisibilityInverseConverter}}" Grid.Column="0" Grid.Row="1" BorderThickness="1" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" BorderBrush="#B9B9B9" Margin="0 0 10 0">
<DataGrid x:Name="ActionGrid" Background="Transparent" RenderOptions.EdgeMode="Aliased" RenderOptions.BitmapScalingMode="LowQuality" MaxWidth="{Binding RelativeSource={RelativeSource AncestorType=Grid},Path=ActualWidth}" AutoGenerateColumns="False" SelectionMode="Single" ItemsSource="{Binding LogsViewSource}" SelectedItem="{Binding SelectedLog}" RowHeight="40" CanUserAddRows="False" CanUserDeleteRows="False" CanUserReorderColumns="True" IsReadOnly="True">
<DataGrid.RowStyle>
<Style TargetType="DataGridRow" BasedOn="{StaticResource {x:Type DataGridRow}}">
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="Transparent"></Setter>
<Setter Property="Foreground" Value="#2196f3" />
<Setter Property="Cursor" Value="Hand"></Setter>
</Trigger>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="Transparent"></Setter>
<Setter Property="Foreground" Value="#2196f3" />
</Trigger>
<Trigger Property="IsFocused" Value="True">
<Setter Property="Background" Value="Transparent"></Setter>
</Trigger>
<DataTrigger Binding="{Binding CallerMethodName}" Value="OnStartup">
<Setter Property="Background" Value="#3F3F49"></Setter>
<Setter Property="Foreground" Value="White" />
<Setter Property="FontWeight" Value="SemiBold"></Setter>
<Setter Property="Cursor" Value="Arrow"></Setter>
</DataTrigger>
<DataTrigger Binding="{Binding LogObject}" Value="External Bridge">
<Setter Property="Foreground" Value="#28A805" />
</DataTrigger>
</Style.Triggers>
</Style>
</DataGrid.RowStyle>
<DataGrid.CellStyle>
<Style TargetType="DataGridCell" BasedOn="{StaticResource {x:Type DataGridCell}}">
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="TextBlock.VerticalAlignment" Value="Center" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type DataGridCell}">
<Grid Background="{TemplateBinding Background}">
<ContentPresenter VerticalAlignment="Bottom" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="DataGridCell.IsSelected" Value="True">
<Setter Property="Background" Value="Transparent"></Setter>
<Setter Property="Foreground" Value="#2196f3" />
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsFocused" Value="False" />
<Condition Property="DataGridCell.IsSelected" Value="True" />
</MultiTrigger.Conditions>
<MultiTrigger.Setters>
<Setter Property="Foreground" Value="#2196f3" />
</MultiTrigger.Setters>
</MultiTrigger>
</Style.Triggers>
</Style>
</DataGrid.CellStyle>
<DataGrid.Columns>
<DataGridTemplateColumn Header="ICON">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<fa:ImageAwesome Width="16" Height="16" Margin="0 0 0 0" VerticalAlignment="Top">
<fa:ImageAwesome.Style>
<Style TargetType="fa:ImageAwesome">
<Setter Property="Icon" Value="ExclamationTriangle"></Setter>
<Style.Triggers>
<DataTrigger Binding="{Binding Category}" Value="Info">
<Setter Property="Icon" Value="Info"></Setter>
<Setter Property="Foreground" Value="LightBlue"></Setter>
</DataTrigger>
<DataTrigger Binding="{Binding Category}" Value="Warning">
<Setter Property="Icon" Value="ExclamationTriangle"></Setter>
<Setter Property="Foreground" Value="DarkOrange"></Setter>
</DataTrigger>
<DataTrigger Binding="{Binding Category}" Value="Error">
<Setter Property="Icon" Value="ExclamationCircle"></Setter>
<Setter Property="Foreground" Value="Red"></Setter>
</DataTrigger>
<DataTrigger Binding="{Binding Category}" Value="Critical">
<Setter Property="Icon" Value="Bell"></Setter>
<Setter Property="Foreground" Value="Red"></Setter>
</DataTrigger>
<DataTrigger Binding="{Binding Category}" Value="Debug">
<Setter Property="Icon" Value="Bug"></Setter>
<Setter Property="Foreground" Value="LightGray"></Setter>
</DataTrigger>
<!--<DataTrigger Binding="{Binding CallerMethodName}" Value="OnStartup">
<Setter Property="Icon" Value="ClockOutline"></Setter>
<Setter Property="Foreground" Value="White"></Setter>
</DataTrigger>-->
</Style.Triggers>
</Style>
</fa:ImageAwesome.Style>
</fa:ImageAwesome>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Header="DATE TIME" Binding="{Binding TimeStamp,StringFormat='MM/dd/yyyy HH:mm:ss.ff'}" />
<DataGridTextColumn Header="FILE" Binding="{Binding RelativeCallerFile}" />
<DataGridTextColumn Header="METHOD" Binding="{Binding CallerMethodName}" />
<DataGridTextColumn Header="LINE" Binding="{Binding CallerLineNumber}" />
<DataGridTemplateColumn Header="MESSAGE" Width="1*" >
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Grid VerticalAlignment="Center" Margin="0 5 0 5">
<Border Height="Auto" BorderThickness="0" >
<TextBlock Text="{Binding Message}" TextTrimming="CharacterEllipsis" VerticalAlignment="Center" ></TextBlock>
</Border>
</Grid>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</Border>
<Border Visibility="{Binding IsEmbeddedLog, Converter={StaticResource BoolToVisibilityConverter}}" Grid.Column="0" Grid.Row="1" BorderThickness="1" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" BorderBrush="#B9B9B9" Margin="0 0 10 0">
<DataGrid x:Name="embededGrid" Background="Transparent" RenderOptions.EdgeMode="Aliased" RenderOptions.BitmapScalingMode="LowQuality" MaxWidth="{Binding RelativeSource={RelativeSource AncestorType=Grid},Path=ActualWidth}" AutoGenerateColumns="False" SelectionMode="Single" ItemsSource="{Binding LogsViewSource}" SelectedItem="{Binding SelectedLog}" RowHeight="40" CanUserAddRows="False" CanUserDeleteRows="False" CanUserReorderColumns="True" IsReadOnly="True">
<DataGrid.RowStyle>
<Style TargetType="DataGridRow" BasedOn="{StaticResource {x:Type DataGridRow}}">
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="Transparent"></Setter>
<Setter Property="Foreground" Value="#2196f3" />
<Setter Property="Cursor" Value="Hand"></Setter>
</Trigger>
<Trigger Property="DataGridCell.IsSelected" Value="True">
<Setter Property="Background" Value="Transparent"></Setter>
<Setter Property="Foreground" Value="#2196f3" />
</Trigger>
<Trigger Property="IsFocused" Value="True">
<Setter Property="Background" Value="Transparent"></Setter>
</Trigger>
<DataTrigger Binding="{Binding LogObject}" Value="External Bridge">
<Setter Property="Foreground" Value="#28A805" />
</DataTrigger>
</Style.Triggers>
</Style>
</DataGrid.RowStyle>
<DataGrid.CellStyle>
<Style TargetType="DataGridCell" BasedOn="{StaticResource {x:Type DataGridCell}}">
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="TextBlock.VerticalAlignment" Value="Center" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type DataGridCell}">
<Grid Background="{TemplateBinding Background}">
<ContentPresenter VerticalAlignment="Bottom" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="Transparent"></Setter>
<Setter Property="Foreground" Value="#2196f3" />
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsFocused" Value="False" />
<Condition Property="DataGridCell.IsSelected" Value="True" />
</MultiTrigger.Conditions>
<MultiTrigger.Setters>
<Setter Property="Foreground" Value="#2196f3" />
</MultiTrigger.Setters>
</MultiTrigger>
</Style.Triggers>
</Style>
</DataGrid.CellStyle>
<DataGrid.Columns>
<DataGridTemplateColumn Header="ICON">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<fa:ImageAwesome Width="16" Height="16" Margin="0 0 0 0" VerticalAlignment="Top">
<fa:ImageAwesome.Style>
<Style TargetType="fa:ImageAwesome">
<Setter Property="Icon" Value="ExclamationTriangle"></Setter>
<Style.Triggers>
<DataTrigger Binding="{Binding Category}" Value="Info">
<Setter Property="Icon" Value="Info"></Setter>
<Setter Property="Foreground" Value="LightBlue"></Setter>
</DataTrigger>
<DataTrigger Binding="{Binding Category}" Value="Warning">
<Setter Property="Icon" Value="ExclamationTriangle"></Setter>
<Setter Property="Foreground" Value="DarkOrange"></Setter>
</DataTrigger>
<DataTrigger Binding="{Binding Category}" Value="Error">
<Setter Property="Icon" Value="ExclamationCircle"></Setter>
<Setter Property="Foreground" Value="Red"></Setter>
</DataTrigger>
<DataTrigger Binding="{Binding Category}" Value="Critical">
<Setter Property="Icon" Value="Bell"></Setter>
<Setter Property="Foreground" Value="Red"></Setter>
</DataTrigger>
<DataTrigger Binding="{Binding Category}" Value="Debug">
<Setter Property="Icon" Value="Bug"></Setter>
<Setter Property="Foreground" Value="LightGray"></Setter>
</DataTrigger>
<DataTrigger Binding="{Binding CallerMethodName}" Value="OnStartup">
<Setter Property="Icon" Value="ClockOutline"></Setter>
<Setter Property="Foreground" Value="White"></Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</fa:ImageAwesome.Style>
</fa:ImageAwesome>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Header="DATE TIME" Binding="{Binding TimeStamp,StringFormat='MM/dd/yyyy HH:mm:ss.ff'}" />
<DataGridTextColumn Header="FILE" Binding="{Binding DebugLogResponse.FileName}" />
<DataGridTextColumn Header="LINE" Binding="{Binding DebugLogResponse.LineNumber}" />
<DataGridTextColumn Header="MODULE" Binding="{Binding DebugLogResponse.ModuleId}" />
<DataGridTextColumn Header="FILTER" Binding="{Binding DebugLogResponse.Filter}" />
<DataGridTemplateColumn Header="MESSAGE" Width="1*" >
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Grid VerticalAlignment="Center" Margin="0 5 0 5">
<Border Height="Auto" BorderThickness="0" >
<TextBlock Text="{Binding MessagePlusRepeated}" TextTrimming="CharacterEllipsis" VerticalAlignment="Center" ></TextBlock>
</Border>
</Grid>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</Border>
<Border Margin="10 0 0 0" Grid.Column="2" Grid.Row="1" BorderThickness="1" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" BorderBrush="#B9B9B9">
<TextBox BorderThickness="0" Text="{Binding Message}" IsReadOnly="True" AcceptsReturn="False" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" TextWrapping="NoWrap"/>
</Border>
<GridSplitter Grid.Column="1" Grid.Row="1" ResizeDirection="Columns" ResizeBehavior="PreviousAndNext" HorizontalAlignment="Center" VerticalAlignment="Stretch" Width="4" Background="#B9B9B9"/>
</Grid>
</Grid>
<StatusBar Grid.Row="3" Grid.ColumnSpan="2" Background="Transparent">
<StatusBar.ItemsPanel>
<ItemsPanelTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="10" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
</Grid>
</ItemsPanelTemplate>
</StatusBar.ItemsPanel>
<StatusBarItem Grid.Column="1">
<TextBlock Text="{Binding FileName}"></TextBlock>
</StatusBarItem>
<Separator Grid.Column="2" />
<StatusBarItem Grid.Column="3">
<TextBlock>
<Run Text="Set: "></Run>
<Run Text="{Binding CountOfSet}"></Run>
</TextBlock>
</StatusBarItem>
</StatusBar>
</Grid>
</mahapps:MetroWindow>
|