-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathResultContent.xaml
195 lines (170 loc) · 11 KB
/
ResultContent.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
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
<UserControl x:Class="MultiDF.Views.ResultContent"
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:local="clr-namespace:MultiDF.Views"
xmlns:viewbase="clr-namespace:ViewsBase;assembly=ViewsBase"
xmlns:vm="clr-namespace:MultiDF.VM;assembly=MultiDF.VM"
xmlns:fa="http://schemas.fontawesome.io/icons/"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"
d:DataContext="{d:DesignInstance Type=vm:MainVM, IsDesignTimeCreatable=True}"
DataContext="{Binding Source={x:Static vm:ViewModelLocator.Main}}">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="StretchedTreeViewItemStyle.xaml" />
<ResourceDictionary Source="FancySliderStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
<viewbase:DistanceToColorConverter x:Key="DistanceToColorConverter" />
<viewbase:PathToFileNameConverter x:Key="PathToFileNameConverter" />
<DataTemplate x:Key="DifferentDocsTemplate">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="120" />
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<fa:FontAwesome Icon="FileWordOutline" Foreground="#00aff0" FontSize="14" VerticalAlignment="Center" Margin="3" />
<TextBlock VerticalAlignment="Center" Margin="0,3" TextTrimming="CharacterEllipsis">
<Run Text="{Binding Doc1.SourcePath, Converter={StaticResource PathToFileNameConverter}}" />
(QAs: <Run Text="{Binding Count1, Mode=OneWay}" />)
</TextBlock>
</StackPanel>
<StackPanel Orientation="Horizontal" Grid.Column="1" HorizontalAlignment="Center">
<fa:FontAwesome Icon="FileWordOutline" Foreground="#00aff0" FontSize="14" VerticalAlignment="Center" Margin="3" Grid.Column="2" />
<TextBlock Grid.Column="3" VerticalAlignment="Center" Margin="0,3" TextTrimming="CharacterEllipsis">
<Run Text="{Binding Doc2.SourcePath, Converter={StaticResource PathToFileNameConverter}}" />
(QAs: <Run Text="{Binding Count2, Mode=OneWay}" />)
</TextBlock>
</StackPanel>
<Border BorderBrush="#00aff0" BorderThickness="1" CornerRadius="5" Grid.Column="2" Margin="3"
HorizontalAlignment="Right" VerticalAlignment="Center" ToolTip="Number of Questions in this document" >
<TextBlock Text="{Binding FilteredItems.Count, StringFormat='Total Matches: {0}'}" FontWeight="Bold" FontSize="12" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="#00aff0" Margin="3" />
</Border>
</Grid>
</DataTemplate>
<DataTemplate x:Key="SameDocTemplate">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="120" />
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<fa:FontAwesome Icon="FileWordOutline" Foreground="#00aff0" FontSize="14" VerticalAlignment="Center" Margin="3" />
<TextBlock VerticalAlignment="Center" Margin="0,3" TextTrimming="CharacterEllipsis">
<Run Text="{Binding Doc1.SourcePath, Converter={StaticResource PathToFileNameConverter}}" />
(QAs: <Run Text="{Binding Count1, Mode=OneWay}" />)
</TextBlock>
</StackPanel>
<Border BorderBrush="#00aff0" BorderThickness="1" CornerRadius="5" Grid.Column="1" Margin="3"
HorizontalAlignment="Right" VerticalAlignment="Center" ToolTip="Number of Questions in this document" >
<TextBlock Text="{Binding FilteredItems.Count, StringFormat='Total Matches: {0}'}" FontWeight="Bold" FontSize="12" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="#00aff0" Margin="3" />
</Border>
</Grid>
</DataTemplate>
<local:MyTreeViewItemTemplateSelector x:Key="MyTreeViewItemTemplateSelector"
SameDocTemplate="{StaticResource SameDocTemplate}"
DifferentDocsTemplate="{StaticResource DifferentDocsTemplate}" />
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal" Panel.ZIndex="10" VerticalAlignment="Top" Height="48">
<StackPanel.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="ImageButtonStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
<Style TargetType="{x:Type DockPanel}">
<Setter Property="HorizontalAlignment" Value="Right" />
</Style>
</ResourceDictionary>
</StackPanel.Resources>
<TextBlock Text="Difference Threshold:" Grid.Column="1" VerticalAlignment="Center" Margin="3,0" />
<Slider VerticalAlignment="Center" Width="150" Margin="0,6"
Minimum="0.0" Maximum="0.5" SmallChange="0.05" LargeChange="0.1" TickFrequency="0.05" IsSnapToTickEnabled="True"
Value="{Binding SelectedProject.Graph.DiffThreshold}" Style="{StaticResource FancySliderStyle}" Focusable="False" />
<Button fa:Awesome.Content="Filter" FontSize="24" Style="{StaticResource ImageButtonStyle}" Focusable="False" Background="{x:Null}" BorderBrush="{x:Null}"
Foreground="#00aff0" Command="{Binding SelectedProject.ApplyDiffThresholdCommand}"
ToolTip="Filters results using difference threshold value" />
</StackPanel>
<TreeView Name="TV" Grid.Row="0" ItemsSource="{Binding SelectedProject.Graph.Results}" ScrollViewer.HorizontalScrollBarVisibility="Disabled" Margin="3"
BorderThickness="1" BorderBrush="LightGray" Padding="0,48,0,0">
<TreeView.ItemContainerStyle>
<Style TargetType="TreeViewItem" BasedOn="{StaticResource StretchedTreeViewItemStyle}">
<Setter Property="IsExpanded" Value="True" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<EventSetter Event="Expanded" Handler="TreeViewItem_Expanded" />
</Style>
</TreeView.ItemContainerStyle>
<TreeView.ItemTemplate>
<HierarchicalDataTemplate DataType="vm:DFResult" ItemsSource="{Binding FilteredItems}">
<Border BorderBrush="LightGray" BorderThickness="0,1,0,0" CornerRadius="3" Margin="0,6,0,0">
<ContentControl Content="{Binding}" ContentTemplateSelector="{StaticResource MyTreeViewItemTemplateSelector}" Margin="0,6,0,0" />
</Border>
<HierarchicalDataTemplate.ItemContainerStyle>
<Style TargetType="TreeViewItem" BasedOn="{StaticResource StretchedTreeViewItemStyle}">
<Setter Property="IsExpanded" Value="True" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="Margin" Value="0" />
<Setter Property="Padding" Value="0" />
</Style>
</HierarchicalDataTemplate.ItemContainerStyle>
<HierarchicalDataTemplate.ItemTemplate>
<DataTemplate DataType="vm:DFResultRow">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="120" />
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<fa:FontAwesome Icon="PuzzlePiece" FontSize="14" VerticalAlignment="Center" Margin="9,3" />
<TextBlock VerticalAlignment="Center" Margin="0,3" Width="100">
<Hyperlink NavigateUri="{Binding Q1.Doc.SourcePath}" RequestNavigate="Hyperlink_RequestNavigate">
Question <Run Text="{Binding Q1.Index, Mode=OneWay}" />
</Hyperlink>
</TextBlock>
</StackPanel>
<StackPanel Orientation="Horizontal" Grid.Column="1" HorizontalAlignment="Center">
<fa:FontAwesome Icon="PuzzlePiece" FontSize="14" VerticalAlignment="Center" Margin="9,3" />
<TextBlock VerticalAlignment="Center">
<Hyperlink NavigateUri="{Binding Q2.Doc.SourcePath}" RequestNavigate="Hyperlink_RequestNavigate2">
Question <Run Text="{Binding Q2.Index, Mode=OneWay}" />
</Hyperlink>
</TextBlock>
</StackPanel>
<Button Command="{Binding DataContext.SelectedProject.OpenDiffCommand, RelativeSource={RelativeSource AncestorType=TreeView}}" CommandParameter="{Binding}" ToolTip="Percent difference between the two QAs. Click to open diff window." FontSize="14" Grid.Column="2"
Background="{x:Null}" BorderBrush="{x:Null}" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,3,6" Cursor="Hand">
<Button.Style>
<Style TargetType="{x:Type Button}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border x:Name="ButtonBorder" BorderBrush="#00aff0" BorderThickness="1" CornerRadius="5" Grid.Column="3" VerticalAlignment="Center">
<TextBlock x:Name="ButtonText" Text="{Binding Distance, StringFormat={}{0:P0}}" FontWeight="Bold" FontSize="12" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="#00aff0" Margin="3" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="ButtonBorder" Property="Background" Value="#00aff0"/>
<Setter TargetName="ButtonText" Property="Foreground" Value="White"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Button.Style>
</Button>
</Grid>
</DataTemplate>
</HierarchicalDataTemplate.ItemTemplate>
</HierarchicalDataTemplate>
</TreeView.ItemTemplate>
</TreeView>
</Grid>
</UserControl>