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

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

hashing tool feature complete, some cleanup, refactoring, polishing still needed

parent 31dd12ce
No related branches found
No related tags found
No related merge requests found
Showing
with 546 additions and 278 deletions
...@@ -71,6 +71,7 @@ ...@@ -71,6 +71,7 @@
<AutoGen>True</AutoGen> <AutoGen>True</AutoGen>
<DesignTime>True</DesignTime> <DesignTime>True</DesignTime>
</Compile> </Compile>
<Compile Include="ViewModel\HashedXMLFile.cs" />
<Compile Include="ViewModel\HomeViewModel.cs" /> <Compile Include="ViewModel\HomeViewModel.cs" />
<Compile Include="ViewModel\IMainView.cs" /> <Compile Include="ViewModel\IMainView.cs" />
<Compile Include="ViewModel\ApplicationViewModel.cs" /> <Compile Include="ViewModel\ApplicationViewModel.cs" />
...@@ -88,9 +89,6 @@ ...@@ -88,9 +89,6 @@
<Compile Include="Views\HomeView.xaml.cs"> <Compile Include="Views\HomeView.xaml.cs">
<DependentUpon>HomeView.xaml</DependentUpon> <DependentUpon>HomeView.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Views\Test.xaml.cs">
<DependentUpon>Test.xaml</DependentUpon>
</Compile>
<Compile Include="Views\UserControl\VectoXMLFileSelector.xaml.cs"> <Compile Include="Views\UserControl\VectoXMLFileSelector.xaml.cs">
<DependentUpon>VectoXMLFileSelector.xaml</DependentUpon> <DependentUpon>VectoXMLFileSelector.xaml</DependentUpon>
</Compile> </Compile>
...@@ -146,10 +144,6 @@ ...@@ -146,10 +144,6 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
<Page Include="Views\Test.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\UserControl\VectoXMLFileSelector.xaml"> <Page Include="Views\UserControl\VectoXMLFileSelector.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
...@@ -206,6 +200,10 @@ ...@@ -206,6 +200,10 @@
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" /> <Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\VectoCommon\VectoCommon\VectoCommon.csproj">
<Project>{79A066AD-69A9-4223-90F6-6ED5D2D084F4}</Project>
<Name>VectoCommon</Name>
</ProjectReference>
<ProjectReference Include="..\VectoCommon\VectoHashing\VectoHashing.csproj"> <ProjectReference Include="..\VectoCommon\VectoHashing\VectoHashing.csproj">
<Project>{B673E12F-D323-4C4C-8805-9915B2C72D3D}</Project> <Project>{B673E12F-D323-4C4C-8805-9915B2C72D3D}</Project>
<Name>VectoHashing</Name> <Name>VectoHashing</Name>
......
...@@ -58,10 +58,13 @@ namespace HashingTool.Util ...@@ -58,10 +58,13 @@ namespace HashingTool.Util
private static XmlSchemaSet GetXMLSchema(string version) private static XmlSchemaSet GetXMLSchema(string version)
{ {
var resource = RessourceHelper.LoadResourceAsStream(RessourceHelper.ResourceType.XMLSchema, "VectoComponent.xsd");
var xset = new XmlSchemaSet() { XmlResolver = new XmlResourceResolver() }; var xset = new XmlSchemaSet() { XmlResolver = new XmlResourceResolver() };
var reader = XmlReader.Create(resource, new XmlReaderSettings(), "schema://"); foreach (var schema in new[] {"VectoComponent.xsd", "VectoInput.xsd", "VectoOutputManufacturer.xsd", "VectoOutputCustomer.xsd"}) {
xset.Add(XmlSchema.Read(reader, null)); var resource = RessourceHelper.LoadResourceAsStream(RessourceHelper.ResourceType.XMLSchema, schema);
var reader = XmlReader.Create(resource, new XmlReaderSettings(), "schema://");
xset.Add(XmlSchema.Read(reader, null));
}
xset.Compile(); xset.Compile();
return xset; return xset;
} }
......
...@@ -27,13 +27,13 @@ namespace HashingTool.ViewModel ...@@ -27,13 +27,13 @@ namespace HashingTool.ViewModel
private readonly RelayCommand _saveCommand; private readonly RelayCommand _saveCommand;
private bool _busy; private bool _busy;
private XMLFile _sourceFile; private readonly XMLFile _sourceFile;
private bool? _componentDataValid; private bool? _componentDataValid;
public HashComponentDataViewModel() public HashComponentDataViewModel()
{ {
XMLValidationErrors = new ObservableCollection<string>(); XMLValidationErrors = new ObservableCollection<string>();
_sourceFile = new XMLFile(_ioService, false); _sourceFile = new XMLFile(IoService, false, IsComponentFile);
_sourceFile.PropertyChanged += SourceChanged; _sourceFile.PropertyChanged += SourceChanged;
_saveCommand = new RelayCommand(SaveDocument, _saveCommand = new RelayCommand(SaveDocument,
() => !_busy && ComponentDataValid != null && ComponentDataValid.Value && _result != null); () => !_busy && ComponentDataValid != null && ComponentDataValid.Value && _result != null);
...@@ -97,7 +97,7 @@ namespace HashingTool.ViewModel ...@@ -97,7 +97,7 @@ namespace HashingTool.ViewModel
private void SaveDocument() private void SaveDocument()
{ {
string filename; string filename;
var stream = _ioService.SaveData(null, ".xml", "VECTO XML file|*.xml", out filename); var stream = IoService.SaveData(null, ".xml", "VECTO XML file|*.xml", out filename);
if (stream == null) { if (stream == null) {
return; return;
} }
...@@ -127,6 +127,11 @@ namespace HashingTool.ViewModel ...@@ -127,6 +127,11 @@ namespace HashingTool.ViewModel
private async void DoComputeHash() private async void DoComputeHash()
{ {
if (_sourceFile.Document == null) {
ComponentDataValid = false;
DigestValue = "";
return;
}
try { try {
_busy = true; _busy = true;
ComponentDataValid = false; ComponentDataValid = false;
......
using System.ComponentModel; using System.ComponentModel;
using System.Linq;
using System.Xml;
using HashingTool.Helper; using HashingTool.Helper;
using TUGraz.VectoCommon.Resources;
using TUGraz.VectoHashing;
namespace HashingTool.ViewModel namespace HashingTool.ViewModel
{ {
public abstract class ObservableObject : INotifyPropertyChanged public abstract class ObservableObject : INotifyPropertyChanged
{ {
protected IOService _ioService = new WPFIoService(); protected IOService IoService = new WPFIoService();
public event PropertyChangedEventHandler PropertyChanged; public event PropertyChangedEventHandler PropertyChanged;
...@@ -16,5 +20,45 @@ namespace HashingTool.ViewModel ...@@ -16,5 +20,45 @@ namespace HashingTool.ViewModel
handler(this, new PropertyChangedEventArgs(propertyName)); handler(this, new PropertyChangedEventArgs(propertyName));
} }
} }
protected bool? IsManufacturerReport(XmlDocument x)
{
if (x == null || x.DocumentElement == null)
return null;
return x.DocumentElement.LocalName == XMLNames.VectoManufacturerReport;
}
protected bool? IsCustomerReport(XmlDocument x)
{
if (x == null || x.DocumentElement == null)
return null;
return x.DocumentElement != null && x.DocumentElement.LocalName == XMLNames.VectoCustomerReport;
}
protected static bool? IsJobFile(XmlDocument x)
{
if (x == null)
return null;
return x.DocumentElement != null && x.DocumentElement.LocalName == XMLNames.VectoInputDeclaration &&
x.DocumentElement.FirstChild.LocalName == XMLNames.Component_Vehicle;
}
protected static bool? IsComponentFile(XmlDocument x)
{
if (x.DocumentElement == null) {
return null;
}
if (x.DocumentElement.LocalName != XMLNames.VectoInputDeclaration) {
return false;
}
var localName = x.DocumentElement.FirstChild.LocalName;
var components = new[] {
VectoComponents.Engine, VectoComponents.Airdrag, VectoComponents.Angledrive, VectoComponents.Axlegear,
VectoComponents.Gearbox, VectoComponents.Retarder, VectoComponents.TorqueConverter, VectoComponents.Tyre
};
return components.Where(c => c.XMLElementName() == localName).Any();
}
} }
} }
using System; using System;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.IO; using System.IO;
using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Input; using System.Windows.Input;
using System.Xml; using System.Xml;
using System.Xml.Linq;
using System.Xml.Schema; using System.Xml.Schema;
using HashingTool.Helper; using HashingTool.Helper;
using HashingTool.Util; using HashingTool.Util;
...@@ -19,14 +21,20 @@ namespace HashingTool.ViewModel.UserControl ...@@ -19,14 +21,20 @@ namespace HashingTool.ViewModel.UserControl
private readonly bool _validate; private readonly bool _validate;
private XmlDocument _document; private XmlDocument _document;
private readonly Func<XmlDocument, bool?> _postVerification;
private bool? _contentValid;
private bool _hasContentValidation;
public XMLFile(IOService ioservice, bool validate = false) public XMLFile(IOService ioservice, bool validate = false, Func<XmlDocument, bool?> contentCheck = null)
{ {
_ioService = ioservice; IoService = ioservice;
_validate = validate; _validate = validate;
XMLValidationErrors = new ObservableCollection<string>(); XMLValidationErrors = new ObservableCollection<string>();
HasContentValidation = contentCheck != null;
_postVerification = contentCheck ?? (x => null);
Source = ""; Source = "";
RaisePropertyChanged("ValidateInput"); RaisePropertyChanged("ValidateInput");
RaisePropertyChanged("HasContentValidation");
} }
public XmlDocument Document public XmlDocument Document
...@@ -48,6 +56,7 @@ namespace HashingTool.ViewModel.UserControl ...@@ -48,6 +56,7 @@ namespace HashingTool.ViewModel.UserControl
if (_source == value) { if (_source == value) {
return; return;
} }
SetXMLFile(value);
_source = value; _source = value;
RaisePropertyChanged("Source"); RaisePropertyChanged("Source");
} }
...@@ -74,23 +83,49 @@ namespace HashingTool.ViewModel.UserControl ...@@ -74,23 +83,49 @@ namespace HashingTool.ViewModel.UserControl
public ICommand BrowseFileCommand public ICommand BrowseFileCommand
{ {
get { return new RelayCommand(ReadXMLFile, () => !_busy); } get { return new RelayCommand(BrowseXMLFile, () => !_busy); }
} }
public ICommand SetXMLFileCommnd
{
get { return new RelayCommand<string>(SetXMLFile, (f)=> !_busy);}
}
private async void SetXMLFile(string fileName)
{
if (!File.Exists(fileName)) {
Document = null;
XMLValidationErrors.Clear();
ContentValid = null;
IsValid = null;
return;
}
var stream = File.OpenRead(fileName);
private async void ReadXMLFile() await LoadXMLFile(stream);
}
private async void BrowseXMLFile()
{ {
string filename; string filename;
var stream = _ioService.OpenFileDialog(null, ".xml", "VECTO XML file|*.xml", out filename); var stream = IoService.OpenFileDialog(null, ".xml", "VECTO XML file|*.xml", out filename);
if (stream == null) { if (stream == null) {
return; return;
} }
await LoadXMLFile(stream);
Source = filename;
}
private async Task LoadXMLFile(Stream stream)
{
_busy = true; _busy = true;
IsValid = null; IsValid = null;
ContentValid = null;
XMLValidationErrors.Clear(); XMLValidationErrors.Clear();
Source = filename;
if (_validate) { if (_validate) {
var ms = new MemoryStream(); var ms = new MemoryStream();
...@@ -102,15 +137,31 @@ namespace HashingTool.ViewModel.UserControl ...@@ -102,15 +137,31 @@ namespace HashingTool.ViewModel.UserControl
var document = new XmlDocument(); var document = new XmlDocument();
var reader = XmlReader.Create(stream); var reader = XmlReader.Create(stream);
document.Load(reader); document.Load(reader);
ContentValid = _postVerification(document);
Document = document; Document = document;
_busy = false; _busy = false;
} }
public bool HasContentValidation { get; private set; }
public bool? ContentValid
{
get { return _contentValid; }
set {
if (_contentValid == value) {
return;
}
_contentValid = value;
RaisePropertyChanged("ContentValid");
}
}
private async void Validate(XmlReader xml) private async void Validate(XmlReader xml)
{ {
var valid = true;
try { try {
IsValid = true;
var validator = new XMLValidator(r => { IsValid = r; }, var validator = new XMLValidator(r => { valid = r; },
(s, e) => { (s, e) => {
Application.Current.Dispatcher.Invoke(() => XMLValidationErrors.Add( Application.Current.Dispatcher.Invoke(() => XMLValidationErrors.Add(
string.Format("Validation {0} Line {2}: {1}", s == XmlSeverityType.Warning ? "WARNING" : "ERROR", string.Format("Validation {0} Line {2}: {1}", s == XmlSeverityType.Warning ? "WARNING" : "ERROR",
...@@ -122,8 +173,9 @@ namespace HashingTool.ViewModel.UserControl ...@@ -122,8 +173,9 @@ namespace HashingTool.ViewModel.UserControl
}); });
await validator.ValidateXML(xml); await validator.ValidateXML(xml);
} catch (Exception e) { } catch (Exception e) {
IsValid = false;
XMLValidationErrors.Add(e.Message); XMLValidationErrors.Add(e.Message);
} finally {
IsValid = valid;
} }
} }
} }
......
...@@ -17,12 +17,12 @@ namespace HashingTool.ViewModel ...@@ -17,12 +17,12 @@ namespace HashingTool.ViewModel
private string _digestValueRead; private string _digestValueRead;
private bool _componentDataValid; private bool _componentDataValid;
private string _componentType; private string _componentType;
private XMLFile _componentFile; private readonly XMLFile _componentFile;
public VerifyComponentInputDataViewModel() public VerifyComponentInputDataViewModel()
{ {
_componentFile = new XMLFile(_ioService, true); _componentFile = new XMLFile(IoService, true, IsComponentFile);
_componentFile.PropertyChanged += ComponentFilechanged; _componentFile.PropertyChanged += ComponentFilechanged;
// TODO! // TODO!
...@@ -111,11 +111,18 @@ namespace HashingTool.ViewModel ...@@ -111,11 +111,18 @@ namespace HashingTool.ViewModel
private void DoValidateHash() private void DoValidateHash()
{ {
if (_componentFile.ContentValid == null || !_componentFile.ContentValid.Value || _componentFile.Document == null) {
ComponentDataValid = false;
DigestValueComputed = "";
DigestValueRead = "";
Component = "";
return;
}
try { try {
var h = VectoHash.Load(_componentFile.Document); var h = VectoHash.Load(_componentFile.Document);
if (h.GetContainigComponents().Count != 1) { if (h.GetContainigComponents().Count != 1) {
_ioService.Messagebox("Selected file is not a component file!", "Error reading XML File", MessageBoxButton.OK); IoService.Messagebox("Selected file is not a component file!", "Error reading XML File", MessageBoxButton.OK);
throw new InvalidDataException(); throw new InvalidDataException();
} }
Component = h.GetContainigComponents().First().XMLElementName(); Component = h.GetContainigComponents().First().XMLElementName();
......
...@@ -20,7 +20,7 @@ namespace HashingTool.ViewModel ...@@ -20,7 +20,7 @@ namespace HashingTool.ViewModel
public VerifyJobInputDataViewModel() public VerifyJobInputDataViewModel()
{ {
_jobFile = new XMLFile(_ioService, true); _jobFile = new XMLFile(IoService, true, IsJobFile);
_jobFile.PropertyChanged += JobFilechanged; _jobFile.PropertyChanged += JobFilechanged;
// TODO! // TODO!
...@@ -89,6 +89,8 @@ namespace HashingTool.ViewModel ...@@ -89,6 +89,8 @@ namespace HashingTool.ViewModel
private void DoValidateHash() private void DoValidateHash()
{ {
if (_jobFile.ContentValid == null || !_jobFile.ContentValid.Value)
return;
try { try {
Components.Clear(); Components.Clear();
var h = VectoHash.Load(_jobFile.Document); var h = VectoHash.Load(_jobFile.Document);
...@@ -132,6 +134,5 @@ namespace HashingTool.ViewModel ...@@ -132,6 +134,5 @@ namespace HashingTool.ViewModel
public string DigestValueComputed { get; set; } public string DigestValueComputed { get; set; }
public string[] CanonicalizationMethod { get; set; } public string[] CanonicalizationMethod { get; set; }
public bool Valid { get; set; } public bool Valid { get; set; }
public bool InValid { get { return !Valid; } }
} }
} }
using System.Collections.Generic; using System;
using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.ComponentModel;
using System.IO;
using System.Linq; using System.Linq;
using System.Windows;
using System.Windows.Input; using System.Windows.Input;
using HashingTool.Helper; using System.Xml;
using System.Xml.Linq;
using HashingTool.ViewModel.UserControl; using HashingTool.ViewModel.UserControl;
using TUGraz.VectoCommon.Resources;
using TUGraz.VectoHashing;
namespace HashingTool.ViewModel namespace HashingTool.ViewModel
{ {
public class VerifyResultDataViewModel : ObservableObject, IMainView public class VerifyResultDataViewModel : ObservableObject, IMainView
{ {
private ApplicationViewModel _applicationViewModel; private ApplicationViewModel _applicationViewModel;
private HashedXMLFile _jobFile; private VectoXMLFile _jobFile;
private HashedXMLFile _customerReport; private ReportXMLFile _customerReport;
private HashedXMLFile _manufacturerReport; private ReportXMLFile _manufacturerReport;
public const string ToolTip_InvalidFileType = "Invalid File type!";
public const string ToolTip_XMLValidationFailed = "XML validation failed!";
public const string ToolTip_OK = "Correct file selected";
public const string ToolTip_HashInvalid = "Incorrect digest value!";
public const string ToolTip_None = "";
public VerifyResultDataViewModel() public VerifyResultDataViewModel()
{ {
_jobFile = new HashedXMLFile(_ioService, "Job File"); _jobFile = new VectoXMLFile(IoService, "Job File", IsJobFile, HashJobFile);
_manufacturerReport = new HashedXMLFile(_ioService, "Manufacturer Report"); _manufacturerReport = new ReportXMLFile(IoService, "Manufacturer Report", IsManufacturerReport, ValidateDocumentHash);
_customerReport = new HashedXMLFile(_ioService, "Customer Report"); _customerReport = new ReportXMLFile(IoService, "Customer Report", IsCustomerReport, ValidateDocumentHash);
Files = new ObservableCollection<HashedXMLFile>(); Files = new ObservableCollection<VectoXMLFile> { _jobFile, _manufacturerReport, _customerReport };
Files.Add(_jobFile);
Files.Add(_manufacturerReport);
Files.Add(_customerReport);
CanonicalizationMethods = new ObservableCollection<string>() { "urn:vecto:xml:2017:canonicalization" }; CanonicalizationMethods = new ObservableCollection<string>() { "urn:vecto:xml:2017:canonicalization" };
RaisePropertyChanged("CanonicalizationMethods"); RaisePropertyChanged("CanonicalizationMethods");
_customerReport.PropertyChanged += Update;
_manufacturerReport.PropertyChanged += Update;
} }
private void Update(object sender, PropertyChangedEventArgs e)
{
RaisePropertyChanged("ManufacturerReportValid");
RaisePropertyChanged("CustomerReportReportValid");
}
public VerifyResultDataViewModel(ApplicationViewModel applicationViewModel) : this() public VerifyResultDataViewModel(ApplicationViewModel applicationViewModel) : this()
{ {
_applicationViewModel = applicationViewModel; _applicationViewModel = applicationViewModel;
} }
public ObservableCollection<string> CanonicalizationMethods { get; private set; } public ObservableCollection<string> CanonicalizationMethods { get; private set; }
...@@ -46,7 +65,7 @@ namespace HashingTool.ViewModel ...@@ -46,7 +65,7 @@ namespace HashingTool.ViewModel
get { return ApplicationViewModel.HomeView; } get { return ApplicationViewModel.HomeView; }
} }
public HashedXMLFile JobFile public VectoXMLFile JobFile
{ {
get { return _jobFile; } get { return _jobFile; }
} }
...@@ -62,89 +81,55 @@ namespace HashingTool.ViewModel ...@@ -62,89 +81,55 @@ namespace HashingTool.ViewModel
get { return _manufacturerReport; } get { return _manufacturerReport; }
} }
public ObservableCollection<HashedXMLFile> Files { get; private set; } public ObservableCollection<VectoXMLFile> Files { get; private set; }
public class HashedXMLFile : ObservableObject public bool ManufacturerReportValid
{ {
private XMLFile _xmlFile; get {
return _manufacturerReport.Valid != null && _manufacturerReport.Valid.Value &&
private string _manufacturerDigestComputed; _manufacturerReport.JobDigest == _jobFile.DigestValueComputed;
private string _manufacturerDigestRead;
private bool? _valid;
private string _name;
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 HashedXMLFile() {} public bool CustomerReportReportValid
{
get {
public XMLFile XMLFile return _customerReport.Valid != null && _customerReport.Valid.Value &&
{ _customerReport.JobDigest == _jobFile.DigestValueComputed;
get { return _xmlFile; }
} }
}
public string Name private void HashJobFile(XmlDocument xml, VectoXMLFile xmlViewModel)
{ {
get { return _name; } try {
private set { var h = VectoHash.Load(xml);
if (_name == value) { xmlViewModel.DigestValueComputed = h.ComputeHash();
return; } catch (Exception e) {
} xmlViewModel.DigestValueComputed = "";
_name = value;
RaisePropertyChanged("Name");
}
} }
}
public string[] CanonicalizationMethods { get; private set; } private void ValidateDocumentHash(XmlDocument xml, VectoXMLFile xmlViewModel)
{
var report = xmlViewModel as ReportXMLFile;
public string DigestValueComputed if (report == null) {
{ return;
get { return _manufacturerDigestComputed; }
private set {
if (_manufacturerDigestComputed == value) {
return;
}
_manufacturerDigestComputed = value;
RaisePropertyChanged("DigestValueComputed");
}
} }
try {
public string DigestValueRead var h = VectoHash.Load(xml);
{ try {
get { return _manufacturerDigestRead; } report.DigestValueRead = h.ReadHash();
private set { } catch {
if (_manufacturerDigestRead == value) { report.DigestValueRead = "";
return;
}
_manufacturerDigestRead = value;
RaisePropertyChanged("DigestValueRead");
} }
} try {
report.DigestValueComputed = h.ComputeHash();
public bool? Valid } catch {
{ report.DigestValueComputed = "";
get { return _valid; }
private set {
if (_valid == value) {
return;
}
_valid = value;
RaisePropertyChanged("Valid");
} }
report.Valid = h.ValidateHash();
} catch (Exception e) {
report.Valid = false;
} }
} }
} }
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
<Button Content="Save Component Data" HorizontalAlignment="Right" Margin="0,0,90,10" Width="143" Height="22" <Button Content="Save Component Data" HorizontalAlignment="Right" Margin="0,0,90,10" Width="143" Height="22"
VerticalAlignment="Bottom" Command="{Binding SaveHashedDocument, Mode=OneWay}" /> VerticalAlignment="Bottom" Command="{Binding SaveHashedDocument, Mode=OneWay}" />
<local:VectoXMLFileSelector Margin="0,93,0,0" VerticalAlignment="Top" XMLFile="{Binding ComponentFile}" /> <local:VectoXMLFileSelector Margin="10,93,10,0" VerticalAlignment="Top" XMLFile="{Binding ComponentFile}" />
<Grid Margin="15,141,5,37"> <Grid Margin="15,141,5,37">
<Grid.RowDefinitions> <Grid.RowDefinitions>
...@@ -94,15 +94,15 @@ ...@@ -94,15 +94,15 @@
<ContentControl.Style> <ContentControl.Style>
<Style TargetType="ContentControl"> <Style TargetType="ContentControl">
<Setter Property="Content" Value="" /> <Setter Property="Content" Value="" />
<Setter Property="ToolTip" Value="X"/> <Setter Property="ToolTip" Value="X" />
<Style.Triggers> <Style.Triggers>
<DataTrigger Binding="{Binding ComponentDataValid}" Value="True"> <DataTrigger Binding="{Binding ComponentDataValid}" Value="True">
<Setter Property="ContentTemplate" Value="{StaticResource Icon_OK}" /> <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>
<DataTrigger Binding="{Binding ComponentDataValid}" Value="False"> <DataTrigger Binding="{Binding ComponentDataValid}" Value="False">
<Setter Property="ContentTemplate" Value="{StaticResource Icon_NOK}" /> <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> </DataTrigger>
</Style.Triggers> </Style.Triggers>
</Style> </Style>
......
...@@ -5,45 +5,85 @@ ...@@ -5,45 +5,85 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:views="clr-namespace:HashingTool.Views" xmlns:views="clr-namespace:HashingTool.Views"
x:Class="HashingTool.Views.VectoXMLFileSelector" x:Class="HashingTool.Views.VectoXMLFileSelector"
mc:Ignorable="d" d:DesignWidth="456" MinHeight="43" mc:Ignorable="d" d:DesignWidth="456" MinHeight="32"
d:DataContext="{d:DesignInstance views:VectoXMLFileSelector}" Height="81"> d:DataContext="{d:DesignInstance views:VectoXMLFileSelector}">
<UserControl.Resources> <UserControl.Resources>
<BooleanToVisibilityConverter x:Key="BoolToVis" /> <BooleanToVisibilityConverter x:Key="BoolToVis" />
</UserControl.Resources> </UserControl.Resources>
<Grid> <StackPanel Margin="0,5" HorizontalAlignment="Stretch">
<TextBox Height="23" Margin="10,10,140,0" TextWrapping="Wrap" Text="{Binding XMLFile.Source}" VerticalAlignment="Top" /> <DockPanel HorizontalAlignment="Stretch" Height="Auto" Margin="0" VerticalAlignment="Top">
<Button Content="Browse ..." Command="{Binding XMLFile.BrowseFileCommand, Mode=OneWay}" Margin="0,10,10,0"
VerticalAlignment="Top" HorizontalAlignment="Right" Width="75" /> <ContentControl DockPanel.Dock="Right"
<ContentControl Visibility="{Binding XMLFile.ValidateInput, Converter={StaticResource BoolToVis}}" Height="33" Visibility="{Binding XMLFile.HasContentValidation, Converter={StaticResource BoolToVis}}" Width="40" Height="40"
Margin="0,14,40,-4" VerticalAlignment="Top" HorizontalAlignment="Right" Width="93"> Margin="10,0,0,0">
<ContentControl.RenderTransform> <ContentControl.LayoutTransform>
<ScaleTransform ScaleX="0.5" ScaleY="0.5" /> <ScaleTransform ScaleX=".4" ScaleY=".4" />
</ContentControl.RenderTransform> </ContentControl.LayoutTransform>
<ContentControl.Style> <ContentControl.Style>
<Style TargetType="ContentControl"> <Style TargetType="ContentControl">
<Setter Property="ContentTemplate" Value="{StaticResource ICON_XML_unknown}" /> <Setter Property="Content" Value="" />
<Setter Property="ToolTip" Value="Not validated" /> <Setter Property="ToolTip" Value="Not Validated" />
<Style.Triggers> <Style.Triggers>
<DataTrigger Binding="{Binding XMLFile.IsValid}" Value="True"> <DataTrigger Binding="{Binding XMLFile.ContentValid}" Value="True">
<Setter Property="ContentTemplate" Value="{StaticResource Icon_XML_OK}" /> <Setter Property="ContentTemplate" Value="{StaticResource Icon_OK}" />
<Setter Property="ToolTip" Value="Valid XML" /> <Setter Property="ToolTip" Value="Correct Filetype" />
</DataTrigger> </DataTrigger>
<DataTrigger Binding="{Binding XMLFile.IsValid}" Value="False"> <DataTrigger Binding="{Binding XMLFile.ContentValid}" Value="False">
<Setter Property="ContentTemplate" Value="{StaticResource Icon_XML_NOK}" /> <Setter Property="ContentTemplate" Value="{StaticResource Icon_NOK}" />
<Setter Property="ToolTip" Value="Invalid XML" /> <Setter Property="ToolTip" Value="Incorrect Filetype!" />
</DataTrigger> </DataTrigger>
</Style.Triggers> </Style.Triggers>
</Style> </Style>
</ContentControl.Style> </ContentControl.Style>
</ContentControl> </ContentControl>
<ContentControl DockPanel.Dock="Right"
Visibility="{Binding XMLFile.ValidateInput, Converter={StaticResource BoolToVis}}" Height="33"
Margin="0,5,0,0" VerticalAlignment="Top" HorizontalAlignment="Right" Width="90">
<ContentControl.LayoutTransform>
<ScaleTransform ScaleX="0.5" ScaleY="0.5" />
</ContentControl.LayoutTransform>
<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>
</ContentControl.Style>
</ContentControl>
<Button DockPanel.Dock="Right" Name="btnBrowse" Content="Browse ..."
Command="{Binding XMLFile.BrowseFileCommand, Mode=OneWay}"
Margin="0,0,10,0"
VerticalAlignment="Top" HorizontalAlignment="Right" Width="75" />
<TextBox DockPanel.Dock="Left" HorizontalAlignment="Stretch" VerticalAlignment="Top" Height="23"
Margin="0,0,10,0" TextWrapping="NoWrap" Text="{Binding XMLFile.Source, UpdateSourceTrigger=PropertyChanged}">
<TextBox.InputBindings>
<KeyBinding Command="{Binding XMLFile.SetXMLFileCommnd}" Key="Return"/>
</TextBox.InputBindings>
</TextBox>
</DockPanel>
<StackPanel Orientation="Horizontal" Margin="10,44,0,10"> <StackPanel Orientation="Horizontal" Margin="0,5,0,0">
<StackPanel.Style> <StackPanel.Style>
<Style TargetType="StackPanel"> <Style TargetType="StackPanel">
<Setter Property="Visibility" Value="{Binding XMLFile.ValidateInput, Converter={StaticResource BoolToVis}}" /> <Setter Property="Visibility" Value="{Binding XMLFile.ValidateInput, Converter={StaticResource BoolToVis}}" />
</Style> </Style>
</StackPanel.Style> </StackPanel.Style>
<Label Content="{Binding XMLFile.XMLValidationErrors.Count}" ContentStringFormat="{}{0} Warnings/Errors" <Label Content="{Binding XMLFile.XMLValidationErrors.Count}"
ContentStringFormat="XML Validation: {0} Warnings/Errors"
MinWidth="80"> MinWidth="80">
<Label.Style> <Label.Style>
<Style TargetType="Label"> <Style TargetType="Label">
...@@ -70,5 +110,5 @@ ...@@ -70,5 +110,5 @@
</Button.Style> </Button.Style>
</Button> </Button>
</StackPanel> </StackPanel>
</Grid> </StackPanel>
</UserControl> </UserControl>
\ No newline at end of file
using System.Windows; using System.Windows;
using System.Windows.Automation.Peers;
using HashingTool.ViewModel.UserControl; using HashingTool.ViewModel.UserControl;
namespace HashingTool.Views namespace HashingTool.Views
...@@ -31,5 +32,6 @@ namespace HashingTool.Views ...@@ -31,5 +32,6 @@ namespace HashingTool.Views
dialog.ShowDialog(); dialog.ShowDialog();
} }
} }
} }
...@@ -88,12 +88,14 @@ ...@@ -88,12 +88,14 @@
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="{Binding Component}" Margin="4,0" /> <TextBlock Grid.Column="0" Text="{Binding Component}" Margin="4,0" />
<StackPanel Grid.Column="1" VerticalAlignment="Top" Width="16" Height="16" HorizontalAlignment="Left"> <StackPanel Grid.Column="1" VerticalAlignment="Top" Width="16" Height="16" HorizontalAlignment="Left">
<ContentControl ContentTemplate="{StaticResource Icon_OK}" Visibility="{Binding Valid, Converter={StaticResource Bool2Vis}}"> <ContentControl ContentTemplate="{StaticResource Icon_OK}"
Visibility="{Binding Valid, Converter={StaticResource Bool2Vis}}">
<ContentControl.RenderTransform> <ContentControl.RenderTransform>
<ScaleTransform ScaleX=".4" ScaleY=".4" /> <ScaleTransform ScaleX=".4" ScaleY=".4" />
</ContentControl.RenderTransform> </ContentControl.RenderTransform>
</ContentControl> </ContentControl>
<ContentControl ContentTemplate="{StaticResource Icon_NOK}" Visibility="{Binding Path=InValid, Converter={StaticResource Bool2Vis}}"> <ContentControl ContentTemplate="{StaticResource Icon_NOK}"
Visibility="{Binding Path=InValid, Converter={StaticResource Bool2Vis}}">
<ContentControl.RenderTransform> <ContentControl.RenderTransform>
<ScaleTransform ScaleX=".4" ScaleY=".4" /> <ScaleTransform ScaleX=".4" ScaleY=".4" />
</ContentControl.RenderTransform> </ContentControl.RenderTransform>
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
xmlns:hashingTool="clr-namespace:HashingTool" xmlns:hashingTool="clr-namespace:HashingTool"
xmlns:helper="clr-namespace:HashingTool.Helper" xmlns:helper="clr-namespace:HashingTool.Helper"
x:Class="HashingTool.Views.VerifyResults" x:Class="HashingTool.Views.VerifyResults"
mc:Ignorable="d" Height="437.5" Width="550"> mc:Ignorable="d">
<UserControl.DataContext> <UserControl.DataContext>
<ViewModel:VerifyResultDataViewModel /> <ViewModel:VerifyResultDataViewModel />
</UserControl.DataContext> </UserControl.DataContext>
...@@ -16,6 +16,147 @@ ...@@ -16,6 +16,147 @@
<helper:CollectionConverter x:Key="CollectionConverter" /> <helper:CollectionConverter x:Key="CollectionConverter" />
<BooleanToVisibilityConverter x:Key="Bool2Vis" /> <BooleanToVisibilityConverter x:Key="Bool2Vis" />
<DataTemplate x:Key="ExpanderHeader">
<DockPanel HorizontalAlignment="Stretch" VerticalAlignment="top" MinWidth="450">
<TextBlock DockPanel.Dock="Top" Text="{Binding Name}" />
<ContentControl DockPanel.Dock="Right" Width="35" Height="35" Margin="10,-10,10,0"
ToolTip="{Binding ValidTooltip}">
<ContentControl.LayoutTransform>
<ScaleTransform ScaleX=".4" ScaleY=".4" />
</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>
<views:VectoXMLFileSelector DockPanel.Dock="Left" Margin="0,0,0,0" VerticalAlignment="Top"
XMLFile="{Binding XMLFile}" Height="1" />
</DockPanel>
</DataTemplate>
<DataTemplate x:Key="ExpanderContentJobFile" DataType="ViewModel:VectoXMLFile">
<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='{}XML Validation: {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" Click="Button_Click">
<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, Mode=OneWay , Converter={StaticResource CollectionConverter}}"
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>
</DataTemplate>
<DataTemplate x:Key="ExpanderContentReport" DataType="ViewModel:ReportXMLFile">
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<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" Click="Button_Click">
<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="Job Digest Value from file:" />
<TextBox Text="{Binding JobDigest, Mode=OneWay}"
Margin="155,0,10,0" IsReadOnly="True" />
</Grid>
<Grid Row="2" Margin="10,2,0,3">
<Label Content="Canonicalization methods:" />
<TextBox Text="{Binding CanonicalizationMethods, Mode=OneWay , Converter={StaticResource CollectionConverter}}"
Margin="155,0,10,0" IsReadOnly="True" />
</Grid>
<Grid Row="3" Margin="10,2,0,3">
<Label Content="Digest Value read:" />
<TextBox Text="{Binding DigestValueRead}" Margin="155,0,10,0" IsReadOnly="True" />
</Grid>
<Grid Row="4" Margin="10,2,0,3">
<Label Content="Digest Value computed:" />
<TextBox Text="{Binding DigestValueComputed}" Margin="155,0,10,0" IsReadOnly="True" />
</Grid>
</Grid>
</DataTemplate>
<SolidColorBrush x:Key="Expander.MouseOver.Circle.Stroke" Color="#FF3C7FB1" /> <SolidColorBrush x:Key="Expander.MouseOver.Circle.Stroke" Color="#FF3C7FB1" />
<SolidColorBrush x:Key="Expander.MouseOver.Circle.Fill" Color="Transparent" /> <SolidColorBrush x:Key="Expander.MouseOver.Circle.Fill" Color="Transparent" />
<SolidColorBrush x:Key="Expander.MouseOver.Arrow.Stroke" Color="#222" /> <SolidColorBrush x:Key="Expander.MouseOver.Arrow.Stroke" Color="#222" />
...@@ -300,133 +441,117 @@ ...@@ -300,133 +441,117 @@
</Setter.Value> </Setter.Value>
</Setter> </Setter>
</Style> </Style>
</UserControl.Resources>
<Grid> </UserControl.Resources>
<Button x:Name="btnBack" Content="Back" Command="{Binding ShowHomeViewCommand}" Margin="0,0,10,10" <DockPanel>
<Button DockPanel.Dock="Bottom" x:Name="btnBack" Content="Back" Command="{Binding ShowHomeViewCommand}"
Margin="0,0,10,10"
HorizontalAlignment="Right" HorizontalAlignment="Right"
Width="75" Height="22" VerticalAlignment="Bottom" /> Width="75" Height="22" VerticalAlignment="Bottom" />
<Label x:Name="lblHeader" HorizontalAlignment="Center" Margin="10,10,0,0" VerticalAlignment="Top" <Label DockPanel.Dock="Top" x:Name="lblHeader" HorizontalAlignment="Center" Margin="10,10,0,0"
VerticalAlignment="Top"
Content="{Binding Name}" FontWeight="Bold" FontSize="18" /> Content="{Binding Name}" FontWeight="Bold" FontSize="18" />
<Grid Margin="0,80,0,0"> <Grid Margin="0,0,0,0" HorizontalAlignment="Stretch">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="*" MaxHeight="300" /> <RowDefinition Height="*" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<ScrollViewer Grid.Row="0" VerticalScrollBarVisibility="Auto" <!--<Border BorderBrush="White" BorderThickness="1" CornerRadius="4">
Margin="10,0"> <Border BorderBrush="#D5DFE5" BorderThickness="1" CornerRadius="3">
<Border BorderBrush="White" BorderThickness="1" CornerRadius="2"> -->
<ScrollViewer Grid.Row="0" VerticalScrollBarVisibility="Auto" HorizontalAlignment="Stretch"
Margin="10,0,10,10" Background="{x:Static SystemColors.ControlLightBrush}">
<ItemsControl ItemsSource="{Binding Files}" Name="lstInput" Height="365"> <ItemsControl ItemsSource="{Binding Files}" Name="lstInput" Margin="3">
<ItemsControl.ItemTemplate> <ItemsControl.ItemContainerStyle>
<DataTemplate> <Style>
<Expander Margin="4" Header="{Binding}"> <Setter Property="FrameworkElement.Margin" Value="0,2" />
<Expander.HeaderTemplate> </Style>
<DataTemplate> </ItemsControl.ItemContainerStyle>
<Grid HorizontalAlignment="Stretch"> <ItemsControl.Resources>
<Grid.ColumnDefinitions> <DataTemplate DataType="{x:Type ViewModel:VectoXMLFile}">
<ColumnDefinition MinWidth="350" />
<ColumnDefinition Width="50" /> <Border BorderBrush="White" BorderThickness="1" CornerRadius="2">
</Grid.ColumnDefinitions> <Expander Margin="2" Header="{Binding}" HorizontalAlignment="Stretch"
<Grid.RowDefinitions> Style="{DynamicResource ExpanderStyle1}"
<RowDefinition /> HeaderTemplate="{DynamicResource ExpanderHeader}"
<RowDefinition Height="35" /> ContentTemplate="{DynamicResource ExpanderContentJobFile}"
</Grid.RowDefinitions> Content="{Binding}" />
<TextBlock Grid.Row="0" Grid.Column="0" Text="{Binding Name}"/> </Border>
<views:VectoXMLFileSelector Grid.Row="1" Grid.Column="0" Margin="0,0,0,0" VerticalAlignment="Top"
XMLFile="{Binding XMLFile}" Height="31" /> </DataTemplate>
<StackPanel Grid.Row="1" Grid.Column="1" VerticalAlignment="Top" Width="16" Height="16" <DataTemplate DataType="{x:Type ViewModel:ReportXMLFile}">
HorizontalAlignment="Right"> <Border BorderBrush="White" BorderThickness="1" CornerRadius="2" Margin="0,0,3,0">
<ContentControl Visibility="{Binding Valid, Converter={StaticResource Bool2Vis}}"> <Expander Margin="2" Header="{Binding}" HorizontalAlignment="Stretch"
<ContentControl.RenderTransform> Style="{DynamicResource ExpanderStyle1}"
<ScaleTransform ScaleX=".4" ScaleY=".4" /> HeaderTemplate="{DynamicResource ExpanderHeader}" ContentTemplate="{DynamicResource ExpanderContentReport}"
</ContentControl.RenderTransform> Content="{Binding}" />
<ContentControl.Style> </Border>
<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> </DataTemplate>
</ItemsControl.ItemTemplate> </ItemsControl.Resources>
</ItemsControl> </ItemsControl>
</ScrollViewer> </ScrollViewer>
<!-- </Border>
</Border>
</Border>-->
<Grid Grid.Row="1" Margin="10,3,10,30" HorizontalAlignment="Center">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="50" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0" HorizontalAlignment="Center" TextAlignment="Center" Margin="5"
FontSize="14" FontWeight="Bold">
Job-File digest <LineBreak /> matches<LineBreak /> Manufacturer Report
</TextBlock>
<ContentControl Grid.Row="1" Grid.Column="0" Width="50" Height="50" Margin="10,10,10,0">
<ContentControl.LayoutTransform>
<ScaleTransform ScaleX="1.5" ScaleY="1.5" />
</ContentControl.LayoutTransform>
<ContentControl.Style>
<Style TargetType="ContentControl">
<Setter Property="ContentTemplate" Value="{StaticResource Icon_NOK}" />
<Style.Triggers>
<DataTrigger Binding="{Binding ManufacturerReportValid}" Value="True">
<Setter Property="ContentTemplate" Value="{StaticResource Icon_OK}" />
</DataTrigger>
</Style.Triggers>
</Style>
</ContentControl.Style>
</ContentControl>
<TextBlock Grid.Row="0" Grid.Column="2" HorizontalAlignment="Center" TextAlignment="Center" Margin="5"
FontSize="14" FontWeight="Bold">
Job-File digest <LineBreak /> matches<LineBreak /> Customer Report
</TextBlock>
<ContentControl Grid.Row="1" Grid.Column="2" Width="50" Height="50" Margin="10,10,10,0">
<ContentControl.LayoutTransform>
<ScaleTransform ScaleX="1.5" ScaleY="1.5" />
</ContentControl.LayoutTransform>
<ContentControl.Style>
<Style TargetType="ContentControl">
<Setter Property="ContentTemplate" Value="{StaticResource Icon_NOK}" />
<Style.Triggers>
<DataTrigger Binding="{Binding CustomerReportReportValid}" Value="True">
<Setter Property="ContentTemplate" Value="{StaticResource Icon_OK}" />
</DataTrigger>
</Style.Triggers>
</Style>
</ContentControl.Style>
</ContentControl>
</Grid>
</Grid> </Grid>
</Grid> </DockPanel>
</UserControl> </UserControl>
\ No newline at end of file
using System; using System.Windows;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Data; using HashingTool.ViewModel;
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 namespace HashingTool.Views
{ {
...@@ -29,5 +17,21 @@ namespace HashingTool.Views ...@@ -29,5 +17,21 @@ namespace HashingTool.Views
{ {
InitializeComponent(); InitializeComponent();
} }
private void Button_Click(object sender, RoutedEventArgs e)
{
var ui = sender as FrameworkElement;
if (ui == null)
return;
var context = ui.DataContext as HashedXMLFile;
if (context == null)
return;
var dialog = new XMLValidationErrorsDialog();
dialog.XMLErrors = context.XMLFile.XMLValidationErrors;
dialog.ShowDialog();
//MessageBox.Show("Hello World", "test", MessageBoxButton.OK);
}
} }
} }
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