Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit ae16bf6f authored by Markus Quaritsch's avatar Markus Quaritsch
Browse files

more polishing, adding missing file

parent 6a508eb0
No related branches found
No related tags found
No related merge requests found
Showing
with 894 additions and 607 deletions
......@@ -9,7 +9,9 @@
<ResourceDictionary Source="Resources/Icon_XML_NOK.xaml" />
<ResourceDictionary Source="Resources/Icon_OK.xaml" />
<ResourceDictionary Source="Resources/Icon_NOK.xaml" />
<ResourceDictionary Source="Resources/UserInterfaceResources.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
\ No newline at end of file
......@@ -136,6 +136,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Resources\UserInterfaceResources.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\HashComponentData.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
......
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<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="HeaderStretchExpanderStyle" 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>
<Style x:Key="DigestValueLabelStyle">
<Setter Property="Label.FontSize" Value="16" />
</Style>
<Style x:Key="DigestValueTextboxStyle">
<Setter Property="TextBox.FontFamily" Value="Courier New" />
<Setter Property="TextBox.FontWeight" Value="Bold" />
<Setter Property="Label.FontSize" Value="16" />
</Style>
<SolidColorBrush x:Key="Color.SuccessGreen" Color="#FF00A500" />
<SolidColorBrush x:Key="Color.ErrorRed" Color="#FFFF0000" />
</ResourceDictionary>
\ No newline at end of file
......@@ -18,12 +18,12 @@ namespace HashingTool.ViewModel
public ApplicationViewModel()
{
var homeView = new HomeViewModel(this);
var homeView = new HomeViewModel();
AvailableViews = new List<IMainView> {
new HashComponentDataViewModel(this),
new VerifyComponentInputDataViewModel(this),
new VerifyJobInputDataViewModel(this),
new VerifyResultDataViewModel(this),
new HashComponentDataViewModel(),
new VerifyComponentInputDataViewModel(),
new VerifyJobInputDataViewModel(),
new VerifyResultDataViewModel(),
};
CurrentViewModel = homeView;
......
......@@ -46,11 +46,7 @@ namespace HashingTool.ViewModel
};
}
public HashComponentDataViewModel(ApplicationViewModel applicationViewModel) : this()
{
_applicationViewModel = applicationViewModel;
}
public string Name
{
get { return "Hash Component Data"; }
......
using System;
using System.ComponentModel;
using System.Xml;
using HashingTool.Helper;
using HashingTool.ViewModel.UserControl;
namespace HashingTool.ViewModel
{
public class VectoXMLFile : ObservableObject
{
protected readonly XMLFile _xmlFile;
protected string _manufacturerDigestComputed;
protected bool? _valid;
protected string _name;
protected string _tooltip;
protected readonly Func<XmlDocument, bool?> _contentCheck;
protected string _componentType;
protected readonly Action<XmlDocument, VectoXMLFile> _validateHashes;
public VectoXMLFile(IOService ioService, string name, Func<XmlDocument, bool?> contentCheck,
Action<XmlDocument, VectoXMLFile> hashValidation = null)
{
IoService = ioService;
_validateHashes = hashValidation;
_xmlFile = new XMLFile(IoService, true);
_xmlFile.PropertyChanged += FileChanged;
Name = name;
_contentCheck = contentCheck;
// TODO
CanonicalizationMethods = new[] {
"urn:vecto:xml:2017:canonicalization",
"http://www.w3.org/2001/10/xml-exc-c14n#"
};
Valid = null;
ValidTooltip = VerifyResultDataViewModel.ToolTip_None;
}
protected virtual void FileChanged(object sender, PropertyChangedEventArgs e)
{
if (_xmlFile.IsValid != null && XMLFile.IsValid.HasValue && _xmlFile.IsValid.Value) {
Valid = _contentCheck(_xmlFile.Document);
if (Valid != null && Valid.Value) {
ValidTooltip = VerifyResultDataViewModel.ToolTip_OK;
} else {
ValidTooltip = VerifyResultDataViewModel.ToolTip_InvalidFileType;
}
} else {
Valid = false;
ValidTooltip = VerifyResultDataViewModel.ToolTip_XMLValidationFailed;
}
if (Valid != null && Valid.Value && _validateHashes != null) {
_validateHashes(_xmlFile.Document, this);
//try {
// _validateHashes(_xmlFile.Document, this);
// Valid = result.Valid;
// ValidTooltip = result.Valid ? VerifyResultDataViewModel.ToolTip_OK : VerifyResultDataViewModel.ToolTip_HashInvalid;
// DigestValueComputed = result.DigestComputed;
// DigestValueRead = result.DigestRead;
//} catch (Exception ex) {
// Valid = false;
// DigestValueComputed = "";
// DigestValueRead = "";
//}
}
}
public XMLFile XMLFile
{
get { return _xmlFile; }
}
public string Name
{
get { return _name; }
private set {
if (_name == value) {
return;
}
_name = value;
RaisePropertyChanged("Name");
}
}
public string[] CanonicalizationMethods { get; private set; }
public string DigestValueComputed
{
get { return _manufacturerDigestComputed; }
internal set {
if (_manufacturerDigestComputed == value) {
return;
}
_manufacturerDigestComputed = value;
RaisePropertyChanged("DigestValueComputed");
}
}
public bool? Valid
{
get { return _valid; }
internal set {
if (_valid == value) {
return;
}
_valid = value;
RaisePropertyChanged("Valid");
}
}
public string ValidTooltip
{
get { return _tooltip; }
set {
if (_tooltip == value) {
return;
}
_tooltip = value;
RaisePropertyChanged("ValidTooltip");
}
}
public string Component
{
get { return _componentType; }
set {
if (_componentType == value) {
return;
}
_componentType = value;
RaisePropertyChanged("Component");
}
}
}
public class HashedXMLFile : VectoXMLFile
{
protected string _manufacturerDigestRead;
public HashedXMLFile(IOService ioService, string name, Func<XmlDocument, bool?> contentCheck,
Action<XmlDocument, VectoXMLFile> hashValidation = null) : base(ioService, name, contentCheck, hashValidation) {}
public string DigestValueRead
{
get { return _manufacturerDigestRead; }
internal set {
if (_manufacturerDigestRead == value) {
return;
}
_manufacturerDigestRead = value;
RaisePropertyChanged("DigestValueRead");
}
}
}
public class ReportXMLFile : HashedXMLFile
{
private string _jobDigestRead;
public ReportXMLFile(IOService ioService, string name, Func<XmlDocument, bool?> contentCheck,
Action<XmlDocument, VectoXMLFile> hashValidation = null)
: base(ioService, name, contentCheck, hashValidation)
{
_xmlFile.PropertyChanged += ReadJobDigest;
}
private void ReadJobDigest(object sender, PropertyChangedEventArgs e)
{
var jobDigest = "";
if (e.PropertyName != "Document") {
return;
}
if (_xmlFile.Document != null && _xmlFile.Document.DocumentElement != null) {
var node =
_xmlFile.Document.SelectSingleNode("//*[local-name()='InputDataSignature']//*[local-name()='DigestValue']");
if (node != null) {
jobDigest = node.InnerText;
}
}
JobDigest = jobDigest;
}
public string JobDigest
{
get { return _jobDigestRead; }
internal set {
if (_jobDigestRead == value) {
return;
}
_jobDigestRead = value;
RaisePropertyChanged("JobDigest");
}
}
}
}
......@@ -5,16 +5,8 @@ namespace HashingTool.ViewModel
{
public class HomeViewModel : ObservableObject, IMainView
{
private readonly ApplicationViewModel _applicationViewModel;
public HomeViewModel() {}
public HomeViewModel(ApplicationViewModel applicationViewModel)
{
_applicationViewModel = applicationViewModel;
}
public string Name
{
get { return "Home"; }
......@@ -25,10 +17,7 @@ namespace HashingTool.ViewModel
get { return ApplicationViewModel.AvailableViews; }
}
public ICommand ChangeViewCommand
{
get { return _applicationViewModel == null ? null : _applicationViewModel.ChangeViewCommand; }
}
public ICommand ShowHomeViewCommand
{
......
......@@ -88,9 +88,9 @@ namespace HashingTool.ViewModel.UserControl
public ICommand SetXMLFileCommnd
{
get { return new RelayCommand<string>(SetXMLFile, (f)=> !_busy);}
get { return new RelayCommand<string>(SetXMLFile, (f) => !_busy); }
}
private async void SetXMLFile(string fileName)
{
if (!File.Exists(fileName)) {
......@@ -100,9 +100,9 @@ namespace HashingTool.ViewModel.UserControl
IsValid = null;
return;
}
var stream = File.OpenRead(fileName);
await LoadXMLFile(stream);
using (var stream = File.OpenRead(fileName)) {
await LoadXMLFile(stream);
}
}
......@@ -110,13 +110,14 @@ namespace HashingTool.ViewModel.UserControl
{
string filename;
var stream = IoService.OpenFileDialog(null, ".xml", "VECTO XML file|*.xml", out filename);
if (stream == null) {
return;
}
using (var stream = IoService.OpenFileDialog(null, ".xml", "VECTO XML file|*.xml", out filename)) {
if (stream == null) {
return;
}
await LoadXMLFile(stream);
Source = filename;
await LoadXMLFile(stream);
Source = filename;
}
}
private async Task LoadXMLFile(Stream stream)
......@@ -125,7 +126,7 @@ namespace HashingTool.ViewModel.UserControl
IsValid = null;
ContentValid = null;
XMLValidationErrors.Clear();
if (_validate) {
var ms = new MemoryStream();
......@@ -160,7 +161,6 @@ namespace HashingTool.ViewModel.UserControl
{
var valid = true;
try {
var validator = new XMLValidator(r => { valid = r; },
(s, e) => {
Application.Current.Dispatcher.Invoke(() => XMLValidationErrors.Add(
......
......@@ -12,7 +12,6 @@ namespace HashingTool.ViewModel
{
public class VerifyComponentInputDataViewModel : ObservableObject, IMainView
{
private readonly ApplicationViewModel _applicationViewModel;
private string _digestValueComputed;
private string _digestValueRead;
private bool _componentDataValid;
......@@ -32,11 +31,6 @@ namespace HashingTool.ViewModel
};
}
public VerifyComponentInputDataViewModel(ApplicationViewModel applicationViewModel) : this()
{
_applicationViewModel = applicationViewModel;
}
public string Name
{
get { return "Verify Input Data"; }
......@@ -115,9 +109,9 @@ namespace HashingTool.ViewModel
ComponentDataValid = false;
DigestValueComputed = "";
DigestValueRead = "";
Component = "";
Component = "";
return;
}
}
try {
var h = VectoHash.Load(_componentFile.Document);
......@@ -135,6 +129,7 @@ namespace HashingTool.ViewModel
DigestValueComputed = "";
DigestValueRead = "";
Component = "";
_componentFile.XMLValidationErrors.Add(e.Message);
}
}
}
......
using System;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Windows;
using System.Windows.Input;
using HashingTool.ViewModel.UserControl;
using TUGraz.VectoHashing;
......@@ -12,7 +10,6 @@ namespace HashingTool.ViewModel
{
public class VerifyJobInputDataViewModel : ObservableObject, IMainView
{
private readonly ApplicationViewModel _applicationViewModel;
private string _digestValueComputed;
private bool _componentDataValid;
private readonly XMLFile _jobFile;
......@@ -31,12 +28,7 @@ namespace HashingTool.ViewModel
Components = new ObservableCollection<ComponentEntry>();
}
public VerifyJobInputDataViewModel(ApplicationViewModel applicationViewModel)
: this()
{
_applicationViewModel = applicationViewModel;
}
public string Name
{
get { return "Verify Job"; }
......@@ -89,8 +81,9 @@ namespace HashingTool.ViewModel
private void DoValidateHash()
{
if (_jobFile.ContentValid == null || !_jobFile.ContentValid.Value)
if (_jobFile.ContentValid == null || !_jobFile.ContentValid.Value) {
return;
}
try {
Components.Clear();
var h = VectoHash.Load(_jobFile.Document);
......@@ -123,6 +116,7 @@ namespace HashingTool.ViewModel
} catch (Exception e) {
DigestValueComputed = "";
JobDataValid = false;
_jobFile.XMLValidationErrors.Add(e.Message);
}
}
}
......
......@@ -48,11 +48,6 @@ namespace HashingTool.ViewModel
}
public VerifyResultDataViewModel(ApplicationViewModel applicationViewModel) : this()
{
_applicationViewModel = applicationViewModel;
}
public ObservableCollection<string> CanonicalizationMethods { get; private set; }
public string Name
......
......@@ -2,16 +2,17 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="XML Errors/Warnings" Height="358" Width="623"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:views="clr-namespace:HashingTool.Views"
d:DataContext="{d:DesignInstance views:XMLValidationErrorsDialog}"
>
d:DataContext="{d:DesignInstance views:XMLValidationErrorsDialog}">
<Grid>
<ListBox x:Name="lbErrors" Margin="10,10,10,62" ItemsSource="{Binding XMLErrors}" />
<Button IsCancel="True" x:Name="btnClose" Content="Close" Margin="0,0,10,10" Height="22" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="75" />
<Label x:Name="lblCount" HorizontalAlignment="Left" Margin="10,0,0,31" Width="340" Height="26" VerticalAlignment="Bottom">
<Button IsCancel="True" x:Name="btnClose" Content="Close" Margin="0,0,10,10" Height="22" VerticalAlignment="Bottom"
HorizontalAlignment="Right" Width="75" />
<Label x:Name="lblCount" HorizontalAlignment="Left" Margin="10,0,0,31" Width="340" Height="26"
VerticalAlignment="Bottom">
<Label.Content>
<TextBlock Text="{Binding XMLErrors.Count, StringFormat='{}{0} Warnings/Errors'}" />
</Label.Content>
......
......@@ -7,7 +7,7 @@
xmlns:local="clr-namespace:HashingTool.Views"
x:Class="HashingTool.Views.HashComponentData"
mc:Ignorable="d"
d:DesignHeight="603.125" d:DesignWidth="666">
d:DesignHeight="368.125" d:DesignWidth="666">
<UserControl.Resources>
<Helper:CollectionConverter x:Key="CollectionConverter" />
</UserControl.Resources>
......@@ -15,24 +15,37 @@
<UserControl.DataContext>
<ViewModel:HashComponentDataViewModel />
</UserControl.DataContext>
<Grid>
<Label Name="lblHeader" HorizontalAlignment="Center" Margin="10,10,0,0" VerticalAlignment="Top"
<DockPanel>
<Label DockPanel.Dock="Top" Name="lblHeader" HorizontalAlignment="Center" Margin="10,10,0,0" VerticalAlignment="Top"
Content="{Binding Name}" FontWeight="Bold" FontSize="18" />
<Button Name="btnBack" Content="Back" Command="{Binding ShowHomeViewCommand}" Margin="0,0,10,10"
HorizontalAlignment="Right"
Width="75" Height="22" VerticalAlignment="Bottom" />
<Button Content="Save Component Data" HorizontalAlignment="Right" Margin="0,0,90,10" Width="143" Height="22"
VerticalAlignment="Bottom" Command="{Binding SaveHashedDocument, Mode=OneWay}" />
<local:VectoXMLFileSelector Margin="10,93,10,0" VerticalAlignment="Top" XMLFile="{Binding ComponentFile}" />
<Label DockPanel.Dock="Top" x:Name="lblFileSelect" Content="Component data:" HorizontalAlignment="Left" Margin="10,0"
VerticalAlignment="Top" />
<local:VectoXMLFileSelector DockPanel.Dock="Top" Margin="10,0" VerticalAlignment="Top"
XMLFile="{Binding ComponentFile}" />
<StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal" HorizontalAlignment="Right">
<Button Content="Save Component Data" HorizontalAlignment="Right" Margin="0,0,15,10" Width="143" Height="22"
VerticalAlignment="Bottom" Command="{Binding SaveHashedDocument, Mode=OneWay}" />
<Button Name="btnBack" Content="Back" Command="{Binding ShowHomeViewCommand}" Margin="0,0,10,10"
HorizontalAlignment="Right"
Width="75" Height="22" VerticalAlignment="Bottom" />
</StackPanel>
<Grid Margin="15,141,5,37">
<Grid DockPanel.Dock="Top" Margin="10,0,1,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal" Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Margin="0,0,0,5">
<Label>
<Label.Content>
<TextBlock Text="{Binding XMLValidationErrors.Count, StringFormat='{}{0} Warnings/Errors'}" />
......@@ -61,58 +74,54 @@
</Button.Style>
</Button>
</StackPanel>
<Grid Grid.Row="1" Margin="0,10,0,0">
<Label x:Name="lblDigestValue" Content="Digest Value:" HorizontalAlignment="Left" Margin="10,38,0,0"
VerticalAlignment="Top" RenderTransformOrigin="0.57,0.5" FontSize="16" />
<TextBox x:Name="tbDigestValue" Text="{Binding DigestValue}" Margin="117,41,100,0"
VerticalAlignment="Top" RenderTransformOrigin="4.1,-2.1" FontFamily="Courier New" FontWeight="Bold"
FontSize="16" Foreground="#FF03932B" />
<Label Name="lblC14N" Content="Canonicalization:" HorizontalAlignment="Left" Margin="10,10,0,0"
VerticalAlignment="Top" />
<Label Name="lblC14NList"
Content="{Binding CanonicalizaitionMethods, Converter={StaticResource CollectionConverter}}"
Margin="117,10,100,0" VerticalAlignment="Top" />
<Button Content="Copy" Margin="0,41,10,0" VerticalAlignment="Top" HorizontalAlignment="Right" Width="75"
Click="Button_Click_1">
<Button.Style>
<Style TargetType="Button">
<Setter Property="IsEnabled" Value="false" />
<Style.Triggers>
<DataTrigger Binding="{Binding ComponentDataValid}" Value="True">
<Setter Property="IsEnabled" Value="True" />
</DataTrigger>
</Style.Triggers>
</Style>
</Button.Style>
</Button>
</Grid>
<Grid Grid.Row="2" Margin="0,10,0,0">
<ContentControl HorizontalAlignment="Center" Margin="0,0,0,0" VerticalAlignment="Top" Width="66" Height="64">
<ContentControl.RenderTransform>
<ScaleTransform ScaleX="1.5" ScaleY="1.5" />
</ContentControl.RenderTransform>
<ContentControl.Style>
<Style TargetType="ContentControl">
<Setter Property="Content" Value="" />
<Setter Property="ToolTip" Value="X" />
<Style.Triggers>
<DataTrigger Binding="{Binding ComponentDataValid}" Value="True">
<Setter Property="ContentTemplate" Value="{StaticResource Icon_OK}" />
<Setter Property="ToolTip" Value="Component data validates against schema" />
</DataTrigger>
<DataTrigger Binding="{Binding ComponentDataValid}" Value="False">
<Setter Property="ContentTemplate" Value="{StaticResource Icon_NOK}" />
<Setter Property="ToolTip" Value="Component data does NOT validat against schema" />
</DataTrigger>
</Style.Triggers>
</Style>
</ContentControl.Style>
</ContentControl>
</Grid>
<Label Grid.Row="1" Grid.Column="0" Name="lblC14N" Content="Canonicalization:" HorizontalAlignment="Left"
Margin="0" />
<TextBox Grid.Row="1" Grid.Column="1" Name="lblC14NList"
Text="{Binding CanonicalizaitionMethods, Converter={StaticResource CollectionConverter}}"
Margin="10,2" />
<Button Grid.Row="1" Grid.Column="2" Content="Copy" Margin="10,2,0,2" HorizontalAlignment="Right" Width="75"
Click="Button_Click_1">
<Button.Style>
<Style TargetType="Button">
<Setter Property="IsEnabled" Value="false" />
<Style.Triggers>
<DataTrigger Binding="{Binding ComponentDataValid}" Value="True">
<Setter Property="IsEnabled" Value="True" />
</DataTrigger>
</Style.Triggers>
</Style>
</Button.Style>
</Button>
<Label Grid.Row="2" Grid.Column="0" x:Name="lblDigestValue" Content="Digest Value:" HorizontalAlignment="Left"
Margin="0" Style="{StaticResource DigestValueLabelStyle}" />
<TextBox Grid.Row="2" Grid.Column="1" x:Name="tbDigestValue" Text="{Binding DigestValue}" Margin="10,2"
VerticalAlignment="Top" RenderTransformOrigin="4.1,-2.1" Style="{StaticResource DigestValueTextboxStyle}"
Foreground="{StaticResource Color.SuccessGreen}" />
<ContentControl Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="3" HorizontalAlignment="Center" Margin="0,0,0,0"
VerticalAlignment="Top" Width="66" Height="64">
<ContentControl.LayoutTransform>
<ScaleTransform ScaleX="1.5" ScaleY="1.5" />
</ContentControl.LayoutTransform>
<ContentControl.Style>
<Style TargetType="ContentControl">
<Setter Property="Content" Value="" />
<Setter Property="ToolTip" Value="X" />
<Style.Triggers>
<DataTrigger Binding="{Binding ComponentDataValid}" Value="True">
<Setter Property="ContentTemplate" Value="{StaticResource Icon_OK}" />
<Setter Property="ToolTip" Value="Component data validates against schema" />
</DataTrigger>
<DataTrigger Binding="{Binding ComponentDataValid}" Value="False">
<Setter Property="ContentTemplate" Value="{StaticResource Icon_NOK}" />
<Setter Property="ToolTip" Value="Component data does NOT validat against schema" />
</DataTrigger>
</Style.Triggers>
</Style>
</ContentControl.Style>
</ContentControl>
</Grid>
<Label x:Name="lblFileSelect" Content="Component data:" HorizontalAlignment="Left" Margin="10,75,0,0"
VerticalAlignment="Top" />
</Grid>
</DockPanel>
</UserControl>
\ No newline at end of file
......@@ -10,7 +10,7 @@
<Grid x:Name="MainGrid">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" MinWidth="30" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.DataContext>
......
......@@ -83,7 +83,7 @@
</Style>
</StackPanel.Style>
<Label Content="{Binding XMLFile.XMLValidationErrors.Count}"
ContentStringFormat="XML Validation: {0} Warnings/Errors"
ContentStringFormat="{}{0} Warnings/Errors"
MinWidth="80">
<Label.Style>
<Style TargetType="Label">
......
......@@ -3,7 +3,7 @@
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:viewModel="clr-namespace:HashingTool.ViewModel"
xmlns:views="clr-namespace:HashingTool.Views"
xmlns:helper="clr-namespace:HashingTool.Helper"
x:Class="HashingTool.Views.VerifyComponentInputData"
......@@ -11,69 +11,101 @@
d:DesignHeight="422" d:DesignWidth="534">
<UserControl.Resources>
<helper:CollectionConverter x:Key="CollectionConverter" />
</UserControl.Resources>
<UserControl.DataContext>
<ViewModel:VerifyComponentInputDataViewModel/>
<viewModel:VerifyComponentInputDataViewModel />
</UserControl.DataContext>
<Grid>
<Label x:Name="lblFileSelect" Content="Component data:" HorizontalAlignment="Left" Margin="10,75,0,0"
VerticalAlignment="Top" />
<Label Name="lblHeader" HorizontalAlignment="Center" Margin="10,10,0,0" VerticalAlignment="Top"
<DockPanel>
<Label DockPanel.Dock="Top" Name="lblHeader" HorizontalAlignment="Center" Margin="10,10,0,0" VerticalAlignment="Top"
Content="{Binding Name}" FontWeight="Bold" FontSize="18" />
<Button Name="btnBack" Content="Back" Command="{Binding ShowHomeViewCommand}" Margin="0,0,10,10"
<Button DockPanel.Dock="Bottom" Name="btnBack" Content="Back" Command="{Binding ShowHomeViewCommand}"
Margin="0,0,10,10"
HorizontalAlignment="Right"
Width="75" Height="22" VerticalAlignment="Bottom" />
<views:VectoXMLFileSelector Margin="0,93,0,0" VerticalAlignment="Top" XMLFile="{Binding ComponentFile}" Height="80"/>
<Grid Margin="0,178,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0" Margin="0,5">
<Label Content="Component:"/>
<TextBox Text="{Binding Component}" Margin="155,0,10,0" IsReadOnly="True"/>
</Grid>
<Grid Grid.Row="1" Margin="0,5">
<Label Content="Canonicalization methods:"/>
<TextBox Text="{Binding CanonicalizaitionMethods , Converter={StaticResource CollectionConverter}}" Margin="155,0,10,0" IsReadOnly="True"/>
</Grid>
<Grid Grid.Row="2" Margin="0,5">
<Label Content="Digest Value read:"/>
<TextBox Text="{Binding DigestValueRead}" Margin="155,0,10,0" IsReadOnly="True"/>
</Grid>
<Grid Grid.Row="3" Margin="0,5">
<Label Content="Digest Value computed:"/>
<TextBox Text="{Binding DigestValueComputed}" Margin="155,0,10,0" IsReadOnly="True"/>
</Grid>
<Grid Grid.Row="4" Margin="0,10,0,0">
<ContentControl HorizontalAlignment="Center" Margin="0,0,0,0" VerticalAlignment="Top" Width="66" Height="64">
<ContentControl.RenderTransform>
<DockPanel>
<Label DockPanel.Dock="Top" x:Name="lblFileSelect" Content="Component data:" HorizontalAlignment="Left"
Margin="10,2,0,2"
VerticalAlignment="Top" />
<views:VectoXMLFileSelector DockPanel.Dock="Top" Margin="10,0,0,0" VerticalAlignment="Top"
XMLFile="{Binding ComponentFile}" Height="80" />
<Grid Margin="0,0,0,0" DockPanel.Dock="Bottom">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Label Grid.Row="0" Grid.Column="0" Content="Component:" />
<TextBox Grid.Row="0" Grid.Column="1" Text="{Binding Component}" Margin="10,2" IsReadOnly="True" />
<Label Grid.Row="1" Grid.Column="0" Content="Canonicalization methods:" />
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding CanonicalizaitionMethods , Converter={StaticResource CollectionConverter}}"
Margin="10,2" IsReadOnly="True" />
<Label Grid.Row="2" Grid.Column="0" Content="Digest Value read:" Style="{StaticResource DigestValueLabelStyle}" Template="{DynamicResource LabelControlTemplate1}"/>
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding DigestValueRead}" Margin="10,2" IsReadOnly="True">
<TextBox.Style>
<Style TargetType="TextBox" BasedOn="{StaticResource DigestValueTextboxStyle}">
<Style.Triggers>
<DataTrigger Binding="{Binding ComponentDataValid}" Value="True">
<Setter Property="Foreground" Value="{StaticResource Color.SuccessGreen}"/>
</DataTrigger>
<DataTrigger Binding="{Binding ComponentDataValid}" Value="False">
<Setter Property="Foreground" Value="{StaticResource Color.ErrorRed}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBox.Style>
</TextBox>
<Label Grid.Row="3" Grid.Column="0" Content="Digest Value computed:" Style="{StaticResource DigestValueLabelStyle}"/>
<TextBox Grid.Row="3" Grid.Column="1" Text="{Binding DigestValueComputed}" Margin="10,2" IsReadOnly="True" >
<TextBox.Style>
<Style TargetType="TextBox" BasedOn="{StaticResource DigestValueTextboxStyle}">
<Style.Triggers>
<DataTrigger Binding="{Binding ComponentDataValid}" Value="True">
<Setter Property="Foreground" Value="{StaticResource Color.SuccessGreen}"/>
</DataTrigger>
<DataTrigger Binding="{Binding ComponentDataValid}" Value="False">
<Setter Property="Foreground" Value="{StaticResource Color.ErrorRed}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBox.Style>
</TextBox>
<ContentControl Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="2" HorizontalAlignment="Center" Margin="0,40,0,0" VerticalAlignment="Top" Width="66" Height="64">
<ContentControl.LayoutTransform>
<ScaleTransform ScaleX="1.5" ScaleY="1.5" />
</ContentControl.RenderTransform>
</ContentControl.LayoutTransform>
<ContentControl.Style>
<Style TargetType="ContentControl">
<Setter Property="Content" Value="" />
<Setter Property="ToolTip" Value=""/>
<Setter Property="ToolTip" Value="" />
<Style.Triggers>
<DataTrigger Binding="{Binding ComponentDataValid}" Value="True">
<Setter Property="ContentTemplate" Value="{StaticResource Icon_OK}" />
<Setter Property="ToolTip" Value="Component data validates against schema"/>
<Setter Property="ToolTip" Value="Component data validates against schema" />
</DataTrigger>
<DataTrigger Binding="{Binding ComponentDataValid}" Value="False">
<Setter Property="ContentTemplate" Value="{StaticResource Icon_NOK}" />
<Setter Property="ToolTip" Value="Component data does NOT validat against schema"/>
<Setter Property="ToolTip" Value="Component data does NOT validat against schema" />
</DataTrigger>
</Style.Triggers>
</Style>
</ContentControl.Style>
</ContentControl>
</Grid>
</Grid>
</Grid>
</DockPanel>
</DockPanel>
</UserControl>
\ No newline at end of file
......@@ -3,7 +3,7 @@
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:viewModel="clr-namespace:HashingTool.ViewModel"
xmlns:views="clr-namespace:HashingTool.Views"
xmlns:helper="clr-namespace:HashingTool.Helper"
x:Class="HashingTool.Views.VerifyJobInputData"
......@@ -11,126 +11,160 @@
d:DesignHeight="555" d:DesignWidth="534">
<UserControl.Resources>
<helper:CollectionConverter x:Key="CollectionConverter" />
<BooleanToVisibilityConverter x:Key="Bool2Vis" />
</UserControl.Resources>
<UserControl.DataContext>
<ViewModel:VerifyJobInputDataViewModel />
<viewModel:VerifyJobInputDataViewModel />
</UserControl.DataContext>
<Grid>
<Label x:Name="lblFileSelect" Content="Job data:" HorizontalAlignment="Left" Margin="10,75,0,0"
VerticalAlignment="Top" />
<Label Name="lblHeader" HorizontalAlignment="Center" Margin="10,10,0,0" VerticalAlignment="Top"
<DockPanel>
<Label DockPanel.Dock="Top" Name="lblHeader" HorizontalAlignment="Center" Margin="0,10" VerticalAlignment="Top"
Content="{Binding Name}" FontWeight="Bold" FontSize="18" />
<Button Name="btnBack" Content="Back" Command="{Binding ShowHomeViewCommand}" Margin="0,0,10,10"
<Button DockPanel.Dock="Bottom" Name="btnBack" Content="Back" Command="{Binding ShowHomeViewCommand}"
Margin="0,0,10,10"
HorizontalAlignment="Right"
Width="75" Height="22" VerticalAlignment="Bottom" />
<views:VectoXMLFileSelector Margin="0,93,0,0" VerticalAlignment="Top" XMLFile="{Binding JobFile}" Height="80" />
<Grid Margin="0,178,0,0">
<Label x:Name="lblFileSelect" DockPanel.Dock="Top" Content="Job data:" HorizontalAlignment="Left" Margin="10,0,0,0"
VerticalAlignment="Top" />
<views:VectoXMLFileSelector Margin="0,0,0,0" DockPanel.Dock="Top" VerticalAlignment="Top" XMLFile="{Binding JobFile}"
Height="80" />
<Grid DockPanel.Dock="Top" Margin="0,0,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="*" MaxHeight="300" />
<RowDefinition Height="*"/>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid Grid.Row="1" Margin="0,5">
<Label Content="Canonicalization methods:" />
<TextBox Text="{Binding CanonicalizationMethods , Converter={StaticResource CollectionConverter}}"
Margin="155,0,10,0" IsReadOnly="True" />
</Grid>
<Grid Grid.Row="2" Margin="0,5">
<Label Content="Digest Value computed:" />
<TextBox Text="{Binding DigestValueComputed}" Margin="155,0,10,0"
IsReadOnly="True" />
</Grid>
<Grid Grid.Row="3" Margin="0,10,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="29*" />
<ColumnDefinition Width="60*" />
</Grid.ColumnDefinitions>
<ContentControl HorizontalAlignment="Center" Margin="60,0,234,0" VerticalAlignment="Top" Width="66" Height="64"
Grid.Column="1">
<ContentControl.RenderTransform>
<ScaleTransform ScaleX="1.5" ScaleY="1.5" />
</ContentControl.RenderTransform>
<ContentControl.Style>
<Style TargetType="ContentControl">
<Setter Property="Content" Value="" />
<Setter Property="ToolTip" Value="" />
<Style.Triggers>
<DataTrigger Binding="{Binding JobDataValid}" Value="True">
<Setter Property="ContentTemplate" Value="{StaticResource Icon_OK}" />
<Setter Property="ToolTip" Value="Component data validates against schema" />
</DataTrigger>
<DataTrigger Binding="{Binding JobDataValid}" Value="False">
<Setter Property="ContentTemplate" Value="{StaticResource Icon_NOK}" />
<Setter Property="ToolTip" Value="Component data does NOT validat against schema" />
</DataTrigger>
</Style.Triggers>
</Style>
</ContentControl.Style>
</ContentControl>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label Grid.Row="1" Grid.Column="0" Content="Canonicalization methods:" />
<TextBox Grid.Row="1" Grid.Column="1"
Text="{Binding CanonicalizationMethods , Converter={StaticResource CollectionConverter}}"
Margin="10,2" IsReadOnly="True" />
</Grid>
<ScrollViewer Grid.Row="0" VerticalScrollBarVisibility="Auto" Background="{x:Static SystemColors.ControlLightBrush}"
Margin="10,0">
<ItemsControl Margin="0,0,0,20" x:Name="ComponentListing" ItemsSource="{Binding Components}">
<Label Grid.Row="2" Grid.Column="0" Content="Digest Value computed:" Style="{StaticResource DigestValueLabelStyle}" />
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding DigestValueComputed}" Margin="10,2"
IsReadOnly="True" Style="{StaticResource DigestValueTextboxStyle}" />
<ContentControl Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" HorizontalAlignment="Center" Margin="0,10,0,0"
VerticalAlignment="Top" Width="50" Height="50">
<ContentControl.LayoutTransform>
<ScaleTransform ScaleX="1.5" ScaleY="1.5" />
</ContentControl.LayoutTransform>
<ContentControl.Style>
<Style TargetType="ContentControl">
<Setter Property="Content" Value="" />
<Setter Property="ToolTip" Value="" />
<Style.Triggers>
<DataTrigger Binding="{Binding JobDataValid}" Value="True">
<Setter Property="ContentTemplate" Value="{StaticResource Icon_OK}" />
<Setter Property="ToolTip" Value="Component data validates against schema" />
</DataTrigger>
<DataTrigger Binding="{Binding JobDataValid}" Value="False">
<Setter Property="ContentTemplate" Value="{StaticResource Icon_NOK}" />
<Setter Property="ToolTip" Value="Component data does NOT validat against schema" />
</DataTrigger>
</Style.Triggers>
</Style>
</ContentControl.Style>
</ContentControl>
<ScrollViewer Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" VerticalScrollBarVisibility="Auto"
Background="{x:Static SystemColors.ControlLightBrush}"
Margin="10,0,10,10">
<ItemsControl Margin="3" x:Name="ComponentListing" ItemsSource="{Binding Components}">
<ItemsControl.ItemContainerStyle>
<Style>
<Setter Property="FrameworkElement.Margin" Value="0,2" />
</Style>
</ItemsControl.ItemContainerStyle>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Expander Margin="4" Header="{Binding}">
<Expander.HeaderTemplate>
<DataTemplate>
<Grid
HorizontalAlignment="{Binding Path=HorizontalAlignment, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ContentPresenter}}, Mode=OneWayToSource}">
<Grid.ColumnDefinitions>
<ColumnDefinition MinWidth="150" />
<ColumnDefinition Width="100" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="{Binding Component}" Margin="4,0" />
<StackPanel Grid.Column="1" VerticalAlignment="Top" Width="16" Height="16" HorizontalAlignment="Left">
<ContentControl ContentTemplate="{StaticResource Icon_OK}"
Visibility="{Binding Valid, Converter={StaticResource Bool2Vis}}">
<ContentControl.RenderTransform>
<Border BorderBrush="White" BorderThickness="1" CornerRadius="2">
<Expander Margin="4" Header="{Binding}" Style="{DynamicResource HeaderStretchExpanderStyle}">
<Expander.HeaderTemplate>
<DataTemplate>
<DockPanel HorizontalAlignment="Stretch">
<ContentControl DockPanel.Dock="Right" Width="35" Height="35" Margin="0,0,10,0">
<ContentControl.LayoutTransform>
<ScaleTransform ScaleX=".4" ScaleY=".4" />
</ContentControl.RenderTransform>
</ContentControl.LayoutTransform>
<ContentControl.Style>
<Style TargetType="ContentControl">
<Setter Property="Content" Value="" />
<Style.Triggers>
<DataTrigger Binding="{Binding Valid}" Value="True">
<Setter Property="ContentTemplate" Value="{StaticResource Icon_OK}" />
</DataTrigger>
<DataTrigger Binding="{Binding Valid}" Value="False">
<Setter Property="ContentTemplate" Value="{StaticResource Icon_NOK}" />
</DataTrigger>
</Style.Triggers>
</Style>
</ContentControl.Style>
</ContentControl>
<ContentControl ContentTemplate="{StaticResource Icon_NOK}"
Visibility="{Binding Path=InValid, Converter={StaticResource Bool2Vis}}">
<ContentControl.RenderTransform>
<ScaleTransform ScaleX=".4" ScaleY=".4" />
</ContentControl.RenderTransform>
</ContentControl>
</StackPanel>
</Grid>
</DataTemplate>
</Expander.HeaderTemplate>
<Expander.Content>
<Border BorderBrush="{x:Static SystemColors.ControlDarkDarkBrush}" BorderThickness="0,0,0,1" Margin="0,0,0,3">
<Grid>
<TextBlock DockPanel.Dock="Left" Text="{Binding Component}" Margin="4,0" FontSize="16" FontWeight="Bold" />
</DockPanel>
</DataTemplate>
</Expander.HeaderTemplate>
<Expander.Content>
<Grid Margin="0,5,0,0">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid Row="0" Margin="10,13,0,3">
<Label Content="Canonicalization methods:" />
<TextBox Text="{Binding CanonicalizationMethod , Converter={StaticResource CollectionConverter}}"
Margin="155,0,10,0" IsReadOnly="True" />
</Grid>
<Grid Row="1" Margin="10,2,0,3">
<Label Content="Digest Value read:" />
<TextBox Text="{Binding DigestValueRead}"
Margin="155,0,10,0" IsReadOnly="True" />
</Grid>
<Grid Row="2" Margin="10,2,0,3">
<Label Content="Digest Value computed:" />
<TextBox Text="{Binding DigestValueComputed}"
Margin="155,0,10,0" IsReadOnly="True" />
</Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Label Grid.Row="0" Grid.Column="0" Content="Canonicalization methods:" />
<TextBox Grid.Row="0" Grid.Column="1" Text="{Binding CanonicalizationMethod , Converter={StaticResource CollectionConverter}}"
Margin="10,2" IsReadOnly="True" />
<Label Grid.Row="1" Grid.Column="0" Content="Digest Value read:" Style="{StaticResource DigestValueLabelStyle}" />
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding DigestValueRead}"
Margin="10,2" IsReadOnly="True">
<TextBox.Style>
<Style TargetType="TextBox" BasedOn="{StaticResource DigestValueTextboxStyle}">
<Style.Triggers>
<DataTrigger Binding="{Binding Valid}" Value="True">
<Setter Property="Foreground" Value="{StaticResource Color.SuccessGreen}"/>
</DataTrigger>
<DataTrigger Binding="{Binding Valid}" Value="False">
<Setter Property="Foreground" Value="{StaticResource Color.ErrorRed}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBox.Style>
</TextBox>
<Label Grid.Row="2" Grid.Column="0" Content="Digest Value computed:" Style="{StaticResource DigestValueLabelStyle}" />
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding DigestValueComputed}"
Margin="10,2" IsReadOnly="True" >
<TextBox.Style>
<Style TargetType="TextBox" BasedOn="{StaticResource DigestValueTextboxStyle}">
<Style.Triggers>
<DataTrigger Binding="{Binding Valid}" Value="True">
<Setter Property="Foreground" Value="{StaticResource Color.SuccessGreen}"/>
</DataTrigger>
<DataTrigger Binding="{Binding Valid}" Value="False">
<Setter Property="Foreground" Value="{StaticResource Color.ErrorRed}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBox.Style>
</TextBox>
</Grid>
</Border>
</Expander.Content>
</Expander>
</Expander.Content>
</Expander>
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
......@@ -138,6 +172,5 @@
</Grid>
</Grid>
</DockPanel>
</UserControl>
\ No newline at end of file
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment