aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views/JobRunsView.xaml
blob: c89cd58199218c11aa7ae4522e7fb0aa6b697a27 (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
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
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
<UserControl x:Class="Tango.MachineStudio.Statistics.Views.JobRunsView"
             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:sharedConverters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI"
             xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
             xmlns:localConverters="clr-namespace:Tango.MachineStudio.Statistics.Converters"
             xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls"
             xmlns:autoComplete="clr-namespace:Tango.AutoComplete.Editors;assembly=Tango.AutoComplete"
             xmlns:sys="clr-namespace:System;assembly=mscorlib"
             xmlns:enumerations="clr-namespace:Tango.BL.Enumerations;assembly=Tango.BL"
             xmlns:local="clr-namespace:Tango.MachineStudio.Statistics.Views"
             mc:Ignorable="d" 
             d:DesignHeight="450" d:DesignWidth="1800" Foreground="{StaticResource JobFieldForeground}">
    <UserControl.Resources>
        <sharedConverters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
        <sharedConverters:BooleanToYesNoConverter x:Key="BooleanToYesNoConverter"/>
        <sharedConverters:EnumToDescriptionConverter x:Key="EnumToDescriptionConverter" />
        <sharedConverters:EnumToItemsSourceConverter x:Key="EnumToItemsSourceConverter" />
        <sharedConverters:TimeSpanToTwoDigitsTimeConverter x:Key="TimeSpanToTwoDigitsTimeConverter" />
        <sharedConverters:DateTimeUTCToShortDateTimeConverter x:Key="DateTimeUTCToShortDateTimeConverter"/>
        <sharedConverters:ColorToIntegerConverter x:Key="ColorToIntegerConverter" />
        <localConverters:DateIsInListToBooleanConverter x:Key="DateIsInListToBooleanConverter"/>
        <localConverters:StringToBoolYesNoNullConverter x:Key="StringToBoolYesNoNullConverter"/>
        <localConverters:LiquidTypeToColorConverter x:Key="LiquidTypeToColorConverter"/>
        <localConverters:CollectionConverter x:Key="CollectionConverter"/>

        <ResourceDictionary x:Key="SelectAllTextBoxResource">
            <Style TargetType="TextBox">
                <EventSetter Event="GotFocus" Handler="TextBox_GotFocus"></EventSetter>
                <EventSetter Event="MouseDown" Handler="TextBox_PreviewMouseUp"></EventSetter>
            </Style>
        </ResourceDictionary>

        <Style TargetType="{x:Type TextBlock}" x:Key="WrapText">
            <Setter Property="TextWrapping" Value="Wrap"/>
        </Style>

    </UserControl.Resources>
    
    <Grid IsEnabled="{Binding IsFree}" >
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="3*"/>
            <ColumnDefinition Width="1*"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <Grid Grid.Row="0" Background="{StaticResource WhiteBackgroundBrush}"  Width="Auto" Margin="20 0 0 1" >
            <Border Padding="14 14 12 14" BorderBrush="DimGray" BorderThickness="0" Background="{StaticResource Logging.Background}" HorizontalAlignment="Stretch" CornerRadius="2" >
                <Border.Effect>
                    <DropShadowEffect ShadowDepth="4" BlurRadius="10" Opacity="0.5"/>
                </Border.Effect>
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="120"/>
                    </Grid.ColumnDefinitions>

                    <Grid >
                        <Grid.RowDefinitions>
                            <RowDefinition Height="1*"/>
                            <RowDefinition Height="1*"/>
                        </Grid.RowDefinitions>
                        <StackPanel Orientation="Horizontal"  Grid.Row="0">
                            <StackPanel  Margin="10 5 0 0"  Orientation="Vertical"  HorizontalAlignment="Center">
                                <TextBlock Text="Machine:" VerticalAlignment="Center" FontSize="11"></TextBlock>
                                <ToggleButton  Width="130" Margin="0 10 0 0" x:Name="selectMachineButton" HorizontalAlignment="Left" FontSize="16" VerticalAlignment="Center">
                                    <ToggleButton.Template>
                                        <ControlTemplate>
                                            <Grid>
                                                <Border CornerRadius="3" BorderBrush="{StaticResource borderBrush}" BorderThickness="1" TextElement.Foreground="Black" Height="24">
                                                    <DockPanel>
                                                        <Button x:Name="selectMachineButton" Width="18" Padding="0" Height="16" DockPanel.Dock="Right" BorderBrush="{x:Null}" HorizontalAlignment="Left" Click="Button_Click" Style="{StaticResource MaterialDesignFlatButton}" Foreground="{StaticResource MainWindow.Foreground}">
                                                            <materialDesign:PackIcon Width="16"  Height="16"  Kind="ChevronDown" VerticalAlignment="Center" Foreground="{StaticResource MainWindow.Foreground}" HorizontalAlignment="Right"/>
                                                        </Button>
                                                        <TextBlock VerticalAlignment="Center"  Foreground="{StaticResource MainWindow.Foreground}" FontSize="11" Margin="5">
                                                            <TextBlock.Style>
                                                                <Style TargetType="{x:Type TextBlock}">
                                                                    <Setter Property="Text" Value="{Binding SelectedMachines.SynchedSource.Count, StringFormat={}Selected Machines({0})}">
                                                                    </Setter>
                                                                    <Style.Triggers>
                                                                        <DataTrigger Binding="{Binding SelectedMachines.SynchedSource.Count}" Value="0">
                                                                            <Setter Property="Text" Value="All machines"/>
                                                                        </DataTrigger>
                                                                    </Style.Triggers>
                                                                </Style>
                                                            </TextBlock.Style>
                                                        </TextBlock>
                                                    </DockPanel>
                                                </Border>
                                                <Popup StaysOpen="False" IsOpen="{Binding RelativeSource={RelativeSource AncestorType=ToggleButton},Path=IsChecked }" Width="{Binding RelativeSource={RelativeSource AncestorType=ToggleButton},Path=Width}" >
                                                    <Border  Background="{StaticResource Logging.Background}" BorderBrush="{StaticResource AutoCompleteTextBox.Popup.BorderBrush}" CornerRadius="3" BorderThickness="0.5" Padding="2">
                                                        <ScrollViewer MaxHeight="600" Background="{DynamicResource ComboBox.Floating.Background}">
                                                            <ItemsControl ItemsSource="{Binding SelectedMachines}"  Foreground="{StaticResource MainWindow.Foreground}">
                                                                <ItemsControl.ItemTemplate>
                                                                    <DataTemplate>
                                                                        <CheckBox VerticalAlignment="Center" DockPanel.Dock="Left" IsChecked="{Binding IsSelected}" >
                                                                            <CheckBox.Content>
                                                                                <TextBlock Margin="5 0 0 0" VerticalAlignment="Center" Text="{Binding Data.SerialNumber}" ToolTip="{Binding Data.SerialNumber}"></TextBlock>
                                                                            </CheckBox.Content>
                                                                        </CheckBox>
                                                                    </DataTemplate>
                                                                </ItemsControl.ItemTemplate>
                                                            </ItemsControl>
                                                        </ScrollViewer>
                                                    </Border>
                                                </Popup>
                                            </Grid>
                                        </ControlTemplate>
                                    </ToggleButton.Template>
                                </ToggleButton>
                            </StackPanel>

                            <StackPanel   Margin="50 10 0 0" HorizontalAlignment="Center">
                                <TextBlock FontSize="11">Start Date:</TextBlock>
                                <DatePicker x:Name="startdatePicker" Margin="0 5 0 0" SelectedDate="{Binding StartSelectedDate}"   materialDesign:HintAssist.Hint="Pick start date"  Width="130" VerticalAlignment="Center" FontSize="11" />
                            </StackPanel>
                            <StackPanel   Margin="50 10 0 0" HorizontalAlignment="Center">
                                <TextBlock FontSize="11">End Date:</TextBlock>
                                <DatePicker x:Name="endDatePicker"  Margin="0 5 0 0" SelectedDate="{Binding EndSelectedDate}" materialDesign:HintAssist.Hint="Pick end date"  Width="130" VerticalAlignment="Center" FontSize="11" />
                            </StackPanel>
                        </StackPanel>

                        <StackPanel Orientation="Horizontal" Grid.Row="1">
                            <StackPanel  Margin="10 20 0 0" Orientation="Vertical" HorizontalAlignment="Center">
                                <!--<TextBlock  Text="Job Name:" VerticalAlignment="Center" FontSize="11"></TextBlock>-->
                                <!--<TextBox  Text="{Binding JobName}" VerticalAlignment="Center" FontSize="11" Margin="0 5 0 0" Width="130"></TextBox>-->
                                <autoComplete:AutoCompleteTextBox Provider="{Binding JobRunsProvider}" Width="130" FontSize="11" LoadingContent="Loading..." SelectedItem="{Binding JobRun,Mode=TwoWay}" materialDesign:HintAssist.Hint="Job Name" DisplayMember="JobName" materialDesign:HintAssist.IsFloating="True">
                                    <autoComplete:AutoCompleteTextBox.ItemTemplate>
                                        <DataTemplate>
                                            <StackPanel>
                                                <TextBlock Text="{Binding JobName}" FontWeight="Bold" FontStyle="Italic"></TextBlock>
                                                <!--<TextBlock FontSize="11" Text="{Binding Name}" Foreground="Gray"></TextBlock>-->
                                            </StackPanel>
                                        </DataTemplate>
                                    </autoComplete:AutoCompleteTextBox.ItemTemplate>
                                </autoComplete:AutoCompleteTextBox>
                            </StackPanel>
                            <StackPanel  Margin="40 10 0 0" Orientation="Vertical"  HorizontalAlignment="Center">
                                <TextBlock  Text="Source:" VerticalAlignment="Center" FontSize="11"></TextBlock>
                                <ToggleButton Width="130" Height="24" Margin="0 10 0 0" x:Name="selectJobRunSources" HorizontalAlignment="Left" FontSize="16" VerticalAlignment="Center">
                                    <ToggleButton.Template>
                                        <ControlTemplate>
                                            <Grid>
                                                <Border CornerRadius="3" BorderBrush="{StaticResource borderBrush}" BorderThickness="1" TextElement.Foreground="Black" >
                                                    <DockPanel>
                                                        <Button x:Name="jobRunSourcesButton" Width="18" Padding="0" Height="16" DockPanel.Dock="Right" BorderBrush="{x:Null}" HorizontalAlignment="Left" Click="JobRunSourcesButton_Click" Style="{StaticResource MaterialDesignFlatButton}" Foreground="{StaticResource MainWindow.Foreground}">
                                                            <materialDesign:PackIcon Width="16"  Height="16"  Kind="ChevronDown" VerticalAlignment="Center" Foreground="{StaticResource MainWindow.Foreground}" HorizontalAlignment="Right"/>
                                                        </Button>
                                                        <TextBlock VerticalAlignment="Center"  Foreground="{StaticResource MainWindow.Foreground}" FontSize="11" Margin="5" Text="{Binding JobRunSelectedSources.SynchedSource, Converter={StaticResource CollectionConverter}}"/>
                                                     </DockPanel>
                                                </Border>
                                                <Popup StaysOpen="False" IsOpen="{Binding RelativeSource={RelativeSource AncestorType=ToggleButton},Path=IsChecked }" Width="{Binding RelativeSource={RelativeSource AncestorType=ToggleButton},Path=Width}">
                                                    <Border Background="{DynamicResource ComboBox.Floating.Background}" BorderBrush="{StaticResource AutoCompleteTextBox.Popup.BorderBrush}" >
                                                        <ItemsControl ItemsSource="{Binding JobRunSelectedSources}"  Foreground="{StaticResource MainWindow.Foreground}">
                                                            <ItemsControl.ItemTemplate>
                                                                <DataTemplate>
                                                                    <CheckBox VerticalAlignment="Center" DockPanel.Dock="Left" IsChecked="{Binding IsSelected}">
                                                                        <CheckBox.Content>
                                                                            <TextBlock Margin="5 0 0 0" VerticalAlignment="Center" Text="{Binding Data}"></TextBlock>
                                                                        </CheckBox.Content>
                                                                    </CheckBox>
                                                                </DataTemplate>
                                                            </ItemsControl.ItemTemplate>
                                                        </ItemsControl>
                                                    </Border>
                                                </Popup>
                                            </Grid>
                                        </ControlTemplate>
                                    </ToggleButton.Template>
                                </ToggleButton>
                            </StackPanel>
                            <StackPanel  Margin="40 10 0 0" Orientation="Vertical"  HorizontalAlignment="Center">
                                <TextBlock  Text="Gradient:" VerticalAlignment="Center" FontSize="11"></TextBlock>
                                <ToggleButton Height="24" Width="130" Margin="0 10 0 0" x:Name="selectIsGradient" HorizontalAlignment="Left" FontSize="16" VerticalAlignment="Center">
                                    <ToggleButton.Template>
                                        <ControlTemplate>
                                            <Grid>
                                                <Border CornerRadius="3" BorderBrush="{StaticResource borderBrush}" BorderThickness="1" TextElement.Foreground="Black" >
                                                    <DockPanel>
                                                        <Button x:Name="isGradientButton" Width="18" Padding="0" Height="16" DockPanel.Dock="Right" BorderBrush="{x:Null}" HorizontalAlignment="Left" Click="IsGradientButton_Click" Style="{StaticResource MaterialDesignFlatButton}" Foreground="{StaticResource MainWindow.Foreground}">
                                                            <materialDesign:PackIcon Width="16"  Height="16"  Kind="ChevronDown" VerticalAlignment="Center" Foreground="{StaticResource MainWindow.Foreground}" HorizontalAlignment="Right"/>
                                                        </Button>
                                                        <TextBlock VerticalAlignment="Center"  Foreground="{StaticResource MainWindow.Foreground}" FontSize="11" Margin="5 0 2 0">
                                                         <Run Text="{Binding IsGradientSelection.SynchedSource, Converter={StaticResource CollectionConverter}}"></Run>
                                                        </TextBlock>
                                                    </DockPanel>
                                                </Border>
                                                <Popup StaysOpen="False" IsOpen="{Binding RelativeSource={RelativeSource AncestorType=ToggleButton},Path=IsChecked }" Width="{Binding RelativeSource={RelativeSource AncestorType=ToggleButton},Path=Width}">
                                                    <Border Padding="5" Background="{DynamicResource ComboBox.Floating.Background}" BorderBrush="{StaticResource AutoCompleteTextBox.Popup.BorderBrush}">
                                                        <ItemsControl ItemsSource="{Binding IsGradientSelection}"  Foreground="{StaticResource MainWindow.Foreground}">
                                                            <ItemsControl.ItemTemplate>
                                                                <DataTemplate>
                                                                    <CheckBox VerticalAlignment="Center" DockPanel.Dock="Left" IsChecked="{Binding IsSelected}">
                                                                        <CheckBox.Content>
                                                                            <TextBlock Margin="5 0 0 0" VerticalAlignment="Center" Text="{Binding Data, Converter={StaticResource BooleanToYesNoConverter}}"/>
                                                                        </CheckBox.Content>
                                                                    </CheckBox>
                                                                </DataTemplate>
                                                            </ItemsControl.ItemTemplate>
                                                        </ItemsControl>
                                                    </Border>
                                                </Popup>
                                            </Grid>
                                        </ControlTemplate>
                                    </ToggleButton.Template>
                                </ToggleButton>
                            </StackPanel>
                            <StackPanel  Margin="40 10 0 0" Orientation="Vertical"  HorizontalAlignment="Center">
                                <TextBlock  Text="Length:" VerticalAlignment="Center" FontSize="11"></TextBlock>
                                <Border  MinWidth="200" BorderThickness="1" CornerRadius="3" BorderBrush="{StaticResource borderBrush}" Margin="0 5 0 0" Height="40">
                                    <StackPanel Orientation="Horizontal" Width="200" Margin="2 0 2 0">
                                    <TextBlock  Text="{Binding LengthLowerValue, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center" FontSize="11"></TextBlock>
                                    <mahapps:RangeSlider Height="40" Margin="5 5 5 5" Minimum="0" Maximum="5000" Width="140"
                                             LowerValue="{Binding LengthLowerValue,  Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, Delay=100}"
                                             UpperValue="{Binding LengthUpperValue,  Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, Delay=100}" 
                                             VerticalAlignment="Center" IsSnapToTickEnabled="True" FontSize="8"/>
                                    <TextBlock  Text="{Binding LengthUpperValue}" VerticalAlignment="Center" FontSize="11"></TextBlock>
                                    </StackPanel>
                                </Border>
                            </StackPanel>
                            <StackPanel  Margin="40 10 0 0" Orientation="Vertical"  HorizontalAlignment="Center">
                                <TextBlock  Text="Status:" VerticalAlignment="Center" FontSize="11"></TextBlock>
                                <ToggleButton Height="24" Width="170"  Margin="0 10 0 0" x:Name="selectJobRunStatus" HorizontalAlignment="Left" FontSize="16" VerticalAlignment="Center">
                                    <ToggleButton.Template>
                                        <ControlTemplate>
                                            <Grid>
                                                <Border CornerRadius="3" BorderBrush="{StaticResource borderBrush}" BorderThickness="1" TextElement.Foreground="Black" >
                                                    <DockPanel>
                                                        <Button x:Name="jobRunStatusButton" Width="18" Padding="0" Height="16" DockPanel.Dock="Right" BorderBrush="{x:Null}" HorizontalAlignment="Left" Click="JobRunStatusButton_Click" Style="{StaticResource MaterialDesignFlatButton}" Foreground="{StaticResource MainWindow.Foreground}">
                                                            <materialDesign:PackIcon Width="16"  Height="16"  Kind="ChevronDown" VerticalAlignment="Center" Foreground="{StaticResource MainWindow.Foreground}" HorizontalAlignment="Right"/>
                                                        </Button>
                                                        <TextBlock VerticalAlignment="Center"  Foreground="{StaticResource MainWindow.Foreground}" FontSize="11" Margin="5" Text="{Binding JobRunSelectedStatuses.SynchedSource, Converter={StaticResource CollectionConverter}}"/>
                                                    </DockPanel>
                                                </Border>
                                                <Popup StaysOpen="False" IsOpen="{Binding RelativeSource={RelativeSource AncestorType=ToggleButton},Path=IsChecked }" Width="{Binding RelativeSource={RelativeSource AncestorType=ToggleButton},Path=Width}">
                                                    <Border Padding="5" Background="{DynamicResource ComboBox.Floating.Background}" BorderBrush="{StaticResource AutoCompleteTextBox.Popup.BorderBrush}" >
                                                        <ItemsControl ItemsSource="{Binding JobRunSelectedStatuses}"  Foreground="{StaticResource MainWindow.Foreground}">
                                                            <ItemsControl.ItemTemplate>
                                                                <DataTemplate>
                                                                    <CheckBox VerticalAlignment="Center" DockPanel.Dock="Left" IsChecked="{Binding IsSelected}">
                                                                        <CheckBox.Content>
                                                                            <TextBlock Margin="5 0 0 0" VerticalAlignment="Center" Text="{Binding Data}"/>
                                                                        </CheckBox.Content>
                                                                    </CheckBox>
                                                                </DataTemplate>
                                                            </ItemsControl.ItemTemplate>
                                                        </ItemsControl>
                                                    </Border>
                                                </Popup>
                                            </Grid>
                                        </ControlTemplate>
                                    </ToggleButton.Template>
                                </ToggleButton>
                            </StackPanel>
                            <StackPanel  Margin="40 10 0 0"  Orientation="Vertical"  HorizontalAlignment="Center">
                                <TextBlock Text="Threads:" VerticalAlignment="Center" FontSize="11"></TextBlock>
                                <ToggleButton  Width="130" Margin="0 10 0 0" x:Name="selectThreadsButton" HorizontalAlignment="Left" FontSize="16" VerticalAlignment="Center">
                                    <ToggleButton.Template>
                                        <ControlTemplate>
                                            <Grid>
                                                <Border CornerRadius="3" BorderBrush="{StaticResource borderBrush}" BorderThickness="1" TextElement.Foreground="Black" Height="24">
                                                    <DockPanel>
                                                        <Button x:Name="selectThreadButton" Width="18" Padding="0" Height="16" DockPanel.Dock="Right" BorderBrush="{x:Null}" HorizontalAlignment="Left" Click="SelectMachineButton_Click"  Style="{StaticResource MaterialDesignFlatButton}" Foreground="{StaticResource MainWindow.Foreground}">
                                                            <materialDesign:PackIcon Width="16"  Height="16"  Kind="ChevronDown" VerticalAlignment="Center" Foreground="{StaticResource MainWindow.Foreground}" HorizontalAlignment="Right"/>
                                                        </Button>
                                                        <TextBlock VerticalAlignment="Center"  Foreground="{StaticResource MainWindow.Foreground}" FontSize="11" Margin="5">
                                                            <TextBlock.Style>
                                                                <Style TargetType="{x:Type TextBlock}">
                                                                    <Setter Property="Text" Value="{Binding SelectedThreads.SynchedSource.Count, StringFormat={}Selected Machines({0})}">
                                                                    </Setter>
                                                                    <Style.Triggers>
                                                                        <DataTrigger Binding="{Binding SelectedThreads.SynchedSource.Count}" Value="0">
                                                                            <Setter Property="Text" Value="All threads"/>
                                                                        </DataTrigger>
                                                                    </Style.Triggers>
                                                                </Style>
                                                            </TextBlock.Style>
                                                        </TextBlock>
                                                    </DockPanel>
                                                </Border>
                                                <Popup StaysOpen="False" IsOpen="{Binding RelativeSource={RelativeSource AncestorType=ToggleButton},Path=IsChecked }" Width="{Binding RelativeSource={RelativeSource AncestorType=ToggleButton},Path=Width}" >
                                                    <Border  Background="{DynamicResource ComboBox.Floating.Background}" BorderBrush="{StaticResource AutoCompleteTextBox.Popup.BorderBrush}" CornerRadius="3" BorderThickness="0.5" Padding="2">
                                                        <ScrollViewer MaxHeight="600" Background="{DynamicResource ComboBox.Floating.Background}">
                                                            <ItemsControl ItemsSource="{Binding SelectedThreads}"  Foreground="{StaticResource MainWindow.Foreground}">
                                                                <ItemsControl.ItemTemplate>
                                                                    <DataTemplate>
                                                                        <CheckBox VerticalAlignment="Center" DockPanel.Dock="Left" IsChecked="{Binding IsSelected}" >
                                                                            <CheckBox.Content>
                                                                                <TextBlock Margin="5 0 0 0" VerticalAlignment="Center" Text="{Binding Data.Name}" ToolTip="{Binding Data.Name}"></TextBlock>
                                                                            </CheckBox.Content>
                                                                        </CheckBox>
                                                                    </DataTemplate>
                                                                </ItemsControl.ItemTemplate>
                                                            </ItemsControl>
                                                        </ScrollViewer>
                                                    </Border>
                                                </Popup>
                                            </Grid>
                                        </ControlTemplate>
                                    </ToggleButton.Template>
                                </ToggleButton>
                            </StackPanel>
                        </StackPanel>
                    </Grid>
                    <Button Grid.Column="1" HorizontalAlignment="Right" Command="{Binding LoadJobRunsCommand}"  Margin="10" Width="100" VerticalAlignment="Center">GO</Button>
                </Grid>
            </Border>
        </Grid>

        <DataGrid Grid.Row="1" Margin="20 0 0 10" SelectionMode="Single" SelectionUnit="FullRow"  BorderBrush="{StaticResource borderBrush}" IsReadOnly="True" BorderThickness="1" RowHeight="60" 
                           Background="{StaticResource TransparentBackgroundBrush}"  AlternatingRowBackground="{StaticResource Transparent200}" AutoGenerateColumns="False" CanUserReorderColumns="True"
                           CanUserAddRows="False" CanUserDeleteRows="False" ItemsSource="{Binding JobRuns}" HorizontalScrollBarVisibility="Disabled"
                           SelectedItem="{Binding SelectedJobRun}" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" FontSize="11">
            
            <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>
                    <Setter Property="VerticalAlignment" Value="Stretch"/>
                    <Setter Property="HorizontalAlignment" Value="Left"/>
                      <!--<Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="{x:Type DataGridCell}">
                                <ContentPresenter VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>-->
                    <Style.Triggers>
                        <Trigger Property="IsSelected" Value="True">
                            <Setter Property="Background" Value="Transparent"></Setter>
                            <Setter Property="Foreground" Value="{StaticResource AccentColorBrush}" />
                        </Trigger>
                    </Style.Triggers>
                </Style>
            </DataGrid.CellStyle>
            <DataGrid.RowStyle>
                <Style TargetType="DataGridRow" BasedOn="{StaticResource {x:Type DataGridRow}}">
                    
                    <Style.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="Background" Value="Transparent"></Setter>
                            <Setter Property="Foreground" Value="{StaticResource AccentColorBrush}" />
                            <Setter Property="Cursor" Value="Hand"></Setter>
                        </Trigger>
                        <Trigger Property="IsSelected" Value="True">
                            <Setter Property="Background" Value="Transparent"></Setter>
                        </Trigger>
                        <Trigger Property="IsFocused" Value="True">
                            <Setter Property="Background" Value="Transparent"></Setter>
                        </Trigger>
                    </Style.Triggers>
                </Style>
            </DataGrid.RowStyle>

            <DataGrid.Columns>
                <DataGridTemplateColumn Header="#">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <materialDesign:PackIcon Width="24" Height="24" Margin="3 -5 0 0">
                                <materialDesign:PackIcon.Style>
                                    <Style TargetType="materialDesign:PackIcon">
                                        <Setter Property="Kind" Value="Check"></Setter>
                                        <Style.Triggers>
                                            <DataTrigger Binding="{Binding JobRun.JobRunStatus}" Value="Completed">
                                                <Setter Property="Kind" Value="Check"></Setter>
                                                <Setter Property="Foreground" Value="{StaticResource GreenOpenFileBrush}"></Setter>
                                            </DataTrigger>
                                            <DataTrigger Binding="{Binding JobRun.JobRunStatus}" Value="Aborted">
                                                <Setter Property="Kind" Value="Alert"></Setter>
                                                <Setter Property="Foreground" Value="{StaticResource OrangeBrush}"></Setter>
                                            </DataTrigger>
                                            <DataTrigger Binding="{Binding JobRun.JobRunStatus}" Value="Failed">
                                                <Setter Property="Kind" Value="AlertOctagon"></Setter>
                                                <Setter Property="Foreground" Value="{StaticResource RedBrush100}"></Setter>
                                            </DataTrigger>
                                        </Style.Triggers>
                                    </Style>
                                </materialDesign:PackIcon.Style>
                            </materialDesign:PackIcon>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
                <DataGridTextColumn Header="ID" Binding="{Binding JobRun.ID}" MaxWidth="100" ElementStyle="{StaticResource WrapText}"/>
                <DataGridTextColumn Header="Machine" Binding="{Binding Machine.SerialNumber}" Width="Auto" />
                <DataGridTextColumn Header="User" Binding="{Binding User.Contact.FullName}" Width="80" ElementStyle="{StaticResource WrapText}"/>
                <DataGridTextColumn Header="Job Name" Binding="{Binding JobRun.JobName}" MaxWidth="100" ElementStyle="{StaticResource WrapText}"/>
                <DataGridTextColumn Header="Length" Binding="{Binding JobRun.JobLength, StringFormat={}{0:0.00}}" Width="Auto" />
                <DataGridTextColumn Header="Source" Binding="{Binding JobRun.Source, Converter={StaticResource EnumToDescriptionConverter}}" Width="Auto" />
                <DataGridTextColumn Header="Upload &#10;Duration" Binding="{Binding UploadDuration, Converter={StaticResource TimeSpanToTwoDigitsTimeConverter}, FallbackValue=5}" Width="Auto"/>
                <DataGridTextColumn Header="Heating &#10;Duration" Binding="{Binding HeatingDuration, Converter={StaticResource TimeSpanToTwoDigitsTimeConverter}, FallbackValue=5}" Width="Auto" />
                <DataGridTextColumn Header="Start Time" Binding="{Binding JobRun.ActualStartDate, Converter={StaticResource DateTimeUTCToShortDateTimeConverter}}" Width="Auto" />
                <DataGridTextColumn Header="IsGradient" Binding="{Binding JobRun.IsGradient}" Width="Auto" />
                <DataGridTextColumn Header="GR" Binding="{Binding JobRun.GradientResolutionCm}" Width="Auto" />
                <DataGridTextColumn Header="Status" Binding="{Binding JobRun.JobRunStatus, Converter={StaticResource EnumToDescriptionConverter}}" Width="Auto"/>
                <DataGridTextColumn Header="End Time" Binding="{Binding JobRun.EndDate, Converter={StaticResource DateTimeUTCToShortDateTimeConverter}}" Width="Auto" />
                <DataGridTextColumn Header="End &#10;Position" Binding="{Binding JobRun.EndPosition, StringFormat={}{0:0.00}}" Width="Auto" />
                <DataGridTemplateColumn Header="Liquid Quantities" Width="1*">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <ItemsControl ItemsSource="{Binding JobRun.LiquidQuantities,Mode=OneWay}" Margin="0 0 0 0" Height="60">
                                <ItemsControl.ItemContainerStyle>
                                    <Style TargetType="ContentPresenter">
                                        <Setter Property="Visibility" Value="Visible"></Setter>
                                        <Style.Triggers>
                                            <DataTrigger Binding="{Binding Quantity}" Value="0">
                                                <Setter Property="Visibility" Value="Collapsed"></Setter>
                                            </DataTrigger>
                                        </Style.Triggers>
                                    </Style>
                                </ItemsControl.ItemContainerStyle>
                                <ItemsControl.ItemsPanel>
                                    <ItemsPanelTemplate>
                                        <WrapPanel ></WrapPanel>
                                    </ItemsPanelTemplate>
                                </ItemsControl.ItemsPanel>
                                <ItemsControl.ItemTemplate>
                                    <DataTemplate>
                                        <StackPanel Orientation="Vertical" ToolTip="{Binding Quantity}">
                                            <!--<TextBlock VerticalAlignment="Center" Margin="10 0 0 0" Text="{Binding LiquidType,Converter={StaticResource EnumToDescriptionConverter}}"/>-->
                                            <Rectangle Height="30" Width="20" Margin="0 0 0 0">
                                                <Rectangle.Fill>
                                                    <SolidColorBrush Color="{Binding LiquidType,Converter={StaticResource LiquidTypeToColorConverter}}" />
                                                </Rectangle.Fill>
                                            </Rectangle>
                                            <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" Margin="2" Text="{Binding LiquidType,Converter={StaticResource EnumToDescriptionConverter}}" Foreground="Gray"/>
                                        </StackPanel>
                                    </DataTemplate>
                                </ItemsControl.ItemTemplate>
                            </ItemsControl>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
            </DataGrid.Columns>
        </DataGrid>
        <Border Grid.Row="1" Grid.Column="1" Margin="20, 0, 20, 10" BorderBrush="{StaticResource borderBrush}" Background="{StaticResource TransparentBackgroundBrush}" BorderThickness="1">
            
            <StackPanel>
                <TextBlock Margin="10" Text="{Binding SelectedJobRunsText}"></TextBlock>
            </StackPanel>
        </Border>
        <Border Grid.Row="2" Grid.ColumnSpan="2" Margin="20, 10, 20, 20" BorderBrush="{StaticResource borderBrush}" Background="{StaticResource TransparentBackgroundBrush}" BorderThickness="1">
            <StackPanel Background="{StaticResource TransparentBackgroundBrush}" >
                <TextBlock>TOTALS:</TextBlock>
                <TextBlock>Cyan:</TextBlock>
            </StackPanel>
        </Border>
    </Grid>
</UserControl>