diff --git a/HashingTool/HashingTool.csproj b/HashingTool/HashingTool.csproj index afb0355b1fb53d6502bd1d0fa6a09ece66071ef6..c75f9fa4679feef3e1a86e917d6c69ed3731f842 100644 --- a/HashingTool/HashingTool.csproj +++ b/HashingTool/HashingTool.csproj @@ -71,6 +71,7 @@ <AutoGen>True</AutoGen> <DesignTime>True</DesignTime> </Compile> + <Compile Include="ViewModel\HashedXMLFile.cs" /> <Compile Include="ViewModel\HomeViewModel.cs" /> <Compile Include="ViewModel\IMainView.cs" /> <Compile Include="ViewModel\ApplicationViewModel.cs" /> @@ -88,9 +89,6 @@ <Compile Include="Views\HomeView.xaml.cs"> <DependentUpon>HomeView.xaml</DependentUpon> </Compile> - <Compile Include="Views\Test.xaml.cs"> - <DependentUpon>Test.xaml</DependentUpon> - </Compile> <Compile Include="Views\UserControl\VectoXMLFileSelector.xaml.cs"> <DependentUpon>VectoXMLFileSelector.xaml</DependentUpon> </Compile> @@ -146,10 +144,6 @@ <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> </Page> - <Page Include="Views\Test.xaml"> - <SubType>Designer</SubType> - <Generator>MSBuild:Compile</Generator> - </Page> <Page Include="Views\UserControl\VectoXMLFileSelector.xaml"> <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> @@ -206,6 +200,10 @@ <Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" /> </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"> <Project>{B673E12F-D323-4C4C-8805-9915B2C72D3D}</Project> <Name>VectoHashing</Name> diff --git a/HashingTool/Util/XMLValidator.cs b/HashingTool/Util/XMLValidator.cs index da85aa7d5deebab48a08dd423f797de7dc96efa0..11154da3898f85881ebfb691b195a6e3f79f2bfe 100644 --- a/HashingTool/Util/XMLValidator.cs +++ b/HashingTool/Util/XMLValidator.cs @@ -58,10 +58,13 @@ namespace HashingTool.Util private static XmlSchemaSet GetXMLSchema(string version) { - var resource = RessourceHelper.LoadResourceAsStream(RessourceHelper.ResourceType.XMLSchema, "VectoComponent.xsd"); var xset = new XmlSchemaSet() { XmlResolver = new XmlResourceResolver() }; - var reader = XmlReader.Create(resource, new XmlReaderSettings(), "schema://"); - xset.Add(XmlSchema.Read(reader, null)); + foreach (var schema in new[] {"VectoComponent.xsd", "VectoInput.xsd", "VectoOutputManufacturer.xsd", "VectoOutputCustomer.xsd"}) { + var resource = RessourceHelper.LoadResourceAsStream(RessourceHelper.ResourceType.XMLSchema, schema); + + var reader = XmlReader.Create(resource, new XmlReaderSettings(), "schema://"); + xset.Add(XmlSchema.Read(reader, null)); + } xset.Compile(); return xset; } diff --git a/HashingTool/ViewModel/HashComponentDataViewModel.cs b/HashingTool/ViewModel/HashComponentDataViewModel.cs index e7850a7f4080a6a78f3b258b5e85086cc4c3f676..7f5af7cb3bac76b2a56e3a2f430f7d5272dce2ff 100644 --- a/HashingTool/ViewModel/HashComponentDataViewModel.cs +++ b/HashingTool/ViewModel/HashComponentDataViewModel.cs @@ -27,13 +27,13 @@ namespace HashingTool.ViewModel private readonly RelayCommand _saveCommand; private bool _busy; - private XMLFile _sourceFile; + private readonly XMLFile _sourceFile; private bool? _componentDataValid; public HashComponentDataViewModel() { XMLValidationErrors = new ObservableCollection<string>(); - _sourceFile = new XMLFile(_ioService, false); + _sourceFile = new XMLFile(IoService, false, IsComponentFile); _sourceFile.PropertyChanged += SourceChanged; _saveCommand = new RelayCommand(SaveDocument, () => !_busy && ComponentDataValid != null && ComponentDataValid.Value && _result != null); @@ -97,7 +97,7 @@ namespace HashingTool.ViewModel private void SaveDocument() { 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) { return; } @@ -127,6 +127,11 @@ namespace HashingTool.ViewModel private async void DoComputeHash() { + if (_sourceFile.Document == null) { + ComponentDataValid = false; + DigestValue = ""; + return; + } try { _busy = true; ComponentDataValid = false; diff --git a/HashingTool/ViewModel/ObservableObject.cs b/HashingTool/ViewModel/ObservableObject.cs index 6189ab66e2d250ee58467119ce3ca8f8e868d1f3..dfd7fdf018a912637ae68907710ed165c65b6b74 100644 --- a/HashingTool/ViewModel/ObservableObject.cs +++ b/HashingTool/ViewModel/ObservableObject.cs @@ -1,11 +1,15 @@ using System.ComponentModel; +using System.Linq; +using System.Xml; using HashingTool.Helper; +using TUGraz.VectoCommon.Resources; +using TUGraz.VectoHashing; namespace HashingTool.ViewModel { public abstract class ObservableObject : INotifyPropertyChanged { - protected IOService _ioService = new WPFIoService(); + protected IOService IoService = new WPFIoService(); public event PropertyChangedEventHandler PropertyChanged; @@ -16,5 +20,45 @@ namespace HashingTool.ViewModel 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(); + } } } diff --git a/HashingTool/ViewModel/UserControl/XMLFile.cs b/HashingTool/ViewModel/UserControl/XMLFile.cs index 501cff67911672b34ae6073d9dab8124418c05b0..92166dfb7b791a9d326ee6d96ae92ebba2a3e942 100644 --- a/HashingTool/ViewModel/UserControl/XMLFile.cs +++ b/HashingTool/ViewModel/UserControl/XMLFile.cs @@ -1,9 +1,11 @@ using System; using System.Collections.ObjectModel; using System.IO; +using System.Threading.Tasks; using System.Windows; using System.Windows.Input; using System.Xml; +using System.Xml.Linq; using System.Xml.Schema; using HashingTool.Helper; using HashingTool.Util; @@ -19,14 +21,20 @@ namespace HashingTool.ViewModel.UserControl private readonly bool _validate; 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; XMLValidationErrors = new ObservableCollection<string>(); + HasContentValidation = contentCheck != null; + _postVerification = contentCheck ?? (x => null); Source = ""; RaisePropertyChanged("ValidateInput"); + RaisePropertyChanged("HasContentValidation"); } public XmlDocument Document @@ -48,6 +56,7 @@ namespace HashingTool.ViewModel.UserControl if (_source == value) { return; } + SetXMLFile(value); _source = value; RaisePropertyChanged("Source"); } @@ -74,23 +83,49 @@ namespace HashingTool.ViewModel.UserControl 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; - 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) { return; } + await LoadXMLFile(stream); + Source = filename; + } + + private async Task LoadXMLFile(Stream stream) + { _busy = true; IsValid = null; + ContentValid = null; XMLValidationErrors.Clear(); - Source = filename; + if (_validate) { var ms = new MemoryStream(); @@ -102,15 +137,31 @@ namespace HashingTool.ViewModel.UserControl var document = new XmlDocument(); var reader = XmlReader.Create(stream); document.Load(reader); + ContentValid = _postVerification(document); Document = document; _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) { + var valid = true; try { - IsValid = true; - var validator = new XMLValidator(r => { IsValid = r; }, + + var validator = new XMLValidator(r => { valid = r; }, (s, e) => { Application.Current.Dispatcher.Invoke(() => XMLValidationErrors.Add( string.Format("Validation {0} Line {2}: {1}", s == XmlSeverityType.Warning ? "WARNING" : "ERROR", @@ -122,8 +173,9 @@ namespace HashingTool.ViewModel.UserControl }); await validator.ValidateXML(xml); } catch (Exception e) { - IsValid = false; XMLValidationErrors.Add(e.Message); + } finally { + IsValid = valid; } } } diff --git a/HashingTool/ViewModel/VerifyComponentInputDataViewModel.cs b/HashingTool/ViewModel/VerifyComponentInputDataViewModel.cs index 8ddfcfd1327fcaa429f95a6bb1d28e2c5f1bf602..6718fe3163a514579aff213eb2283e45445f1864 100644 --- a/HashingTool/ViewModel/VerifyComponentInputDataViewModel.cs +++ b/HashingTool/ViewModel/VerifyComponentInputDataViewModel.cs @@ -17,12 +17,12 @@ namespace HashingTool.ViewModel private string _digestValueRead; private bool _componentDataValid; private string _componentType; - private XMLFile _componentFile; + private readonly XMLFile _componentFile; public VerifyComponentInputDataViewModel() { - _componentFile = new XMLFile(_ioService, true); + _componentFile = new XMLFile(IoService, true, IsComponentFile); _componentFile.PropertyChanged += ComponentFilechanged; // TODO! @@ -111,11 +111,18 @@ namespace HashingTool.ViewModel private void DoValidateHash() { + if (_componentFile.ContentValid == null || !_componentFile.ContentValid.Value || _componentFile.Document == null) { + ComponentDataValid = false; + DigestValueComputed = ""; + DigestValueRead = ""; + Component = ""; + return; + } try { var h = VectoHash.Load(_componentFile.Document); 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(); } Component = h.GetContainigComponents().First().XMLElementName(); diff --git a/HashingTool/ViewModel/VerifyJobInputDataViewModel.cs b/HashingTool/ViewModel/VerifyJobInputDataViewModel.cs index 57730bd21d2a2fd2751352e62d767a92be179299..5676bb98d30c6a1cc23ef473dfb9ba21f0725200 100644 --- a/HashingTool/ViewModel/VerifyJobInputDataViewModel.cs +++ b/HashingTool/ViewModel/VerifyJobInputDataViewModel.cs @@ -20,7 +20,7 @@ namespace HashingTool.ViewModel public VerifyJobInputDataViewModel() { - _jobFile = new XMLFile(_ioService, true); + _jobFile = new XMLFile(IoService, true, IsJobFile); _jobFile.PropertyChanged += JobFilechanged; // TODO! @@ -89,6 +89,8 @@ namespace HashingTool.ViewModel private void DoValidateHash() { + if (_jobFile.ContentValid == null || !_jobFile.ContentValid.Value) + return; try { Components.Clear(); var h = VectoHash.Load(_jobFile.Document); @@ -132,6 +134,5 @@ namespace HashingTool.ViewModel public string DigestValueComputed { get; set; } public string[] CanonicalizationMethod { get; set; } public bool Valid { get; set; } - public bool InValid { get { return !Valid; } } } } diff --git a/HashingTool/ViewModel/VerifyResultDataViewModel.cs b/HashingTool/ViewModel/VerifyResultDataViewModel.cs index 74c9248397c08b429fdc202e86358857d03253ac..83a8519f8b7a29fba8c197348e0cc667d8e8e227 100644 --- a/HashingTool/ViewModel/VerifyResultDataViewModel.cs +++ b/HashingTool/ViewModel/VerifyResultDataViewModel.cs @@ -1,37 +1,56 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel; +using System.IO; using System.Linq; +using System.Windows; using System.Windows.Input; -using HashingTool.Helper; +using System.Xml; +using System.Xml.Linq; using HashingTool.ViewModel.UserControl; +using TUGraz.VectoCommon.Resources; +using TUGraz.VectoHashing; namespace HashingTool.ViewModel { public class VerifyResultDataViewModel : ObservableObject, IMainView { private ApplicationViewModel _applicationViewModel; - private HashedXMLFile _jobFile; - private HashedXMLFile _customerReport; - private HashedXMLFile _manufacturerReport; + private VectoXMLFile _jobFile; + private ReportXMLFile _customerReport; + 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() { - _jobFile = new HashedXMLFile(_ioService, "Job File"); - _manufacturerReport = new HashedXMLFile(_ioService, "Manufacturer Report"); - _customerReport = new HashedXMLFile(_ioService, "Customer Report"); - Files = new ObservableCollection<HashedXMLFile>(); - Files.Add(_jobFile); - Files.Add(_manufacturerReport); - Files.Add(_customerReport); + _jobFile = new VectoXMLFile(IoService, "Job File", IsJobFile, HashJobFile); + _manufacturerReport = new ReportXMLFile(IoService, "Manufacturer Report", IsManufacturerReport, ValidateDocumentHash); + _customerReport = new ReportXMLFile(IoService, "Customer Report", IsCustomerReport, ValidateDocumentHash); + Files = new ObservableCollection<VectoXMLFile> { _jobFile, _manufacturerReport, _customerReport }; CanonicalizationMethods = new ObservableCollection<string>() { "urn:vecto:xml:2017:canonicalization" }; RaisePropertyChanged("CanonicalizationMethods"); + _customerReport.PropertyChanged += Update; + _manufacturerReport.PropertyChanged += Update; } + private void Update(object sender, PropertyChangedEventArgs e) + { + RaisePropertyChanged("ManufacturerReportValid"); + RaisePropertyChanged("CustomerReportReportValid"); + } + + public VerifyResultDataViewModel(ApplicationViewModel applicationViewModel) : this() { _applicationViewModel = applicationViewModel; - } public ObservableCollection<string> CanonicalizationMethods { get; private set; } @@ -46,7 +65,7 @@ namespace HashingTool.ViewModel get { return ApplicationViewModel.HomeView; } } - public HashedXMLFile JobFile + public VectoXMLFile JobFile { get { return _jobFile; } } @@ -62,89 +81,55 @@ namespace HashingTool.ViewModel 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; - - private string _manufacturerDigestComputed; - 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; + get { + return _manufacturerReport.Valid != null && _manufacturerReport.Valid.Value && + _manufacturerReport.JobDigest == _jobFile.DigestValueComputed; } + } - public HashedXMLFile() {} - - - public XMLFile XMLFile - { - get { return _xmlFile; } + public bool CustomerReportReportValid + { + get { + return _customerReport.Valid != null && _customerReport.Valid.Value && + _customerReport.JobDigest == _jobFile.DigestValueComputed; } + } - public string Name - { - get { return _name; } - private set { - if (_name == value) { - return; - } - _name = value; - RaisePropertyChanged("Name"); - } + private void HashJobFile(XmlDocument xml, VectoXMLFile xmlViewModel) + { + try { + var h = VectoHash.Load(xml); + xmlViewModel.DigestValueComputed = h.ComputeHash(); + } catch (Exception e) { + xmlViewModel.DigestValueComputed = ""; } + } - public string[] CanonicalizationMethods { get; private set; } - - - public string DigestValueComputed - { - get { return _manufacturerDigestComputed; } - private set { - if (_manufacturerDigestComputed == value) { - return; - } - _manufacturerDigestComputed = value; - RaisePropertyChanged("DigestValueComputed"); - } + private void ValidateDocumentHash(XmlDocument xml, VectoXMLFile xmlViewModel) + { + var report = xmlViewModel as ReportXMLFile; + if (report == null) { + return; } - - public string DigestValueRead - { - get { return _manufacturerDigestRead; } - private set { - if (_manufacturerDigestRead == value) { - return; - } - _manufacturerDigestRead = value; - RaisePropertyChanged("DigestValueRead"); + try { + var h = VectoHash.Load(xml); + try { + report.DigestValueRead = h.ReadHash(); + } catch { + report.DigestValueRead = ""; } - } - - public bool? Valid - { - get { return _valid; } - private set { - if (_valid == value) { - return; - } - _valid = value; - RaisePropertyChanged("Valid"); + try { + report.DigestValueComputed = h.ComputeHash(); + } catch { + report.DigestValueComputed = ""; } + report.Valid = h.ValidateHash(); + } catch (Exception e) { + report.Valid = false; } } } diff --git a/HashingTool/Views/HashComponentData.xaml b/HashingTool/Views/HashComponentData.xaml index 32e5b50b4fea2362db857ce6afd84e729dad374d..c95e50199cb47b79dff96a6ee50091d90df4e6b6 100644 --- a/HashingTool/Views/HashComponentData.xaml +++ b/HashingTool/Views/HashComponentData.xaml @@ -24,7 +24,7 @@ <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="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.RowDefinitions> @@ -94,15 +94,15 @@ <ContentControl.Style> <Style TargetType="ContentControl"> <Setter Property="Content" Value="" /> - <Setter Property="ToolTip" Value="X"/> + <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"/> + <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> diff --git a/HashingTool/Views/UserControl/VectoXMLFileSelector.xaml b/HashingTool/Views/UserControl/VectoXMLFileSelector.xaml index fce60ce4f2acb07c45df8d82e7de80357643d949..3605aa3fc1778f8b3552527230b1ff4d99b00d2e 100644 --- a/HashingTool/Views/UserControl/VectoXMLFileSelector.xaml +++ b/HashingTool/Views/UserControl/VectoXMLFileSelector.xaml @@ -5,45 +5,85 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:views="clr-namespace:HashingTool.Views" x:Class="HashingTool.Views.VectoXMLFileSelector" - mc:Ignorable="d" d:DesignWidth="456" MinHeight="43" - d:DataContext="{d:DesignInstance views:VectoXMLFileSelector}" Height="81"> + mc:Ignorable="d" d:DesignWidth="456" MinHeight="32" + d:DataContext="{d:DesignInstance views:VectoXMLFileSelector}"> <UserControl.Resources> <BooleanToVisibilityConverter x:Key="BoolToVis" /> </UserControl.Resources> - <Grid> - <TextBox Height="23" Margin="10,10,140,0" TextWrapping="Wrap" Text="{Binding XMLFile.Source}" VerticalAlignment="Top" /> - <Button Content="Browse ..." Command="{Binding XMLFile.BrowseFileCommand, Mode=OneWay}" Margin="0,10,10,0" - VerticalAlignment="Top" HorizontalAlignment="Right" Width="75" /> - <ContentControl Visibility="{Binding XMLFile.ValidateInput, Converter={StaticResource BoolToVis}}" Height="33" - Margin="0,14,40,-4" VerticalAlignment="Top" HorizontalAlignment="Right" Width="93"> - <ContentControl.RenderTransform> - <ScaleTransform ScaleX="0.5" ScaleY="0.5" /> - </ContentControl.RenderTransform> - <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> + <StackPanel Margin="0,5" HorizontalAlignment="Stretch"> + <DockPanel HorizontalAlignment="Stretch" Height="Auto" Margin="0" VerticalAlignment="Top"> + + <ContentControl DockPanel.Dock="Right" + Visibility="{Binding XMLFile.HasContentValidation, Converter={StaticResource BoolToVis}}" Width="40" Height="40" + Margin="10,0,0,0"> + <ContentControl.LayoutTransform> + <ScaleTransform ScaleX=".4" ScaleY=".4" /> + </ContentControl.LayoutTransform> + <ContentControl.Style> + <Style TargetType="ContentControl"> + <Setter Property="Content" Value="" /> + <Setter Property="ToolTip" Value="Not Validated" /> + <Style.Triggers> + <DataTrigger Binding="{Binding XMLFile.ContentValid}" Value="True"> + <Setter Property="ContentTemplate" Value="{StaticResource Icon_OK}" /> + <Setter Property="ToolTip" Value="Correct Filetype" /> + </DataTrigger> + <DataTrigger Binding="{Binding XMLFile.ContentValid}" Value="False"> + <Setter Property="ContentTemplate" Value="{StaticResource Icon_NOK}" /> + <Setter Property="ToolTip" Value="Incorrect Filetype!" /> + </DataTrigger> + </Style.Triggers> + </Style> + </ContentControl.Style> + </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> <Style TargetType="StackPanel"> <Setter Property="Visibility" Value="{Binding XMLFile.ValidateInput, Converter={StaticResource BoolToVis}}" /> </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"> <Label.Style> <Style TargetType="Label"> @@ -70,5 +110,5 @@ </Button.Style> </Button> </StackPanel> - </Grid> + </StackPanel> </UserControl> \ No newline at end of file diff --git a/HashingTool/Views/UserControl/VectoXMLFileSelector.xaml.cs b/HashingTool/Views/UserControl/VectoXMLFileSelector.xaml.cs index 06743ce975c016beeb9713541f2658b455ce83a1..6833ffc72f62444bd99d08c17ca594a2f1841c2a 100644 --- a/HashingTool/Views/UserControl/VectoXMLFileSelector.xaml.cs +++ b/HashingTool/Views/UserControl/VectoXMLFileSelector.xaml.cs @@ -1,4 +1,5 @@ using System.Windows; +using System.Windows.Automation.Peers; using HashingTool.ViewModel.UserControl; namespace HashingTool.Views @@ -31,5 +32,6 @@ namespace HashingTool.Views dialog.ShowDialog(); } + } } diff --git a/HashingTool/Views/VerifyJobInputData.xaml b/HashingTool/Views/VerifyJobInputData.xaml index da4bc3d8df6fccfc8a5d8fccef2a7d9f131b0488..9e86b8f9d5f5e2ab91a5af74082580d67c27e05f 100644 --- a/HashingTool/Views/VerifyJobInputData.xaml +++ b/HashingTool/Views/VerifyJobInputData.xaml @@ -88,12 +88,14 @@ </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 ContentTemplate="{StaticResource Icon_OK}" + Visibility="{Binding Valid, Converter={StaticResource Bool2Vis}}"> <ContentControl.RenderTransform> <ScaleTransform ScaleX=".4" ScaleY=".4" /> </ContentControl.RenderTransform> </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> <ScaleTransform ScaleX=".4" ScaleY=".4" /> </ContentControl.RenderTransform> diff --git a/HashingTool/Views/VerifyResults.xaml b/HashingTool/Views/VerifyResults.xaml index d39f23bd9aa3f40df434ac0ca1146b719ebcbff4..c2467937e2bf40904d52e9377680d5af0b59e29c 100644 --- a/HashingTool/Views/VerifyResults.xaml +++ b/HashingTool/Views/VerifyResults.xaml @@ -8,7 +8,7 @@ xmlns:hashingTool="clr-namespace:HashingTool" xmlns:helper="clr-namespace:HashingTool.Helper" x:Class="HashingTool.Views.VerifyResults" - mc:Ignorable="d" Height="437.5" Width="550"> + mc:Ignorable="d"> <UserControl.DataContext> <ViewModel:VerifyResultDataViewModel /> </UserControl.DataContext> @@ -16,6 +16,147 @@ <helper:CollectionConverter x:Key="CollectionConverter" /> <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.Fill" Color="Transparent" /> <SolidColorBrush x:Key="Expander.MouseOver.Arrow.Stroke" Color="#222" /> @@ -300,133 +441,117 @@ </Setter.Value> </Setter> </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" 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" /> - <Grid Margin="0,80,0,0"> + <Grid Margin="0,0,0,0" HorizontalAlignment="Stretch"> <Grid.RowDefinitions> - <RowDefinition Height="*" MaxHeight="300" /> + <RowDefinition Height="*" /> <RowDefinition Height="Auto" /> </Grid.RowDefinitions> - <ScrollViewer Grid.Row="0" VerticalScrollBarVisibility="Auto" - Margin="10,0"> + <!--<Border BorderBrush="White" BorderThickness="1" CornerRadius="4"> + <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.ItemTemplate> - <DataTemplate> - <Expander Margin="4" Header="{Binding}"> - <Expander.HeaderTemplate> - <DataTemplate> - <Grid HorizontalAlignment="Stretch"> - <Grid.ColumnDefinitions> - <ColumnDefinition MinWidth="350" /> - <ColumnDefinition Width="50" /> - </Grid.ColumnDefinitions> - <Grid.RowDefinitions> - <RowDefinition /> - <RowDefinition Height="35" /> - </Grid.RowDefinitions> - <TextBlock Grid.Row="0" Grid.Column="0" Text="{Binding Name}"/> - <views:VectoXMLFileSelector Grid.Row="1" Grid.Column="0" Margin="0,0,0,0" VerticalAlignment="Top" - XMLFile="{Binding XMLFile}" Height="31" /> - <StackPanel Grid.Row="1" Grid.Column="1" VerticalAlignment="Top" Width="16" Height="16" - HorizontalAlignment="Right"> - <ContentControl Visibility="{Binding Valid, Converter={StaticResource Bool2Vis}}"> - <ContentControl.RenderTransform> - <ScaleTransform ScaleX=".4" ScaleY=".4" /> - </ContentControl.RenderTransform> - <ContentControl.Style> - <Style TargetType="ContentControl"> - <Setter Property="Content" Value="" /> - <Setter Property="ToolTip" Value="Not Validated" /> - <Style.Triggers> - <DataTrigger Binding="{Binding Valid}" Value="True"> - <Setter Property="ContentTemplate" Value="{StaticResource Icon_OK}" /> - <Setter Property="ToolTip" Value="Digest Values match" /> - </DataTrigger> - <DataTrigger Binding="{Binding Valid}" Value="False"> - <Setter Property="ContentTemplate" Value="{StaticResource Icon_NOK}" /> - <Setter Property="ToolTip" Value="Digest Values do NOT match" /> - </DataTrigger> - </Style.Triggers> - </Style> - </ContentControl.Style> - </ContentControl> + <ItemsControl ItemsSource="{Binding Files}" Name="lstInput" Margin="3"> + <ItemsControl.ItemContainerStyle> + <Style> + <Setter Property="FrameworkElement.Margin" Value="0,2" /> + </Style> + </ItemsControl.ItemContainerStyle> + <ItemsControl.Resources> + <DataTemplate DataType="{x:Type ViewModel:VectoXMLFile}"> + + <Border BorderBrush="White" BorderThickness="1" CornerRadius="2"> + <Expander Margin="2" Header="{Binding}" HorizontalAlignment="Stretch" + Style="{DynamicResource ExpanderStyle1}" + HeaderTemplate="{DynamicResource ExpanderHeader}" + ContentTemplate="{DynamicResource ExpanderContentJobFile}" + Content="{Binding}" /> + </Border> + + </DataTemplate> + <DataTemplate DataType="{x:Type ViewModel:ReportXMLFile}"> + <Border BorderBrush="White" BorderThickness="1" CornerRadius="2" Margin="0,0,3,0"> + <Expander Margin="2" Header="{Binding}" HorizontalAlignment="Stretch" + Style="{DynamicResource ExpanderStyle1}" + HeaderTemplate="{DynamicResource ExpanderHeader}" ContentTemplate="{DynamicResource ExpanderContentReport}" + Content="{Binding}" /> + </Border> - </StackPanel> - </Grid> - </DataTemplate> - </Expander.HeaderTemplate> - <Expander.Content> - <Border BorderBrush="{x:Static SystemColors.ControlDarkBrush}" BorderThickness="0,0,0,1"> - <Grid> - <Grid.RowDefinitions> - <RowDefinition /> - <RowDefinition /> - <RowDefinition /> - <RowDefinition /> - </Grid.RowDefinitions> - <StackPanel Orientation="Horizontal" Grid.Row="0"> - <Label> - <Label.Content> - <TextBlock Text="{Binding XMLFile.XMLValidationErrors.Count, StringFormat='{}{0} Warnings/Errors'}" /> - </Label.Content> - <Label.Style> - <Style TargetType="Label"> - <Setter Property="Foreground" Value="Red" /> - <Style.Triggers> - <DataTrigger Binding="{Binding XMLFile.XMLValidationErrors.Count}" Value="0"> - <Setter Property="Foreground" Value="Black" /> - </DataTrigger> - </Style.Triggers> - </Style> - </Label.Style> - </Label> - <Button Margin="10,0,0,0" Content="Details..." HorizontalAlignment="Left" Width="91"> - <Button.Style> - <Style TargetType="Button"> - <Setter Property="IsEnabled" Value="True" /> - <Style.Triggers> - <DataTrigger Binding="{Binding XMLFile.XMLValidationErrors.Count}" Value="0"> - <Setter Property="IsEnabled" Value="False" /> - </DataTrigger> - </Style.Triggers> - </Style> - </Button.Style> - </Button> - </StackPanel> - <Grid Row="1" Margin="10,13,0,3"> - <Label Content="Canonicalization methods:" /> - <TextBox Text="{Binding CanonicalizationMethods , Converter={StaticResource CollectionConverter}}" - Margin="155,0,10,0" IsReadOnly="True" /> - </Grid> - <Grid Row="2" Margin="10,2,0,3"> - <Label Content="Digest Value read:" /> - <TextBox Text="{Binding Name}" - Margin="155,0,10,0" IsReadOnly="True" /> - </Grid> - <Grid Row="3" Margin="10,2,0,3"> - <Label Content="Digest Value computed:" /> - <TextBox Text="{Binding DigestValueComputed}" - Margin="155,0,10,0" IsReadOnly="True" /> - </Grid> - </Grid> - </Border> - </Expander.Content> - </Expander> </DataTemplate> - </ItemsControl.ItemTemplate> + </ItemsControl.Resources> </ItemsControl> + </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> + </DockPanel> </UserControl> \ No newline at end of file diff --git a/HashingTool/Views/VerifyResults.xaml.cs b/HashingTool/Views/VerifyResults.xaml.cs index 4450573b0265a29e0d188d5bfe7fd8cccbea565b..b4f3fefed6c52541d6222b1f1479030fcf017dc2 100644 --- a/HashingTool/Views/VerifyResults.xaml.cs +++ b/HashingTool/Views/VerifyResults.xaml.cs @@ -1,18 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; +using System.Windows; using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; -using HashingTool.ViewModel.UserControl; +using HashingTool.ViewModel; namespace HashingTool.Views { @@ -29,5 +17,21 @@ namespace HashingTool.Views { 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); + } } }