From 31dd12ce269234ba70e534966a0a9dfc1ebdcefb Mon Sep 17 00:00:00 2001 From: Markus Quaritsch <markus.quaritsch@tugraz.at> Date: Tue, 5 Sep 2017 17:43:23 +0200 Subject: [PATCH] working on results view --- HashingTool/HashingTool.csproj | 14 + HashingTool/MainWindow.xaml | 3 + HashingTool/ViewModel/ApplicationViewModel.cs | 1 + .../ViewModel/VerifyJobInputDataViewModel.cs | 4 +- .../ViewModel/VerifyResultDataViewModel.cs | 227 ++++----- .../UserControl/VectoXMLFileSelector.xaml | 11 +- HashingTool/Views/VerifyJobInputData.xaml | 2 +- HashingTool/Views/VerifyResults.xaml | 432 ++++++++++++++++++ HashingTool/Views/VerifyResults.xaml.cs | 33 ++ 9 files changed, 587 insertions(+), 140 deletions(-) create mode 100644 HashingTool/Views/VerifyResults.xaml create mode 100644 HashingTool/Views/VerifyResults.xaml.cs diff --git a/HashingTool/HashingTool.csproj b/HashingTool/HashingTool.csproj index a0025fd3cf..afb0355b1f 100644 --- a/HashingTool/HashingTool.csproj +++ b/HashingTool/HashingTool.csproj @@ -88,6 +88,9 @@ <Compile Include="Views\HomeView.xaml.cs"> <DependentUpon>HomeView.xaml</DependentUpon> </Compile> + <Compile Include="Views\Test.xaml.cs"> + <DependentUpon>Test.xaml</DependentUpon> + </Compile> <Compile Include="Views\UserControl\VectoXMLFileSelector.xaml.cs"> <DependentUpon>VectoXMLFileSelector.xaml</DependentUpon> </Compile> @@ -100,6 +103,9 @@ <Compile Include="Views\VerifyJobInputData.xaml.cs"> <DependentUpon>VerifyJobInputData.xaml</DependentUpon> </Compile> + <Compile Include="Views\VerifyResults.xaml.cs"> + <DependentUpon>VerifyResults.xaml</DependentUpon> + </Compile> <Page Include="MainWindow.xaml"> <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> @@ -140,6 +146,10 @@ <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> </Page> + <Page Include="Views\Test.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> <Page Include="Views\UserControl\VectoXMLFileSelector.xaml"> <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> @@ -156,6 +166,10 @@ <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> </Page> + <Page Include="Views\VerifyResults.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> </ItemGroup> <ItemGroup> <Compile Include="Properties\AssemblyInfo.cs"> diff --git a/HashingTool/MainWindow.xaml b/HashingTool/MainWindow.xaml index e3e0ac4a0e..5478344d3a 100644 --- a/HashingTool/MainWindow.xaml +++ b/HashingTool/MainWindow.xaml @@ -21,6 +21,9 @@ <DataTemplate DataType="{x:Type viewModel:VerifyJobInputDataViewModel}"> <views:VerifyJobInputData /> </DataTemplate> + <DataTemplate DataType="{x:Type viewModel:VerifyResultDataViewModel}"> + <views:VerifyResults /> + </DataTemplate> </Window.Resources> <Grid Margin="10"> diff --git a/HashingTool/ViewModel/ApplicationViewModel.cs b/HashingTool/ViewModel/ApplicationViewModel.cs index 601fac71b7..517ac31dae 100644 --- a/HashingTool/ViewModel/ApplicationViewModel.cs +++ b/HashingTool/ViewModel/ApplicationViewModel.cs @@ -23,6 +23,7 @@ namespace HashingTool.ViewModel new HashComponentDataViewModel(this), new VerifyComponentInputDataViewModel(this), new VerifyJobInputDataViewModel(this), + new VerifyResultDataViewModel(this), }; CurrentViewModel = homeView; diff --git a/HashingTool/ViewModel/VerifyJobInputDataViewModel.cs b/HashingTool/ViewModel/VerifyJobInputDataViewModel.cs index 998903e30a..57730bd21d 100644 --- a/HashingTool/ViewModel/VerifyJobInputDataViewModel.cs +++ b/HashingTool/ViewModel/VerifyJobInputDataViewModel.cs @@ -24,7 +24,7 @@ namespace HashingTool.ViewModel _jobFile.PropertyChanged += JobFilechanged; // TODO! - CanonicalizaitionMethods = new ObservableCollection<string>() { + CanonicalizationMethods = new ObservableCollection<string>() { "urn:vecto:xml:2017:canonicalization", "http://www.w3.org/2001/10/xml-exc-c14n#" }; @@ -54,7 +54,7 @@ namespace HashingTool.ViewModel public ObservableCollection<ComponentEntry> Components { get; private set; } - public ObservableCollection<string> CanonicalizaitionMethods { get; private set; } + public ObservableCollection<string> CanonicalizationMethods { get; private set; } public string DigestValueComputed { diff --git a/HashingTool/ViewModel/VerifyResultDataViewModel.cs b/HashingTool/ViewModel/VerifyResultDataViewModel.cs index 9e271ba036..74c9248397 100644 --- a/HashingTool/ViewModel/VerifyResultDataViewModel.cs +++ b/HashingTool/ViewModel/VerifyResultDataViewModel.cs @@ -1,4 +1,8 @@ -using System.Windows.Input; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Windows.Input; +using HashingTool.Helper; using HashingTool.ViewModel.UserControl; namespace HashingTool.ViewModel @@ -6,31 +10,32 @@ namespace HashingTool.ViewModel public class VerifyResultDataViewModel : ObservableObject, IMainView { private ApplicationViewModel _applicationViewModel; - private XMLFile _jobFile; - private XMLFile _manufacturerReport; - private XMLFile _customerReport; - private string _jobDigestValue; - private string _manufacturerDigestComputed; - private string _manufacturerDigestRead; - private string _customerDigestComputed; - private string _customerDigestRead; - private bool? _manufacturerReportValid; - private bool? _customerReportValid; - private string _manufacturerReportJobDigest; - private string _customerReportJobDigest; - private bool _manufacturerReportJobDigestValid; - private bool _customerReportJobDigestValid; - - public VerifyResultDataViewModel() {} + private HashedXMLFile _jobFile; + private HashedXMLFile _customerReport; + private HashedXMLFile _manufacturerReport; + + public VerifyResultDataViewModel() + { + _jobFile = new HashedXMLFile(_ioService, "Job File"); + _manufacturerReport = new HashedXMLFile(_ioService, "Manufacturer Report"); + _customerReport = new HashedXMLFile(_ioService, "Customer Report"); + Files = new ObservableCollection<HashedXMLFile>(); + Files.Add(_jobFile); + Files.Add(_manufacturerReport); + Files.Add(_customerReport); + + CanonicalizationMethods = new ObservableCollection<string>() { "urn:vecto:xml:2017:canonicalization" }; + RaisePropertyChanged("CanonicalizationMethods"); + } public VerifyResultDataViewModel(ApplicationViewModel applicationViewModel) : this() { _applicationViewModel = applicationViewModel; - _jobFile = new XMLFile(_ioService, true); - _manufacturerReport = new XMLFile(_ioService, true); - _customerReport = new XMLFile(_ioService, true); + } + public ObservableCollection<string> CanonicalizationMethods { get; private set; } + public string Name { get { return "Verify Result Data"; } @@ -41,151 +46,105 @@ namespace HashingTool.ViewModel get { return ApplicationViewModel.HomeView; } } - public XMLFile JobFile + public HashedXMLFile JobFile { get { return _jobFile; } } - public XMLFile ManufacturerReport - { - get { return _manufacturerReport; } - } - public XMLFile CustomerReport + public HashedXMLFile CustomerReport { get { return _customerReport; } } - public string JobDigestValueComputed + public HashedXMLFile ManufacturerReport { - get { return _jobDigestValue; } - private set { - if (_jobDigestValue == value) { - return; - } - _jobDigestValue = value; - RaisePropertyChanged("JobDigestValueComputed"); - } + get { return _manufacturerReport; } } - public string ManufacturerReportDigestValueComputed - { - get { return _manufacturerDigestComputed; } - private set { - if (_manufacturerDigestComputed == value) { - return; - } - _manufacturerDigestComputed = value; - RaisePropertyChanged("ManufacturerReportDigestValueComputed"); - } - } + public ObservableCollection<HashedXMLFile> Files { get; private set; } - public string ManufacturerReportDigestValueRead - { - get { return _manufacturerDigestRead; } - private set { - if (_manufacturerDigestRead == value) { - return; - } - _manufacturerDigestRead = value; - RaisePropertyChanged("ManufacturerReportDigestValueRead"); - } - } - public bool? ManufacturerReportValid + public class HashedXMLFile : ObservableObject { - get { return _manufacturerReportValid; } - private set { - if (_manufacturerReportValid == value) { - return; - } - _manufacturerReportValid = value; - RaisePropertyChanged("ManufacturerReportValid"); - } - } + private XMLFile _xmlFile; - public string CustomerReportDigestValueComputed - { - get { return _customerDigestComputed; } - private set { - if (_customerDigestComputed == value) { - return; - } - _customerDigestComputed = value; - RaisePropertyChanged("CustomerReportDigestValueComputed"); - } - } + private string _manufacturerDigestComputed; + private string _manufacturerDigestRead; + private bool? _valid; + private string _name; - public string CustomerReportDigestValueRead - { - get { return _customerDigestRead; } - private set { - if (_customerDigestRead == value) { - return; - } - _customerDigestRead = value; - RaisePropertyChanged("CustomerReportDigestValueRead"); + + public HashedXMLFile(IOService ioService, string name) + { + _ioService = ioService; + _xmlFile = new XMLFile(_ioService, true); + Name = name; + + CanonicalizationMethods = new[] { + "urn:vecto:xml:2017:canonicalization", + "http://www.w3.org/2001/10/xml-exc-c14n#" + }; + Valid = true; } - } - public bool? CustomerReportValid - { - get { return _customerReportValid; } - private set { - if (_customerReportValid == value) { - return; - } - _customerReportValid = value; - RaisePropertyChanged("CustomerReportValid"); + public HashedXMLFile() {} + + + public XMLFile XMLFile + { + get { return _xmlFile; } } - } - public string ManufacturerReportJobDigestValue - { - get { return _manufacturerReportJobDigest; } - private set { - if (_manufacturerReportJobDigest == value) { - return; + public string Name + { + get { return _name; } + private set { + if (_name == value) { + return; + } + _name = value; + RaisePropertyChanged("Name"); } - _manufacturerReportJobDigest = value; - RaisePropertyChanged("ManufacturerReportJobDigestValue"); } - } - public string CustomerReportJobDigestValue - { - get { return _customerReportJobDigest; } - private set { - if (_customerReportJobDigest == value) { - return; + public string[] CanonicalizationMethods { get; private set; } + + + public string DigestValueComputed + { + get { return _manufacturerDigestComputed; } + private set { + if (_manufacturerDigestComputed == value) { + return; + } + _manufacturerDigestComputed = value; + RaisePropertyChanged("DigestValueComputed"); } - _customerReportJobDigest = value; - RaisePropertyChanged("CustomerReportJobDigestValue"); } - } - - public bool ManufacturerReportJobDigestValid - { - get { return _manufacturerReportJobDigestValid; } - private set { - if (_manufacturerReportJobDigestValid == value) { - return; + public string DigestValueRead + { + get { return _manufacturerDigestRead; } + private set { + if (_manufacturerDigestRead == value) { + return; + } + _manufacturerDigestRead = value; + RaisePropertyChanged("DigestValueRead"); } - _manufacturerReportJobDigestValid = value; - RaisePropertyChanged("ManufacturerReportJobDigestValid"); } - } - public bool CustomerReportJobDigestValid - { - get { return _customerReportJobDigestValid; } - private set { - if (_customerReportJobDigestValid == value) { - return; + public bool? Valid + { + get { return _valid; } + private set { + if (_valid == value) { + return; + } + _valid = value; + RaisePropertyChanged("Valid"); } - _customerReportJobDigestValid = value; - RaisePropertyChanged("CustomerReportJobDigestValid"); } } } diff --git a/HashingTool/Views/UserControl/VectoXMLFileSelector.xaml b/HashingTool/Views/UserControl/VectoXMLFileSelector.xaml index 5a6786c0e8..fce60ce4f2 100644 --- a/HashingTool/Views/UserControl/VectoXMLFileSelector.xaml +++ b/HashingTool/Views/UserControl/VectoXMLFileSelector.xaml @@ -22,12 +22,15 @@ <ContentControl.Style> <Style TargetType="ContentControl"> <Setter Property="ContentTemplate" Value="{StaticResource ICON_XML_unknown}" /> + <Setter Property="ToolTip" Value="Not validated" /> <Style.Triggers> <DataTrigger Binding="{Binding XMLFile.IsValid}" Value="True"> <Setter Property="ContentTemplate" Value="{StaticResource Icon_XML_OK}" /> + <Setter Property="ToolTip" Value="Valid XML" /> </DataTrigger> <DataTrigger Binding="{Binding XMLFile.IsValid}" Value="False"> <Setter Property="ContentTemplate" Value="{StaticResource Icon_XML_NOK}" /> + <Setter Property="ToolTip" Value="Invalid XML" /> </DataTrigger> </Style.Triggers> </Style> @@ -37,10 +40,11 @@ <StackPanel Orientation="Horizontal" Margin="10,44,0,10"> <StackPanel.Style> <Style TargetType="StackPanel"> - <Setter Property="Visibility" Value="{Binding XMLFile.ValidateInput, Converter={StaticResource BoolToVis}}"/> + <Setter Property="Visibility" Value="{Binding XMLFile.ValidateInput, Converter={StaticResource BoolToVis}}" /> </Style> </StackPanel.Style> - <Label Content="{Binding XMLFile.XMLValidationErrors.Count}" ContentStringFormat="{}{0} Warnings/Errors" MinWidth="80"> + <Label Content="{Binding XMLFile.XMLValidationErrors.Count}" ContentStringFormat="{}{0} Warnings/Errors" + MinWidth="80"> <Label.Style> <Style TargetType="Label"> <Setter Property="Foreground" Value="Red" /> @@ -52,7 +56,8 @@ </Style> </Label.Style> </Label> - <Button x:Name="btnDetails" Margin="10,0,0,0" Content="Details..." HorizontalAlignment="Left" Width="91" Click="btnDetails_Click"> + <Button x:Name="btnDetails" Margin="10,0,0,0" Content="Details..." HorizontalAlignment="Left" Width="91" + Click="btnDetails_Click"> <Button.Style> <Style TargetType="Button"> <Setter Property="IsEnabled" Value="True" /> diff --git a/HashingTool/Views/VerifyJobInputData.xaml b/HashingTool/Views/VerifyJobInputData.xaml index 72b8d075e2..da4bc3d8df 100644 --- a/HashingTool/Views/VerifyJobInputData.xaml +++ b/HashingTool/Views/VerifyJobInputData.xaml @@ -35,7 +35,7 @@ </Grid.RowDefinitions> <Grid Grid.Row="1" Margin="0,5"> <Label Content="Canonicalization methods:" /> - <TextBox Text="{Binding CanonicalizaitionMethods , Converter={StaticResource CollectionConverter}}" + <TextBox Text="{Binding CanonicalizationMethods , Converter={StaticResource CollectionConverter}}" Margin="155,0,10,0" IsReadOnly="True" /> </Grid> <Grid Grid.Row="2" Margin="0,5"> diff --git a/HashingTool/Views/VerifyResults.xaml b/HashingTool/Views/VerifyResults.xaml new file mode 100644 index 0000000000..d39f23bd9a --- /dev/null +++ b/HashingTool/Views/VerifyResults.xaml @@ -0,0 +1,432 @@ +<UserControl + 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:ViewModel="clr-namespace:HashingTool.ViewModel" + xmlns:views="clr-namespace:HashingTool.Views" + xmlns:hashingTool="clr-namespace:HashingTool" + xmlns:helper="clr-namespace:HashingTool.Helper" + x:Class="HashingTool.Views.VerifyResults" + mc:Ignorable="d" Height="437.5" Width="550"> + <UserControl.DataContext> + <ViewModel:VerifyResultDataViewModel /> + </UserControl.DataContext> + <UserControl.Resources> + <helper:CollectionConverter x:Key="CollectionConverter" /> + <BooleanToVisibilityConverter x:Key="Bool2Vis" /> + + <SolidColorBrush x:Key="Expander.MouseOver.Circle.Stroke" Color="#FF3C7FB1" /> + <SolidColorBrush x:Key="Expander.MouseOver.Circle.Fill" Color="Transparent" /> + <SolidColorBrush x:Key="Expander.MouseOver.Arrow.Stroke" Color="#222" /> + <SolidColorBrush x:Key="Expander.Pressed.Circle.Stroke" Color="#FF526C7B" /> + <SolidColorBrush x:Key="Expander.Pressed.Circle.Fill" Color="Transparent" /> + <SolidColorBrush x:Key="Expander.Pressed.Arrow.Stroke" Color="#FF003366" /> + <SolidColorBrush x:Key="Expander.Disabled.Circle.Stroke" Color="DarkGray" /> + <SolidColorBrush x:Key="Expander.Disabled.Circle.Fill" Color="Transparent" /> + <SolidColorBrush x:Key="Expander.Disabled.Arrow.Stroke" Color="#666" /> + <SolidColorBrush x:Key="Expander.Static.Circle.Fill" Color="Transparent" /> + <SolidColorBrush x:Key="Expander.Static.Circle.Stroke" Color="DarkGray" /> + <SolidColorBrush x:Key="Expander.Static.Arrow.Stroke" Color="#666" /> + <Style x:Key="ExpanderRightHeaderStyle" TargetType="{x:Type ToggleButton}"> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="{x:Type ToggleButton}"> + <Border Padding="{TemplateBinding Padding}"> + <Grid Background="Transparent" SnapsToDevicePixels="False"> + <Grid.RowDefinitions> + <RowDefinition Height="19" /> + <RowDefinition Height="*" /> + </Grid.RowDefinitions> + <Grid> + <Grid.LayoutTransform> + <TransformGroup> + <TransformGroup.Children> + <TransformCollection> + <RotateTransform Angle="-90" /> + </TransformCollection> + </TransformGroup.Children> + </TransformGroup> + </Grid.LayoutTransform> + <Ellipse x:Name="circle" Fill="{StaticResource Expander.Static.Circle.Fill}" HorizontalAlignment="Center" + Height="19" Stroke="{StaticResource Expander.Static.Circle.Stroke}" VerticalAlignment="Center" Width="19" /> + <Path x:Name="arrow" Data="M 1,1.5 L 4.5,5 L 8,1.5" HorizontalAlignment="Center" SnapsToDevicePixels="false" + Stroke="{StaticResource Expander.Static.Arrow.Stroke}" StrokeThickness="2" VerticalAlignment="Center" /> + </Grid> + <ContentPresenter HorizontalAlignment="Center" Margin="0,4,0,0" Grid.Row="1" RecognizesAccessKey="True" + SnapsToDevicePixels="True" VerticalAlignment="Top" /> + </Grid> + </Border> + <ControlTemplate.Triggers> + <Trigger Property="IsChecked" Value="true"> + <Setter Property="Data" TargetName="arrow" Value="M 1,4.5 L 4.5,1 L 8,4.5" /> + </Trigger> + <Trigger Property="IsMouseOver" Value="true"> + <Setter Property="Stroke" TargetName="circle" Value="{StaticResource Expander.MouseOver.Circle.Stroke}" /> + <Setter Property="Fill" TargetName="circle" Value="{StaticResource Expander.MouseOver.Circle.Fill}" /> + <Setter Property="Stroke" TargetName="arrow" Value="{StaticResource Expander.MouseOver.Arrow.Stroke}" /> + </Trigger> + <Trigger Property="IsPressed" Value="true"> + <Setter Property="Stroke" TargetName="circle" Value="{StaticResource Expander.Pressed.Circle.Stroke}" /> + <Setter Property="StrokeThickness" TargetName="circle" Value="1.5" /> + <Setter Property="Fill" TargetName="circle" Value="{StaticResource Expander.Pressed.Circle.Fill}" /> + <Setter Property="Stroke" TargetName="arrow" Value="{StaticResource Expander.Pressed.Arrow.Stroke}" /> + </Trigger> + <Trigger Property="IsEnabled" Value="false"> + <Setter Property="Stroke" TargetName="circle" Value="{StaticResource Expander.Disabled.Circle.Stroke}" /> + <Setter Property="Fill" TargetName="circle" Value="{StaticResource Expander.Disabled.Circle.Fill}" /> + <Setter Property="Stroke" TargetName="arrow" Value="{StaticResource Expander.Disabled.Arrow.Stroke}" /> + </Trigger> + </ControlTemplate.Triggers> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + <Style x:Key="ExpanderUpHeaderStyle" TargetType="{x:Type ToggleButton}"> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="{x:Type ToggleButton}"> + <Border Padding="{TemplateBinding Padding}"> + <Grid Background="Transparent" SnapsToDevicePixels="False"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="19" /> + <ColumnDefinition Width="*" /> + </Grid.ColumnDefinitions> + <Grid> + <Grid.LayoutTransform> + <TransformGroup> + <TransformGroup.Children> + <TransformCollection> + <RotateTransform Angle="180" /> + </TransformCollection> + </TransformGroup.Children> + </TransformGroup> + </Grid.LayoutTransform> + <Ellipse x:Name="circle" Fill="{StaticResource Expander.Static.Circle.Fill}" HorizontalAlignment="Center" + Height="19" Stroke="{StaticResource Expander.Static.Circle.Stroke}" VerticalAlignment="Center" Width="19" /> + <Path x:Name="arrow" Data="M 1,1.5 L 4.5,5 L 8,1.5" HorizontalAlignment="Center" SnapsToDevicePixels="false" + Stroke="{StaticResource Expander.Static.Arrow.Stroke}" StrokeThickness="2" VerticalAlignment="Center" /> + </Grid> + <ContentPresenter Grid.Column="1" HorizontalAlignment="Left" Margin="4,0,0,0" RecognizesAccessKey="True" + SnapsToDevicePixels="True" VerticalAlignment="Center" /> + </Grid> + </Border> + <ControlTemplate.Triggers> + <Trigger Property="IsChecked" Value="true"> + <Setter Property="Data" TargetName="arrow" Value="M 1,4.5 L 4.5,1 L 8,4.5" /> + </Trigger> + <Trigger Property="IsMouseOver" Value="true"> + <Setter Property="Stroke" TargetName="circle" Value="{StaticResource Expander.MouseOver.Circle.Stroke}" /> + <Setter Property="Fill" TargetName="circle" Value="{StaticResource Expander.MouseOver.Circle.Fill}" /> + <Setter Property="Stroke" TargetName="arrow" Value="{StaticResource Expander.MouseOver.Arrow.Stroke}" /> + </Trigger> + <Trigger Property="IsPressed" Value="true"> + <Setter Property="Stroke" TargetName="circle" Value="{StaticResource Expander.Pressed.Circle.Stroke}" /> + <Setter Property="StrokeThickness" TargetName="circle" Value="1.5" /> + <Setter Property="Fill" TargetName="circle" Value="{StaticResource Expander.Pressed.Circle.Fill}" /> + <Setter Property="Stroke" TargetName="arrow" Value="{StaticResource Expander.Pressed.Arrow.Stroke}" /> + </Trigger> + <Trigger Property="IsEnabled" Value="false"> + <Setter Property="Stroke" TargetName="circle" Value="{StaticResource Expander.Disabled.Circle.Stroke}" /> + <Setter Property="Fill" TargetName="circle" Value="{StaticResource Expander.Disabled.Circle.Fill}" /> + <Setter Property="Stroke" TargetName="arrow" Value="{StaticResource Expander.Disabled.Arrow.Stroke}" /> + </Trigger> + </ControlTemplate.Triggers> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + <Style x:Key="ExpanderLeftHeaderStyle" TargetType="{x:Type ToggleButton}"> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="{x:Type ToggleButton}"> + <Border Padding="{TemplateBinding Padding}"> + <Grid Background="Transparent" SnapsToDevicePixels="False"> + <Grid.RowDefinitions> + <RowDefinition Height="19" /> + <RowDefinition Height="*" /> + </Grid.RowDefinitions> + <Grid> + <Grid.LayoutTransform> + <TransformGroup> + <TransformGroup.Children> + <TransformCollection> + <RotateTransform Angle="90" /> + </TransformCollection> + </TransformGroup.Children> + </TransformGroup> + </Grid.LayoutTransform> + <Ellipse x:Name="circle" Fill="{StaticResource Expander.Static.Circle.Fill}" HorizontalAlignment="Center" + Height="19" Stroke="{StaticResource Expander.Static.Circle.Stroke}" VerticalAlignment="Center" Width="19" /> + <Path x:Name="arrow" Data="M 1,1.5 L 4.5,5 L 8,1.5" HorizontalAlignment="Center" SnapsToDevicePixels="false" + Stroke="{StaticResource Expander.Static.Arrow.Stroke}" StrokeThickness="2" VerticalAlignment="Center" /> + </Grid> + <ContentPresenter HorizontalAlignment="Center" Margin="0,4,0,0" Grid.Row="1" RecognizesAccessKey="True" + SnapsToDevicePixels="True" VerticalAlignment="Top" /> + </Grid> + </Border> + <ControlTemplate.Triggers> + <Trigger Property="IsChecked" Value="true"> + <Setter Property="Data" TargetName="arrow" Value="M 1,4.5 L 4.5,1 L 8,4.5" /> + </Trigger> + <Trigger Property="IsMouseOver" Value="true"> + <Setter Property="Stroke" TargetName="circle" Value="{StaticResource Expander.MouseOver.Circle.Stroke}" /> + <Setter Property="Fill" TargetName="circle" Value="{StaticResource Expander.MouseOver.Circle.Fill}" /> + <Setter Property="Stroke" TargetName="arrow" Value="{StaticResource Expander.MouseOver.Arrow.Stroke}" /> + </Trigger> + <Trigger Property="IsPressed" Value="true"> + <Setter Property="Stroke" TargetName="circle" Value="{StaticResource Expander.Pressed.Circle.Stroke}" /> + <Setter Property="StrokeThickness" TargetName="circle" Value="1.5" /> + <Setter Property="Fill" TargetName="circle" Value="{StaticResource Expander.Pressed.Circle.Fill}" /> + <Setter Property="Stroke" TargetName="arrow" Value="{StaticResource Expander.Pressed.Arrow.Stroke}" /> + </Trigger> + <Trigger Property="IsEnabled" Value="false"> + <Setter Property="Stroke" TargetName="circle" Value="{StaticResource Expander.Disabled.Circle.Stroke}" /> + <Setter Property="Fill" TargetName="circle" Value="{StaticResource Expander.Disabled.Circle.Fill}" /> + <Setter Property="Stroke" TargetName="arrow" Value="{StaticResource Expander.Disabled.Arrow.Stroke}" /> + </Trigger> + </ControlTemplate.Triggers> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + <Style x:Key="ExpanderHeaderFocusVisual"> + <Setter Property="Control.Template"> + <Setter.Value> + <ControlTemplate> + <Border> + <Rectangle Margin="0" SnapsToDevicePixels="true" Stroke="Black" StrokeThickness="1" StrokeDashArray="1 2" /> + </Border> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + <Style x:Key="ExpanderDownHeaderStyle" TargetType="{x:Type ToggleButton}"> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="{x:Type ToggleButton}"> + <Border Padding="{TemplateBinding Padding}"> + <Grid Background="Transparent" SnapsToDevicePixels="False"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="19" /> + <ColumnDefinition Width="*" /> + </Grid.ColumnDefinitions> + <Ellipse x:Name="circle" Fill="{StaticResource Expander.Static.Circle.Fill}" HorizontalAlignment="Center" + Height="19" Stroke="{StaticResource Expander.Static.Circle.Stroke}" VerticalAlignment="Center" Width="19" /> + <Path x:Name="arrow" Data="M 1,1.5 L 4.5,5 L 8,1.5" HorizontalAlignment="Center" SnapsToDevicePixels="false" + Stroke="{StaticResource Expander.Static.Arrow.Stroke}" StrokeThickness="2" VerticalAlignment="Center" /> + <ContentPresenter Grid.Column="1" HorizontalAlignment="{TemplateBinding HorizontalAlignment}" Margin="4,0,0,0" + RecognizesAccessKey="True" SnapsToDevicePixels="True" VerticalAlignment="Center" /> + </Grid> + </Border> + <ControlTemplate.Triggers> + <Trigger Property="IsChecked" Value="true"> + <Setter Property="Data" TargetName="arrow" Value="M 1,4.5 L 4.5,1 L 8,4.5" /> + </Trigger> + <Trigger Property="IsMouseOver" Value="true"> + <Setter Property="Stroke" TargetName="circle" Value="{StaticResource Expander.MouseOver.Circle.Stroke}" /> + <Setter Property="Fill" TargetName="circle" Value="{StaticResource Expander.MouseOver.Circle.Fill}" /> + <Setter Property="Stroke" TargetName="arrow" Value="{StaticResource Expander.MouseOver.Arrow.Stroke}" /> + </Trigger> + <Trigger Property="IsPressed" Value="true"> + <Setter Property="Stroke" TargetName="circle" Value="{StaticResource Expander.Pressed.Circle.Stroke}" /> + <Setter Property="StrokeThickness" TargetName="circle" Value="1.5" /> + <Setter Property="Fill" TargetName="circle" Value="{StaticResource Expander.Pressed.Circle.Fill}" /> + <Setter Property="Stroke" TargetName="arrow" Value="{StaticResource Expander.Pressed.Arrow.Stroke}" /> + </Trigger> + <Trigger Property="IsEnabled" Value="false"> + <Setter Property="Stroke" TargetName="circle" Value="{StaticResource Expander.Disabled.Circle.Stroke}" /> + <Setter Property="Fill" TargetName="circle" Value="{StaticResource Expander.Disabled.Circle.Fill}" /> + <Setter Property="Stroke" TargetName="arrow" Value="{StaticResource Expander.Disabled.Arrow.Stroke}" /> + </Trigger> + </ControlTemplate.Triggers> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + <Style x:Key="ExpanderStyle1" TargetType="{x:Type Expander}"> + <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" /> + <Setter Property="Background" Value="Transparent" /> + <Setter Property="HorizontalContentAlignment" Value="Stretch" /> + <Setter Property="VerticalContentAlignment" Value="Stretch" /> + <Setter Property="BorderBrush" Value="Transparent" /> + <Setter Property="BorderThickness" Value="1" /> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="{x:Type Expander}"> + <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" + Background="{TemplateBinding Background}" CornerRadius="3" SnapsToDevicePixels="true"> + <DockPanel> + <ToggleButton x:Name="HeaderSite" ContentTemplate="{TemplateBinding HeaderTemplate}" + ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}" Content="{TemplateBinding Header}" + DockPanel.Dock="Top" Foreground="{TemplateBinding Foreground}" FontWeight="{TemplateBinding FontWeight}" + FocusVisualStyle="{StaticResource ExpanderHeaderFocusVisual}" FontStyle="{TemplateBinding FontStyle}" + FontStretch="{TemplateBinding FontStretch}" FontSize="{TemplateBinding FontSize}" + FontFamily="{TemplateBinding FontFamily}" + HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" + IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Margin="1" + MinWidth="0" MinHeight="0" Padding="{TemplateBinding Padding}" + Style="{StaticResource ExpanderDownHeaderStyle}" + VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" /> + <ContentPresenter x:Name="ExpandSite" DockPanel.Dock="Bottom" Focusable="false" + HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" + Visibility="Collapsed" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" /> + </DockPanel> + </Border> + <ControlTemplate.Triggers> + <Trigger Property="IsExpanded" Value="true"> + <Setter Property="Visibility" TargetName="ExpandSite" Value="Visible" /> + </Trigger> + <Trigger Property="ExpandDirection" Value="Right"> + <Setter Property="DockPanel.Dock" TargetName="ExpandSite" Value="Right" /> + <Setter Property="DockPanel.Dock" TargetName="HeaderSite" Value="Left" /> + <Setter Property="Style" TargetName="HeaderSite" Value="{StaticResource ExpanderRightHeaderStyle}" /> + </Trigger> + <Trigger Property="ExpandDirection" Value="Up"> + <Setter Property="DockPanel.Dock" TargetName="ExpandSite" Value="Top" /> + <Setter Property="DockPanel.Dock" TargetName="HeaderSite" Value="Bottom" /> + <Setter Property="Style" TargetName="HeaderSite" Value="{StaticResource ExpanderUpHeaderStyle}" /> + </Trigger> + <Trigger Property="ExpandDirection" Value="Left"> + <Setter Property="DockPanel.Dock" TargetName="ExpandSite" Value="Left" /> + <Setter Property="DockPanel.Dock" TargetName="HeaderSite" Value="Right" /> + <Setter Property="Style" TargetName="HeaderSite" Value="{StaticResource ExpanderLeftHeaderStyle}" /> + </Trigger> + <Trigger Property="IsEnabled" Value="false"> + <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" /> + </Trigger> + </ControlTemplate.Triggers> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + </UserControl.Resources> + + <Grid> + + <Button x:Name="btnBack" Content="Back" Command="{Binding ShowHomeViewCommand}" Margin="0,0,10,10" + HorizontalAlignment="Right" + Width="75" Height="22" VerticalAlignment="Bottom" /> + <Label x:Name="lblHeader" HorizontalAlignment="Center" Margin="10,10,0,0" VerticalAlignment="Top" + Content="{Binding Name}" FontWeight="Bold" FontSize="18" /> + <Grid Margin="0,80,0,0"> + <Grid.RowDefinitions> + <RowDefinition Height="*" MaxHeight="300" /> + <RowDefinition Height="Auto" /> + </Grid.RowDefinitions> + + + <ScrollViewer Grid.Row="0" VerticalScrollBarVisibility="Auto" + Margin="10,0"> + + <ItemsControl ItemsSource="{Binding Files}" Name="lstInput" Height="365"> + <ItemsControl.ItemTemplate> + <DataTemplate> + <Expander Margin="4" Header="{Binding}"> + <Expander.HeaderTemplate> + <DataTemplate> + <Grid HorizontalAlignment="Stretch"> + <Grid.ColumnDefinitions> + <ColumnDefinition MinWidth="350" /> + <ColumnDefinition Width="50" /> + </Grid.ColumnDefinitions> + <Grid.RowDefinitions> + <RowDefinition /> + <RowDefinition Height="35" /> + </Grid.RowDefinitions> + <TextBlock Grid.Row="0" Grid.Column="0" Text="{Binding Name}"/> + <views:VectoXMLFileSelector Grid.Row="1" Grid.Column="0" Margin="0,0,0,0" VerticalAlignment="Top" + XMLFile="{Binding XMLFile}" Height="31" /> + <StackPanel Grid.Row="1" Grid.Column="1" VerticalAlignment="Top" Width="16" Height="16" + HorizontalAlignment="Right"> + <ContentControl Visibility="{Binding Valid, Converter={StaticResource Bool2Vis}}"> + <ContentControl.RenderTransform> + <ScaleTransform ScaleX=".4" ScaleY=".4" /> + </ContentControl.RenderTransform> + <ContentControl.Style> + <Style TargetType="ContentControl"> + <Setter Property="Content" Value="" /> + <Setter Property="ToolTip" Value="Not Validated" /> + <Style.Triggers> + <DataTrigger Binding="{Binding Valid}" Value="True"> + <Setter Property="ContentTemplate" Value="{StaticResource Icon_OK}" /> + <Setter Property="ToolTip" Value="Digest Values match" /> + </DataTrigger> + <DataTrigger Binding="{Binding Valid}" Value="False"> + <Setter Property="ContentTemplate" Value="{StaticResource Icon_NOK}" /> + <Setter Property="ToolTip" Value="Digest Values do NOT match" /> + </DataTrigger> + </Style.Triggers> + </Style> + </ContentControl.Style> + </ContentControl> + + </StackPanel> + </Grid> + </DataTemplate> + </Expander.HeaderTemplate> + <Expander.Content> + <Border BorderBrush="{x:Static SystemColors.ControlDarkBrush}" BorderThickness="0,0,0,1"> + <Grid> + <Grid.RowDefinitions> + <RowDefinition /> + <RowDefinition /> + <RowDefinition /> + <RowDefinition /> + </Grid.RowDefinitions> + <StackPanel Orientation="Horizontal" Grid.Row="0"> + <Label> + <Label.Content> + <TextBlock Text="{Binding XMLFile.XMLValidationErrors.Count, StringFormat='{}{0} Warnings/Errors'}" /> + </Label.Content> + <Label.Style> + <Style TargetType="Label"> + <Setter Property="Foreground" Value="Red" /> + <Style.Triggers> + <DataTrigger Binding="{Binding XMLFile.XMLValidationErrors.Count}" Value="0"> + <Setter Property="Foreground" Value="Black" /> + </DataTrigger> + </Style.Triggers> + </Style> + </Label.Style> + </Label> + <Button Margin="10,0,0,0" Content="Details..." HorizontalAlignment="Left" Width="91"> + <Button.Style> + <Style TargetType="Button"> + <Setter Property="IsEnabled" Value="True" /> + <Style.Triggers> + <DataTrigger Binding="{Binding XMLFile.XMLValidationErrors.Count}" Value="0"> + <Setter Property="IsEnabled" Value="False" /> + </DataTrigger> + </Style.Triggers> + </Style> + </Button.Style> + </Button> + </StackPanel> + <Grid Row="1" Margin="10,13,0,3"> + <Label Content="Canonicalization methods:" /> + <TextBox Text="{Binding CanonicalizationMethods , Converter={StaticResource CollectionConverter}}" + Margin="155,0,10,0" IsReadOnly="True" /> + </Grid> + <Grid Row="2" Margin="10,2,0,3"> + <Label Content="Digest Value read:" /> + <TextBox Text="{Binding Name}" + Margin="155,0,10,0" IsReadOnly="True" /> + </Grid> + <Grid Row="3" Margin="10,2,0,3"> + <Label Content="Digest Value computed:" /> + <TextBox Text="{Binding DigestValueComputed}" + Margin="155,0,10,0" IsReadOnly="True" /> + </Grid> + </Grid> + </Border> + </Expander.Content> + </Expander> + </DataTemplate> + </ItemsControl.ItemTemplate> + + </ItemsControl> + </ScrollViewer> + </Grid> + </Grid> +</UserControl> \ No newline at end of file diff --git a/HashingTool/Views/VerifyResults.xaml.cs b/HashingTool/Views/VerifyResults.xaml.cs new file mode 100644 index 0000000000..4450573b02 --- /dev/null +++ b/HashingTool/Views/VerifyResults.xaml.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; +using HashingTool.ViewModel.UserControl; + +namespace HashingTool.Views +{ + /// <summary> + /// Interaction logic for VerifyResults.xaml + /// </summary> + /// + + + + public partial class VerifyResults : UserControl + { + public VerifyResults() + { + InitializeComponent(); + } + } +} -- GitLab