Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS has been phased out. To see alternatives please check here

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

polishing the UI, additional errors in log

parent d4cef2c6
Branches
Tags
No related merge requests found
Showing
with 247 additions and 189 deletions
...@@ -43,6 +43,10 @@ ...@@ -43,6 +43,10 @@
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit> <Prefer32Bit>true</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<PropertyGroup>
<ApplicationIcon>
</ApplicationIcon>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />
...@@ -217,6 +221,13 @@ ...@@ -217,6 +221,13 @@
<Name>VectoCore</Name> <Name>VectoCore</Name>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup>
<Resource Include="Resources\HashingIcon.ico" />
<Resource Include="Resources\IVT_91x44.png" />
<Resource Include="Resources\JRC-About.png" />
<Resource Include="Resources\TUG_91x34.png" />
<Resource Include="Resources\VECTO_Hashing.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
xmlns:viewModel="clr-namespace:HashingTool.ViewModel" xmlns:viewModel="clr-namespace:HashingTool.ViewModel"
xmlns:views="clr-namespace:HashingTool.Views" xmlns:views="clr-namespace:HashingTool.Views"
x:Class="HashingTool.MainWindow" x:Class="HashingTool.MainWindow"
Title="VECTO Hashing Tool" Height="534" Width="665" MinWidth="600" MinHeight="500"> Title="VECTO Hashing Tool" Height="590" Width="800" MinWidth="800" MinHeight="600" Icon="Resources/HashingIcon.ico">
<Window.DataContext> <Window.DataContext>
<viewModel:ApplicationViewModel /> <viewModel:ApplicationViewModel />
</Window.DataContext> </Window.DataContext>
...@@ -25,9 +25,37 @@ ...@@ -25,9 +25,37 @@
<views:VerifyResults /> <views:VerifyResults />
</DataTemplate> </DataTemplate>
</Window.Resources> </Window.Resources>
<DockPanel>
<Grid DockPanel.Dock="Top" Height="100">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="256"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.Background>
<ImageBrush ImageSource="Resources/VECTO_Hashing.png" Stretch="None" AlignmentX="Left" AlignmentY="Center"/>
</Grid.Background>
<TextBlock Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" Text="VECTO Hashing Tool" FontSize="38" FontWeight="Bold" Margin="30,20,0,0"/>
</Grid>
<Border DockPanel.Dock="Bottom" BorderThickness="0,1,0,0" BorderBrush="{x:Static SystemColors.ControlDarkDarkBrush}"
Margin="2,0">
<Grid Background="White" Margin="0,10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Image Grid.Column="0" HorizontalAlignment="Center" Height="44" VerticalAlignment="Center" Width="auto"
Source="Resources/IVT_91x44.png" />
<Image Grid.Column="1" HorizontalAlignment="Center" Height="34" VerticalAlignment="Center" Width="auto"
Source="Resources/TUG_91x34.png" />
<Image Grid.Column="2" HorizontalAlignment="Center" Height="44" VerticalAlignment="Center" Width="auto"
Source="Resources/JRC-About.png" />
</Grid>
</Border>
<!--<ScrollViewer VerticalScrollBarVisibility="Auto">-->
<Grid Margin="10"> <Grid Margin="10">
<ContentControl Content="{Binding CurrentViewModel}" /> <ContentControl Content="{Binding CurrentViewModel}" />
</Grid> </Grid>
<!--</ScrollViewer>-->
</DockPanel>
</Window> </Window>
\ No newline at end of file
using System; using System;
using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.ComponentModel; using System.ComponentModel;
using System.IO; using System.IO;
using System.Text; using System.Text;
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.Linq;
using System.Xml.Schema; using System.Xml.Schema;
using HashingTool.Helper;
using HashingTool.Util; using HashingTool.Util;
using HashingTool.ViewModel.UserControl; using HashingTool.ViewModel.UserControl;
using TUGraz.VectoCore.Utils;
using TUGraz.VectoHashing; using TUGraz.VectoHashing;
namespace HashingTool.ViewModel namespace HashingTool.ViewModel
{ {
public class HashComponentDataViewModel : ObservableObject, IMainView public class HashComponentDataViewModel : ObservableObject, IMainView
{ {
private readonly ApplicationViewModel _applicationViewModel;
private string _digestValue; private string _digestValue;
private XDocument _result; private XDocument _result;
......
using System; using System;
using System.Collections.ObjectModel;
using System.ComponentModel; using System.ComponentModel;
using System.Xml; using System.Xml;
using HashingTool.Helper; using HashingTool.Helper;
...@@ -14,12 +15,12 @@ namespace HashingTool.ViewModel ...@@ -14,12 +15,12 @@ namespace HashingTool.ViewModel
protected bool? _valid; protected bool? _valid;
protected string _name; protected string _name;
protected string _tooltip; protected string _tooltip;
protected readonly Func<XmlDocument, bool?> _contentCheck; protected readonly Func<XmlDocument, Collection<string>, bool?> _contentCheck;
protected string _componentType; protected string _componentType;
protected readonly Action<XmlDocument, VectoXMLFile> _validateHashes; protected readonly Action<XmlDocument, VectoXMLFile> _validateHashes;
public VectoXMLFile(IOService ioService, string name, Func<XmlDocument, bool?> contentCheck, public VectoXMLFile(IOService ioService, string name, Func<XmlDocument, Collection<string>, bool?> contentCheck,
Action<XmlDocument, VectoXMLFile> hashValidation = null) Action<XmlDocument, VectoXMLFile> hashValidation = null)
{ {
IoService = ioService; IoService = ioService;
...@@ -34,36 +35,25 @@ namespace HashingTool.ViewModel ...@@ -34,36 +35,25 @@ namespace HashingTool.ViewModel
"http://www.w3.org/2001/10/xml-exc-c14n#" "http://www.w3.org/2001/10/xml-exc-c14n#"
}; };
Valid = null; Valid = null;
ValidTooltip = VerifyResultDataViewModel.ToolTip_None; ValidTooltip = VerifyResultDataViewModel.ToolTipNone;
} }
protected virtual void FileChanged(object sender, PropertyChangedEventArgs e) protected virtual void FileChanged(object sender, PropertyChangedEventArgs e)
{ {
if (_xmlFile.IsValid != null && XMLFile.IsValid.HasValue && _xmlFile.IsValid.Value) { if (_xmlFile.IsValid != null && XMLFile.IsValid.HasValue && _xmlFile.IsValid.Value) {
Valid = _contentCheck(_xmlFile.Document); Valid = _contentCheck(_xmlFile.Document, XMLFile.XMLValidationErrors);
if (Valid != null && Valid.Value) { if (Valid != null && Valid.Value) {
ValidTooltip = VerifyResultDataViewModel.ToolTip_OK; ValidTooltip = VerifyResultDataViewModel.ToolTipOk;
} else { } else {
ValidTooltip = VerifyResultDataViewModel.ToolTip_InvalidFileType; ValidTooltip = VerifyResultDataViewModel.ToolTipInvalidFileType;
} }
} else { } else {
Valid = false; Valid = false;
ValidTooltip = VerifyResultDataViewModel.ToolTip_XMLValidationFailed; ValidTooltip = VerifyResultDataViewModel.ToolTipXMLValidationFailed;
} }
if (Valid != null && Valid.Value && _validateHashes != null) { if (Valid != null && Valid.Value && _validateHashes != null) {
_validateHashes(_xmlFile.Document, this); _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 = "";
//}
} }
} }
...@@ -142,7 +132,7 @@ namespace HashingTool.ViewModel ...@@ -142,7 +132,7 @@ namespace HashingTool.ViewModel
{ {
protected string _manufacturerDigestRead; protected string _manufacturerDigestRead;
public HashedXMLFile(IOService ioService, string name, Func<XmlDocument, bool?> contentCheck, public HashedXMLFile(IOService ioService, string name, Func<XmlDocument, Collection<string>, bool?> contentCheck,
Action<XmlDocument, VectoXMLFile> hashValidation = null) : base(ioService, name, contentCheck, hashValidation) {} Action<XmlDocument, VectoXMLFile> hashValidation = null) : base(ioService, name, contentCheck, hashValidation) {}
public string DigestValueRead public string DigestValueRead
...@@ -162,7 +152,7 @@ namespace HashingTool.ViewModel ...@@ -162,7 +152,7 @@ namespace HashingTool.ViewModel
{ {
private string _jobDigestRead; private string _jobDigestRead;
public ReportXMLFile(IOService ioService, string name, Func<XmlDocument, bool?> contentCheck, public ReportXMLFile(IOService ioService, string name, Func<XmlDocument, Collection<string>, bool?> contentCheck,
Action<XmlDocument, VectoXMLFile> hashValidation = null) Action<XmlDocument, VectoXMLFile> hashValidation = null)
: base(ioService, name, contentCheck, hashValidation) : base(ioService, name, contentCheck, hashValidation)
{ {
......
using System.ComponentModel; using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq; using System.Linq;
using System.Xml; using System.Xml;
using HashingTool.Helper; using HashingTool.Helper;
...@@ -21,35 +22,57 @@ namespace HashingTool.ViewModel ...@@ -21,35 +22,57 @@ namespace HashingTool.ViewModel
} }
} }
protected bool? IsManufacturerReport(XmlDocument x) protected bool? IsManufacturerReport(XmlDocument x, Collection<string> errorLog)
{ {
if (x == null || x.DocumentElement == null) if (x == null || x.DocumentElement == null) {
return null; return null;
return x.DocumentElement.LocalName == XMLNames.VectoManufacturerReport; }
var valid = x.DocumentElement.LocalName == XMLNames.VectoManufacturerReport;
if (!valid) {
errorLog.Add(string.Format("Invalid XML file given ({0}). Expected Manufacturer Report XML ({1})!",
x.DocumentElement.LocalName, XMLNames.VectoManufacturerReport));
}
return valid;
} }
protected bool? IsCustomerReport(XmlDocument x) protected bool? IsCustomerReport(XmlDocument x, Collection<string> errorLog)
{ {
if (x == null || x.DocumentElement == null) if (x == null || x.DocumentElement == null) {
return null; return null;
return x.DocumentElement != null && x.DocumentElement.LocalName == XMLNames.VectoCustomerReport; }
var valid = x.DocumentElement != null && x.DocumentElement.LocalName == XMLNames.VectoCustomerReport;
if (!valid) {
errorLog.Add(string.Format("Invalid XML file given ({0}). Expected Customer Report XML ({1})!",
x.DocumentElement.LocalName, XMLNames.VectoCustomerReport));
}
return valid;
} }
protected static bool? IsJobFile(XmlDocument x) protected static bool? IsJobFile(XmlDocument x, Collection<string> errorLog)
{ {
if (x == null) if (x == null || x.DocumentElement == null) {
return null; return null;
return x.DocumentElement != null && x.DocumentElement.LocalName == XMLNames.VectoInputDeclaration && }
var valid = x.DocumentElement.LocalName == XMLNames.VectoInputDeclaration &&
x.DocumentElement.FirstChild.LocalName == XMLNames.Component_Vehicle; x.DocumentElement.FirstChild.LocalName == XMLNames.Component_Vehicle;
if (!valid) {
errorLog.Add(string.Format("Invalid XML file given ({0}/{1}). Expected Vehicle XML ({2}/{3})!",
x.DocumentElement.LocalName, x.DocumentElement.FirstChild.LocalName, XMLNames.VectoInputDeclaration,
XMLNames.Component_Vehicle));
}
return valid;
} }
protected static bool? IsComponentFile(XmlDocument x) protected static bool? IsComponentFile(XmlDocument x, Collection<string> errorLog)
{ {
if (x.DocumentElement == null) { if (x.DocumentElement == null) {
return null; return null;
} }
if (x.DocumentElement.LocalName != XMLNames.VectoInputDeclaration) { if (x.DocumentElement.LocalName != XMLNames.VectoInputDeclaration) {
errorLog.Add(string.Format("Invalid XML file given ({0}). Expected Component XML ({1})!",
x.DocumentElement.LocalName, XMLNames.VectoInputDeclaration));
return false; return false;
} }
...@@ -58,7 +81,12 @@ namespace HashingTool.ViewModel ...@@ -58,7 +81,12 @@ namespace HashingTool.ViewModel
VectoComponents.Engine, VectoComponents.Airdrag, VectoComponents.Angledrive, VectoComponents.Axlegear, VectoComponents.Engine, VectoComponents.Airdrag, VectoComponents.Angledrive, VectoComponents.Axlegear,
VectoComponents.Gearbox, VectoComponents.Retarder, VectoComponents.TorqueConverter, VectoComponents.Tyre VectoComponents.Gearbox, VectoComponents.Retarder, VectoComponents.TorqueConverter, VectoComponents.Tyre
}; };
return components.Where(c => c.XMLElementName() == localName).Any(); var valid = components.Where(c => c.XMLElementName() == localName).Any();
if (!valid) {
errorLog.Add(string.Format("Invalid XML file given ({0}). Expected Component XML ({1})!",
localName, string.Join(", ", components.Select(c => c.XMLElementName()))));
}
return valid;
} }
} }
} }
...@@ -5,7 +5,6 @@ using System.Threading.Tasks; ...@@ -5,7 +5,6 @@ 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;
...@@ -21,17 +20,16 @@ namespace HashingTool.ViewModel.UserControl ...@@ -21,17 +20,16 @@ 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 readonly Func<XmlDocument, Collection<string>, bool?> _postVerification;
private bool? _contentValid; private bool? _contentValid;
private bool _hasContentValidation;
public XMLFile(IOService ioservice, bool validate = false, Func<XmlDocument, bool?> contentCheck = null) public XMLFile(IOService ioservice, bool validate = false, Func<XmlDocument, Collection<string>, bool?> contentCheck = null)
{ {
IoService = ioservice; IoService = ioservice;
_validate = validate; _validate = validate;
XMLValidationErrors = new ObservableCollection<string>(); XMLValidationErrors = new ObservableCollection<string>();
HasContentValidation = contentCheck != null; HasContentValidation = contentCheck != null;
_postVerification = contentCheck ?? (x => null); _postVerification = contentCheck ?? ((x,c) => null);
Source = ""; Source = "";
RaisePropertyChanged("ValidateInput"); RaisePropertyChanged("ValidateInput");
RaisePropertyChanged("HasContentValidation"); RaisePropertyChanged("HasContentValidation");
...@@ -88,7 +86,7 @@ namespace HashingTool.ViewModel.UserControl ...@@ -88,7 +86,7 @@ namespace HashingTool.ViewModel.UserControl
public ICommand SetXMLFileCommnd 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) private async void SetXMLFile(string fileName)
...@@ -138,7 +136,7 @@ namespace HashingTool.ViewModel.UserControl ...@@ -138,7 +136,7 @@ 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); ContentValid = _postVerification(document, XMLValidationErrors);
Document = document; Document = document;
_busy = false; _busy = false;
} }
......
...@@ -33,7 +33,7 @@ namespace HashingTool.ViewModel ...@@ -33,7 +33,7 @@ namespace HashingTool.ViewModel
public string Name public string Name
{ {
get { return "Verify Input Data"; } get { return "Verify Component Data"; }
} }
public ICommand ShowHomeViewCommand public ICommand ShowHomeViewCommand
......
...@@ -31,7 +31,7 @@ namespace HashingTool.ViewModel ...@@ -31,7 +31,7 @@ namespace HashingTool.ViewModel
public string Name public string Name
{ {
get { return "Verify Job"; } get { return "Verify VECTO Job"; }
} }
public ICommand ShowHomeViewCommand public ICommand ShowHomeViewCommand
......
using System; using System;
using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.ComponentModel; using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Windows;
using System.Windows.Input; using System.Windows.Input;
using System.Xml; using System.Xml;
using System.Xml.Linq;
using HashingTool.ViewModel.UserControl;
using TUGraz.VectoCommon.Resources;
using TUGraz.VectoHashing; using TUGraz.VectoHashing;
namespace HashingTool.ViewModel namespace HashingTool.ViewModel
{ {
public class VerifyResultDataViewModel : ObservableObject, IMainView public class VerifyResultDataViewModel : ObservableObject, IMainView
{ {
private ApplicationViewModel _applicationViewModel; private readonly VectoXMLFile _jobFile;
private VectoXMLFile _jobFile; private readonly ReportXMLFile _customerReport;
private ReportXMLFile _customerReport; private readonly ReportXMLFile _manufacturerReport;
private ReportXMLFile _manufacturerReport;
public const string ToolTip_InvalidFileType = "Invalid File type!"; public const string ToolTipInvalidFileType = "Invalid File type!";
public const string ToolTip_XMLValidationFailed = "XML validation failed!"; public const string ToolTipXMLValidationFailed = "XML validation failed!";
public const string ToolTip_OK = "Correct file selected"; public const string ToolTipOk = "Correct file selected";
public const string ToolTip_HashInvalid = "Incorrect digest value!"; public const string ToolTipHashInvalid = "Incorrect digest value!";
public const string ToolTip_None = ""; public const string ToolTipNone = "";
public VerifyResultDataViewModel() public VerifyResultDataViewModel()
...@@ -35,7 +27,6 @@ namespace HashingTool.ViewModel ...@@ -35,7 +27,6 @@ namespace HashingTool.ViewModel
_customerReport = new ReportXMLFile(IoService, "Customer Report", IsCustomerReport, ValidateDocumentHash); _customerReport = new ReportXMLFile(IoService, "Customer Report", IsCustomerReport, ValidateDocumentHash);
Files = new ObservableCollection<VectoXMLFile> { _jobFile, _manufacturerReport, _customerReport }; Files = new ObservableCollection<VectoXMLFile> { _jobFile, _manufacturerReport, _customerReport };
CanonicalizationMethods = new ObservableCollection<string>() { "urn:vecto:xml:2017:canonicalization" };
RaisePropertyChanged("CanonicalizationMethods"); RaisePropertyChanged("CanonicalizationMethods");
_customerReport.PropertyChanged += Update; _customerReport.PropertyChanged += Update;
_manufacturerReport.PropertyChanged += Update; _manufacturerReport.PropertyChanged += Update;
...@@ -48,8 +39,6 @@ namespace HashingTool.ViewModel ...@@ -48,8 +39,6 @@ namespace HashingTool.ViewModel
} }
public ObservableCollection<string> CanonicalizationMethods { get; private set; }
public string Name public string Name
{ {
get { return "Verify Result Data"; } get { return "Verify Result Data"; }
...@@ -100,6 +89,7 @@ namespace HashingTool.ViewModel ...@@ -100,6 +89,7 @@ namespace HashingTool.ViewModel
var h = VectoHash.Load(xml); var h = VectoHash.Load(xml);
xmlViewModel.DigestValueComputed = h.ComputeHash(); xmlViewModel.DigestValueComputed = h.ComputeHash();
} catch (Exception e) { } catch (Exception e) {
xmlViewModel.XMLFile.XMLValidationErrors.Add(e.Message);
xmlViewModel.DigestValueComputed = ""; xmlViewModel.DigestValueComputed = "";
} }
} }
...@@ -122,8 +112,11 @@ namespace HashingTool.ViewModel ...@@ -122,8 +112,11 @@ namespace HashingTool.ViewModel
} catch { } catch {
report.DigestValueComputed = ""; report.DigestValueComputed = "";
} }
report.Valid = h.ValidateHash(); var valid = h.ValidateHash();
report.ValidTooltip = valid ? ToolTipOk : ToolTipHashInvalid;
report.Valid = valid;
} catch (Exception e) { } catch (Exception e) {
report.XMLFile.XMLValidationErrors.Add(e.Message);
report.Valid = false; report.Valid = false;
} }
} }
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
mc:Ignorable="d" mc:Ignorable="d"
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"
d:DataContext="{d:DesignInstance views:XMLValidationErrorsDialog}"> d:DataContext="{d:DesignInstance views:XMLValidationErrorsDialog}" Icon="/HashingTool;component/Resources/HashingIcon.ico">
<Grid> <Grid>
<ListBox x:Name="lbErrors" Margin="10,10,10,62" ItemsSource="{Binding XMLErrors}" /> <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" <Button IsCancel="True" x:Name="btnClose" Content="Close" Margin="0,0,10,10" Height="22" VerticalAlignment="Bottom"
......
...@@ -16,16 +16,9 @@ ...@@ -16,16 +16,9 @@
<ViewModel:HashComponentDataViewModel /> <ViewModel:HashComponentDataViewModel />
</UserControl.DataContext> </UserControl.DataContext>
<DockPanel> <DockPanel>
<Label DockPanel.Dock="Top" Name="lblHeader" HorizontalAlignment="Center" Margin="10,10,0,0" VerticalAlignment="Top" <Label DockPanel.Dock="Top" Name="lblHeader" HorizontalAlignment="Center" Margin="0" VerticalAlignment="Top"
Content="{Binding Name}" FontWeight="Bold" FontSize="18" /> Content="{Binding Name}" FontWeight="Bold" FontSize="18" />
<StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,10,0,0">
<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" <Button Content="Save Component Data" HorizontalAlignment="Right" Margin="0,0,15,10" Width="143" Height="22"
VerticalAlignment="Bottom" Command="{Binding SaveHashedDocument, Mode=OneWay}" /> VerticalAlignment="Bottom" Command="{Binding SaveHashedDocument, Mode=OneWay}" />
<Button Name="btnBack" Content="Back" Command="{Binding ShowHomeViewCommand}" Margin="0,0,10,10" <Button Name="btnBack" Content="Back" Command="{Binding ShowHomeViewCommand}" Margin="0,0,10,10"
...@@ -33,6 +26,15 @@ ...@@ -33,6 +26,15 @@
Width="75" Height="22" VerticalAlignment="Bottom" /> Width="75" Height="22" VerticalAlignment="Bottom" />
</StackPanel> </StackPanel>
<DockPanel DockPanel.Dock="Bottom">
<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}" />
<Grid DockPanel.Dock="Top" Margin="10,0,1,0"> <Grid DockPanel.Dock="Top" Margin="10,0,1,0">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
...@@ -122,6 +124,6 @@ ...@@ -122,6 +124,6 @@
</ContentControl> </ContentControl>
</Grid> </Grid>
</DockPanel>
</DockPanel> </DockPanel>
</UserControl> </UserControl>
\ No newline at end of file
...@@ -5,26 +5,36 @@ ...@@ -5,26 +5,36 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:viewModel="clr-namespace:HashingTool.ViewModel" x:Class="HashingTool.Views.HomeView" xmlns:viewModel="clr-namespace:HashingTool.ViewModel" x:Class="HashingTool.Views.HomeView"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300"> d:DesignHeight="382" d:DesignWidth="532">
<Grid x:Name="MainGrid"> <Grid x:Name="MainGrid" Margin="0,0,0,0">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" MinWidth="30" /> <ColumnDefinition Width="Auto" MinWidth="30" />
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.DataContext> <Grid.DataContext>
<viewModel:HomeViewModel /> <viewModel:HomeViewModel />
</Grid.DataContext> </Grid.DataContext>
<ItemsControl x:Name="ViewSelectionPanel" <ItemsControl x:Name="ViewSelectionPanel"
ItemsSource="{Binding MainViewModels}" ItemsSource="{Binding MainViewModels}"
Grid.Column="1"> Grid.Row="1" Grid.Column="1">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid Rows="2" Columns="2" Height="300" Width="500"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate> <ItemsControl.ItemTemplate>
<DataTemplate> <DataTemplate>
<Grid Margin="0,30,0,5"> <Grid Margin="0">
<Button Content="{Binding Name}" Margin="2,5" Padding="15,10" <Button Content="{Binding Name}" Margin="10" Padding="15,10"
Command="{Binding DataContext.ChangeViewCommand, RelativeSource={RelativeSource AncestorType={x:Type Window}}}" Command="{Binding DataContext.ChangeViewCommand, RelativeSource={RelativeSource AncestorType={x:Type Window}}}"
CommandParameter="{Binding ''}" /> CommandParameter="{Binding ''}" FontWeight="bold" FontSize="18" />
</Grid> </Grid>
</DataTemplate> </DataTemplate>
</ItemsControl.ItemTemplate> </ItemsControl.ItemTemplate>
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
xmlns:helper="clr-namespace:HashingTool.Helper" xmlns:helper="clr-namespace:HashingTool.Helper"
x:Class="HashingTool.Views.VerifyComponentInputData" x:Class="HashingTool.Views.VerifyComponentInputData"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="422" d:DesignWidth="534"> d:DesignHeight="380" d:DesignWidth="534">
<UserControl.Resources> <UserControl.Resources>
<helper:CollectionConverter x:Key="CollectionConverter" /> <helper:CollectionConverter x:Key="CollectionConverter" />
...@@ -18,12 +18,13 @@ ...@@ -18,12 +18,13 @@
</UserControl.DataContext> </UserControl.DataContext>
<DockPanel> <DockPanel>
<Label DockPanel.Dock="Top" Name="lblHeader" HorizontalAlignment="Center" Margin="10,10,0,0" VerticalAlignment="Top" <Label DockPanel.Dock="Top" Name="lblHeader" HorizontalAlignment="Center" Margin="0" VerticalAlignment="Top"
Content="{Binding Name}" FontWeight="Bold" FontSize="18" /> Content="{Binding Name}" FontWeight="Bold" FontSize="18" />
<Button DockPanel.Dock="Bottom" Name="btnBack" Content="Back" Command="{Binding ShowHomeViewCommand}" <Button DockPanel.Dock="Bottom" Name="btnBack" Content="Back" Command="{Binding ShowHomeViewCommand}"
Margin="0,0,10,10" Margin="0,10,10,5"
HorizontalAlignment="Right" HorizontalAlignment="Right"
Width="75" Height="22" VerticalAlignment="Bottom" /> Width="75" Height="22" VerticalAlignment="Bottom" />
<ScrollViewer VerticalScrollBarVisibility="Auto">
<DockPanel> <DockPanel>
<Label DockPanel.Dock="Top" x:Name="lblFileSelect" Content="Component data:" HorizontalAlignment="Left" <Label DockPanel.Dock="Top" x:Name="lblFileSelect" Content="Component data:" HorizontalAlignment="Left"
Margin="10,2,0,2" Margin="10,2,0,2"
...@@ -40,7 +41,7 @@ ...@@ -40,7 +41,7 @@
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="*" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Label Grid.Row="0" Grid.Column="0" Content="Component:" /> <Label Grid.Row="0" Grid.Column="0" Content="Component:" />
...@@ -82,7 +83,7 @@ ...@@ -82,7 +83,7 @@
</TextBox.Style> </TextBox.Style>
</TextBox> </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 Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="2" HorizontalAlignment="Center" Margin="0,20,0,0" VerticalAlignment="Top" Width="66" Height="30">
<ContentControl.LayoutTransform> <ContentControl.LayoutTransform>
<ScaleTransform ScaleX="1.5" ScaleY="1.5" /> <ScaleTransform ScaleX="1.5" ScaleY="1.5" />
</ContentControl.LayoutTransform> </ContentControl.LayoutTransform>
...@@ -107,5 +108,6 @@ ...@@ -107,5 +108,6 @@
</DockPanel> </DockPanel>
</ScrollViewer>
</DockPanel> </DockPanel>
</UserControl> </UserControl>
\ No newline at end of file
...@@ -15,14 +15,17 @@ ...@@ -15,14 +15,17 @@
<UserControl.DataContext> <UserControl.DataContext>
<viewModel:VerifyJobInputDataViewModel /> <viewModel:VerifyJobInputDataViewModel />
</UserControl.DataContext> </UserControl.DataContext>
<DockPanel> <DockPanel>
<Label DockPanel.Dock="Top" Name="lblHeader" HorizontalAlignment="Center" Margin="0,10" VerticalAlignment="Top" <Label DockPanel.Dock="Top" Name="lblHeader" HorizontalAlignment="Center" Margin="0" VerticalAlignment="Top"
Content="{Binding Name}" FontWeight="Bold" FontSize="18" /> Content="{Binding Name}" FontWeight="Bold" FontSize="18" />
<Button DockPanel.Dock="Bottom" Name="btnBack" Content="Back" Command="{Binding ShowHomeViewCommand}" <Button DockPanel.Dock="Bottom" Name="btnBack" Content="Back" Command="{Binding ShowHomeViewCommand}"
Margin="0,0,10,10" Margin="0,10,10,5"
HorizontalAlignment="Right" HorizontalAlignment="Right"
Width="75" Height="22" VerticalAlignment="Bottom" /> Width="75" Height="22" VerticalAlignment="Bottom" />
<ScrollViewer>
<DockPanel>
<Label x:Name="lblFileSelect" DockPanel.Dock="Top" Content="Job data:" HorizontalAlignment="Left" Margin="10,0,0,0" <Label x:Name="lblFileSelect" DockPanel.Dock="Top" Content="Job data:" HorizontalAlignment="Left" Margin="10,0,0,0"
VerticalAlignment="Top" /> VerticalAlignment="Top" />
<views:VectoXMLFileSelector Margin="0,0,0,0" DockPanel.Dock="Top" VerticalAlignment="Top" XMLFile="{Binding JobFile}" <views:VectoXMLFileSelector Margin="0,0,0,0" DockPanel.Dock="Top" VerticalAlignment="Top" XMLFile="{Binding JobFile}"
...@@ -75,7 +78,7 @@ ...@@ -75,7 +78,7 @@
<ScrollViewer Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" VerticalScrollBarVisibility="Auto" <ScrollViewer Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" VerticalScrollBarVisibility="Auto"
Background="{x:Static SystemColors.ControlLightBrush}" Background="{x:Static SystemColors.ControlLightBrush}"
Margin="10,0,10,10"> Margin="10,0,10,10">
<ItemsControl Margin="3" x:Name="ComponentListing" ItemsSource="{Binding Components}"> <ItemsControl Margin="3" x:Name="ComponentListing" ItemsSource="{Binding Components}" MinHeight="300">
<ItemsControl.ItemContainerStyle> <ItemsControl.ItemContainerStyle>
<Style> <Style>
<Setter Property="FrameworkElement.Margin" Value="0,2" /> <Setter Property="FrameworkElement.Margin" Value="0,2" />
...@@ -171,6 +174,7 @@ ...@@ -171,6 +174,7 @@
</ScrollViewer> </ScrollViewer>
</Grid> </Grid>
</DockPanel>
</ScrollViewer>
</DockPanel> </DockPanel>
</UserControl> </UserControl>
\ No newline at end of file
...@@ -190,7 +190,7 @@ ...@@ -190,7 +190,7 @@
Margin="0,0,10,10" Margin="0,0,10,10"
HorizontalAlignment="Right" HorizontalAlignment="Right"
Width="75" Height="22" VerticalAlignment="Bottom" /> Width="75" Height="22" VerticalAlignment="Bottom" />
<Label DockPanel.Dock="Top" x:Name="lblHeader" HorizontalAlignment="Center" Margin="10,10,0,0" <Label DockPanel.Dock="Top" x:Name="lblHeader" HorizontalAlignment="Center" Margin="0"
VerticalAlignment="Top" VerticalAlignment="Top"
Content="{Binding Name}" FontWeight="Bold" FontSize="18" /> Content="{Binding Name}" FontWeight="Bold" FontSize="18" />
<Grid Margin="0,0,0,0" HorizontalAlignment="Stretch"> <Grid Margin="0,0,0,0" HorizontalAlignment="Stretch">
......
...@@ -8,9 +8,6 @@ namespace HashingTool.Views ...@@ -8,9 +8,6 @@ namespace HashingTool.Views
/// Interaction logic for VerifyResults.xaml /// Interaction logic for VerifyResults.xaml
/// </summary> /// </summary>
/// ///
public partial class VerifyResults : UserControl public partial class VerifyResults : UserControl
{ {
public VerifyResults() public VerifyResults()
...@@ -21,17 +18,17 @@ namespace HashingTool.Views ...@@ -21,17 +18,17 @@ namespace HashingTool.Views
private void Button_Click(object sender, RoutedEventArgs e) private void Button_Click(object sender, RoutedEventArgs e)
{ {
var ui = sender as FrameworkElement; var ui = sender as FrameworkElement;
if (ui == null) if (ui == null) {
return; return;
var context = ui.DataContext as HashedXMLFile; }
if (context == null) var context = ui.DataContext as VectoXMLFile;
if (context == null) {
return; return;
}
var dialog = new XMLValidationErrorsDialog(); var dialog = new XMLValidationErrorsDialog();
dialog.XMLErrors = context.XMLFile.XMLValidationErrors; dialog.XMLErrors = context.XMLFile.XMLValidationErrors;
dialog.ShowDialog(); 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.
Please register or to comment