-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFaultRecordWindow.xaml
More file actions
389 lines (373 loc) · 23.2 KB
/
Copy pathFaultRecordWindow.xaml
File metadata and controls
389 lines (373 loc) · 23.2 KB
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
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
<Window x:Class="ArIED61850Tester.FaultRecordWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:ArIED61850Tester"
Title="IEC 61850 Fault Records"
Width="940" Height="650" MinWidth="820" MinHeight="560"
WindowStartupLocation="CenterOwner"
Background="#F3F6FB"
FontFamily="Aptos, Segoe UI Variable Text, Segoe UI, Calibri"
Loaded="Window_Loaded"
ContentRendered="Diagnostics_ContentRendered"
Closed="Window_Closed">
<Window.Resources>
<Style x:Key="PanelStyle" TargetType="Border">
<Setter Property="Background" Value="White"/>
<Setter Property="BorderBrush" Value="#DCE4EF"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="CornerRadius" Value="14"/>
<Setter Property="Padding" Value="14"/>
</Style>
<!-- The records grid and every row highlight deliberately stay square. -->
<Style x:Key="GridPanelStyle" TargetType="Border">
<Setter Property="Background" Value="White"/>
<Setter Property="BorderBrush" Value="#D7E0EC"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="CornerRadius" Value="0"/>
<Setter Property="Padding" Value="0"/>
</Style>
<Style x:Key="FieldStyle" TargetType="TextBox">
<Setter Property="Height" Value="38"/>
<Setter Property="Padding" Value="12,6"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Background" Value="#FAFCFF"/>
<Setter Property="BorderBrush" Value="#CBD7E6"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="FontSize" Value="12.5"/>
</Style>
<Style x:Key="PillPrimaryButtonStyle" TargetType="Button">
<Setter Property="Height" Value="38"/>
<Setter Property="MinWidth" Value="132"/>
<Setter Property="Padding" Value="18,6"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="FontSize" Value="12.5"/>
<Setter Property="FontWeight" Value="SemiBold"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="Chrome" CornerRadius="19" SnapsToDevicePixels="True">
<Border.Background>
<LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
<GradientStop Color="#5E96FF" Offset="0"/>
<GradientStop Color="#2B69E8" Offset="0.55"/>
<GradientStop Color="#1F57CE" Offset="1"/>
</LinearGradientBrush>
</Border.Background>
<Border.Effect>
<DropShadowEffect BlurRadius="12" ShadowDepth="2" Direction="270" Color="#2C63C7" Opacity="0.18"/>
</Border.Effect>
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" Margin="{TemplateBinding Padding}"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Chrome" Property="Opacity" Value="0.92"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="Chrome" Property="Opacity" Value="0.82"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="Chrome" Property="Opacity" Value="0.45"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="PillSecondaryButtonStyle" TargetType="Button">
<Setter Property="Height" Value="38"/>
<Setter Property="MinWidth" Value="112"/>
<Setter Property="Padding" Value="17,6"/>
<Setter Property="Foreground" Value="#28405F"/>
<Setter Property="FontSize" Value="12.5"/>
<Setter Property="FontWeight" Value="SemiBold"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="Chrome" CornerRadius="19" BorderBrush="#C9D6E6" BorderThickness="1" SnapsToDevicePixels="True">
<Border.Background>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
<GradientStop Color="#FFFFFF" Offset="0"/>
<GradientStop Color="#EEF3F9" Offset="1"/>
</LinearGradientBrush>
</Border.Background>
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" Margin="{TemplateBinding Padding}"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Chrome" Property="Background" Value="#E7EFFA"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="Chrome" Property="Background" Value="#DCE7F5"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="Chrome" Property="Opacity" Value="0.45"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="GridTextStyle" TargetType="TextBlock">
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="TextTrimming" Value="CharacterEllipsis"/>
<Setter Property="Foreground" Value="#26384F"/>
</Style>
<Style TargetType="DataGridColumnHeader">
<Setter Property="Height" Value="36"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Background" Value="#EAF0F7"/>
<Setter Property="Foreground" Value="#33475F"/>
<Setter Property="FontWeight" Value="SemiBold"/>
<Setter Property="FontSize" Value="11.5"/>
<Setter Property="Padding" Value="9,0"/>
<Setter Property="BorderBrush" Value="#D2DCE9"/>
<Setter Property="BorderThickness" Value="0,0,1,1"/>
</Style>
<Style TargetType="DataGridCell">
<Setter Property="Padding" Value="9,0"/>
<Setter Property="BorderBrush" Value="#E0E7F0"/>
<Setter Property="BorderThickness" Value="0,0,1,1"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
</Style>
<Style TargetType="DataGridRow">
<Setter Property="MinHeight" Value="39"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Background" Value="White"/>
<Setter Property="Foreground" Value="#26384F"/>
<Setter Property="BorderThickness" Value="0"/>
<Style.Triggers>
<DataTrigger Binding="{Binding LocalState}" Value="{x:Static local:FaultRecordLocalState.Downloaded}">
<Setter Property="Background" Value="#E7F7EF"/>
<Setter Property="Foreground" Value="#174A35"/>
</DataTrigger>
<DataTrigger Binding="{Binding LocalState}" Value="{x:Static local:FaultRecordLocalState.Partial}">
<Setter Property="Background" Value="#FFF7E5"/>
<Setter Property="Foreground" Value="#654A12"/>
</DataTrigger>
<DataTrigger Binding="{Binding Status}" Value="Failed">
<Setter Property="Background" Value="#FFF0F1"/>
<Setter Property="Foreground" Value="#7F2530"/>
</DataTrigger>
<DataTrigger Binding="{Binding Status}" Value="Downloading">
<Setter Property="Background" Value="#EBF2FF"/>
<Setter Property="Foreground" Value="#234E9B"/>
</DataTrigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#E6EFFC"/>
</Trigger>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="#D8E7FB"/>
<Setter Property="Foreground" Value="#173B73"/>
</Trigger>
</Style.Triggers>
</Style>
</Window.Resources>
<Grid Margin="12">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="9"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="9"/>
<RowDefinition Height="*"/>
<RowDefinition Height="9"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="9"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Border Grid.Row="0" Style="{StaticResource PanelStyle}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<StackPanel VerticalAlignment="Center">
<TextBlock Text="IEC 61850 Fault Records" FontSize="18" FontWeight="SemiBold" Foreground="#17243A"/>
<TextBlock Margin="0,3,0,0" FontSize="12.5" Foreground="#607089">
<Run Text="{Binding DeviceName, Mode=OneTime}"/>
<Run Text=" • "/>
<Run Text="{Binding EndpointText, Mode=OneTime}"/>
<Run Text=" • files are scanned automatically"/>
</TextBlock>
</StackPanel>
<Button Grid.Column="1" Content="Scan fault records" Click="Scan_Click"
Style="{StaticResource PillPrimaryButtonStyle}"
IsEnabled="{Binding IsNotBusy, Mode=OneWay}" MinWidth="158"/>
</Grid>
</Border>
<Border Grid.Row="2" Style="{StaticResource PanelStyle}" Padding="14,12">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="72"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="10"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="Save to" VerticalAlignment="Center" FontSize="12.5" Foreground="#42526A"/>
<TextBox Grid.Column="1" Text="{Binding DestinationDirectory, Mode=TwoWay, UpdateSourceTrigger=LostFocus}"
Style="{StaticResource FieldStyle}" ToolTip="Downloaded records are detected from this folder"/>
<Button Grid.Column="3" Content="Choose folder" Click="ChooseFolder_Click"
Style="{StaticResource PillSecondaryButtonStyle}" IsEnabled="{Binding IsNotBusy, Mode=OneWay}"/>
</Grid>
</Border>
<Border Grid.Row="4" Style="{StaticResource GridPanelStyle}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="42"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0" Margin="12,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
<TextBlock Text="Available fault records" FontSize="13.5" FontWeight="SemiBold" Foreground="#26364D" VerticalAlignment="Center"/>
<TextBlock Text=" • green rows already exist locally" FontSize="11.5" Foreground="#718096" VerticalAlignment="Center"/>
</StackPanel>
<TextBlock Grid.Column="1" Text="{Binding SelectionSummary, Mode=OneWay}" FontSize="11.5" Foreground="#68778D" VerticalAlignment="Center"/>
</Grid>
<DataGrid x:Name="FaultRecordsGrid" Grid.Row="1" ItemsSource="{Binding Records, Mode=OneWay}" AutoGenerateColumns="False"
CanUserAddRows="False" CanUserDeleteRows="False" CanUserResizeRows="False"
HeadersVisibility="Column" GridLinesVisibility="All" BorderThickness="0"
SelectionMode="Single" SelectionUnit="FullRow" Background="White"
RowHeaderWidth="0" AlternationCount="1" SnapsToDevicePixels="True"
SelectionChanged="FaultRecordsGrid_SelectionChanged">
<DataGrid.Columns>
<DataGridTemplateColumn Header="Get" Width="48">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<CheckBox IsChecked="{Binding IsSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
IsEnabled="{Binding CanSelectForDownload, Mode=OneWay}"
HorizontalAlignment="Center" VerticalAlignment="Center"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Header="Record" Binding="{Binding RecordName, Mode=OneWay}" Width="2.5*"
ElementStyle="{StaticResource GridTextStyle}" IsReadOnly="True"/>
<DataGridTextColumn Header="Modified" Binding="{Binding ModifiedText, Mode=OneWay}" Width="145"
ElementStyle="{StaticResource GridTextStyle}" IsReadOnly="True"/>
<DataGridTextColumn Header="Size" Binding="{Binding SizeText, Mode=OneWay}" Width="88"
ElementStyle="{StaticResource GridTextStyle}" IsReadOnly="True"/>
<DataGridTextColumn Header="Files" Binding="{Binding FilesText, Mode=OneWay}" Width="112"
ElementStyle="{StaticResource GridTextStyle}" IsReadOnly="True"/>
<DataGridTextColumn Header="Completeness" Binding="{Binding Completeness, Mode=OneWay}" Width="135"
ElementStyle="{StaticResource GridTextStyle}" IsReadOnly="True"/>
<DataGridTemplateColumn Header="Status" Width="126">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Grid VerticalAlignment="Center">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="4"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Border x:Name="StatusAccent" Grid.Column="0" Background="#7A8AA0" CornerRadius="0"/>
<TextBlock Grid.Column="1" Text="{Binding Status}" Margin="9,0,0,0"
VerticalAlignment="Center" FontSize="11.5" FontWeight="SemiBold"/>
</Grid>
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding Status}" Value="Downloaded">
<Setter TargetName="StatusAccent" Property="Background" Value="#24A36A"/>
</DataTrigger>
<DataTrigger Binding="{Binding Status}" Value="Ready">
<Setter TargetName="StatusAccent" Property="Background" Value="#3B78E7"/>
</DataTrigger>
<DataTrigger Binding="{Binding Status}" Value="Partial">
<Setter TargetName="StatusAccent" Property="Background" Value="#D99A1B"/>
</DataTrigger>
<DataTrigger Binding="{Binding Status}" Value="Local partial">
<Setter TargetName="StatusAccent" Property="Background" Value="#D99A1B"/>
</DataTrigger>
<DataTrigger Binding="{Binding Status}" Value="Downloading">
<Setter TargetName="StatusAccent" Property="Background" Value="#596FE8"/>
</DataTrigger>
<DataTrigger Binding="{Binding Status}" Value="Failed">
<Setter TargetName="StatusAccent" Property="Background" Value="#D44B5B"/>
</DataTrigger>
</DataTemplate.Triggers>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</Grid>
</Border>
<Expander x:Name="TransferDiagnosticsExpander" Grid.Row="6" IsExpanded="False"
Background="White" BorderBrush="#D9E2EF" BorderThickness="1" Padding="12,8">
<Expander.Header>
<StackPanel Orientation="Horizontal">
<TextBlock Text="Transfer diagnostics" FontSize="12.5" FontWeight="SemiBold" Foreground="#26364D"/>
<TextBlock Text=" • opens automatically only on failure" FontSize="11.5" Foreground="#78869A" VerticalAlignment="Center"/>
</StackPanel>
</Expander.Header>
<Grid Margin="0,9,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="7"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Text="Exact failing stage, invoke ID, FRSM, FileRead block, session state, and MMS request/response hex."
FontSize="11.5" Foreground="#607089" VerticalAlignment="Center"/>
<Button Grid.Column="1" Content="Copy diagnostics" Click="CopyDiagnostic_Click"
Style="{StaticResource PillSecondaryButtonStyle}" Height="32" MinWidth="122" Padding="12,3"/>
</Grid>
<TextBox Grid.Row="2" Text="{Binding SelectedTransferDiagnostic, Mode=OneWay}"
Height="145" IsReadOnly="True" AcceptsReturn="True" TextWrapping="NoWrap"
VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto"
FontFamily="Cascadia Mono, Consolas, Courier New" FontSize="11"
Padding="9" Background="#F8FAFD" BorderBrush="#CBD8E8"/>
</Grid>
</Expander>
<Border Grid.Row="8" Style="{StaticResource PanelStyle}" Padding="14,11">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="8"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="10"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="8"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="5" Text="{Binding StatusText, Mode=OneWay}"
FontSize="12" Foreground="#4B5D75" TextTrimming="CharacterEllipsis"/>
<ProgressBar Grid.Row="2" Grid.Column="0" Height="7" Minimum="0" Maximum="100"
Value="{Binding ProgressValue, Mode=OneWay}" IsIndeterminate="{Binding IsIndeterminate, Mode=OneWay}"
Background="#E5EBF3" Foreground="#3B78E7"/>
<Button Grid.Row="2" Grid.Column="2" Content="Cancel" Click="Cancel_Click"
Style="{StaticResource PillSecondaryButtonStyle}" IsEnabled="{Binding IsBusy, Mode=OneWay}" MinWidth="92"/>
<Button Grid.Row="2" Grid.Column="4" Content="Download selected" Click="Download_Click"
Style="{StaticResource PillPrimaryButtonStyle}" IsEnabled="{Binding CanDownload, Mode=OneWay}" MinWidth="150"/>
</Grid>
</Border>
<Border x:Name="ToastHost" Grid.RowSpan="9" Panel.ZIndex="100" Visibility="Collapsed" Opacity="0"
HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,10,10,0"
CornerRadius="17" Padding="15,10" MaxWidth="430">
<Border.Effect>
<DropShadowEffect BlurRadius="20" ShadowDepth="5" Direction="270" Color="#243A5A" Opacity="0.24"/>
</Border.Effect>
<Border.RenderTransform>
<TranslateTransform x:Name="ToastTranslate" Y="-10"/>
</Border.RenderTransform>
<StackPanel Orientation="Horizontal">
<TextBlock x:Name="ToastGlyph" Text="✓" Foreground="White" FontSize="16" FontWeight="Bold" VerticalAlignment="Center"/>
<TextBlock x:Name="ToastText" Margin="10,0,0,0" Foreground="White" FontSize="12.5"
FontWeight="SemiBold" VerticalAlignment="Center" TextWrapping="Wrap"/>
</StackPanel>
</Border>
</Grid>
</Window>