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

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

separate flags if customer report itself is valid, and customer report matches...

separate flags if customer report itself is valid, and customer report matches manufacturer report (for UI)
parent 7c050d6e
No related branches found
No related tags found
No related merge requests found
......@@ -14,6 +14,7 @@ namespace HashingTool.ViewModel.UserControl
private string _manufacturerReportDigestValueRead;
private bool _manufacturerReportMatchesReport;
private string _manufacturerReportDigestValueComputed;
private bool _manufacturerReportDigestValid;
public CustomerReportXMLFile(string name, Func<XmlDocument, IErrorLogger, bool?> contentCheck,
Action<XmlDocument, VectoXMLFile> hashValidation = null) : base(name, contentCheck, hashValidation)
......@@ -98,6 +99,18 @@ namespace HashingTool.ViewModel.UserControl
RaisePropertyChanged("ManufacturerReportDigestValueComputed");
}
}
public bool ManufacturerReportDigestValid
{
get { return _manufacturerReportDigestValid; }
set {
if (_manufacturerReportDigestValid == value) {
return;
}
_manufacturerReportDigestValid = value;
RaisePropertyChanged("ManufacturerReportDigestValid");
}
}
protected virtual void ManufacturerReportChanged(object sender, PropertyChangedEventArgs e)
{
......@@ -108,8 +121,8 @@ namespace HashingTool.ViewModel.UserControl
protected override void ReportChanged(object sender, PropertyChangedEventArgs e)
{
base.ReportChanged(sender, e);
if (sender == _xmlFile && e.PropertyName == GeneralUpdate) {
ReadReportData();
VerifyManufacturerReport();
}
}
......@@ -155,7 +168,10 @@ namespace HashingTool.ViewModel.UserControl
ManufacturerReportDigestValueRead = manufacturerReportDigestValueRead;
ManufacturerReportDigestValueComputed = manufacturerReportDigestValueComputed;
ManufacturerReportMatchesReport = digestMatch;
ManufacturerReportMatchesReport = FileIntegrityValid != null && FileIntegrityValid.Value && digestMatch;
ManufacturerReportDigestValid = digestMatch;
}
}
}
\ No newline at end of file
......@@ -152,7 +152,7 @@ namespace HashingTool.ViewModel.UserControl
}
}
ManufacturerReportValid = JobDigestMatchesReport && hasComponentsFromJob && !certificationNumberMismatch.Any() && !digestMismatch.Any();
ManufacturerReportValid = FileIntegrityValid != null && FileIntegrityValid.Value && hasComponentsFromJob && !certificationNumberMismatch.Any() && !digestMismatch.Any();
}
public bool ManufacturerReportValid
......
......@@ -321,7 +321,7 @@
<Style TargetType="TextBox" BasedOn="{StaticResource DigestValueTextboxStyle}">
<Setter Property="Foreground" Value="{StaticResource Color.ErrorRed}" />
<Style.Triggers>
<DataTrigger Binding="{Binding ManufacturerReportMatchesReport}" Value="True">
<DataTrigger Binding="{Binding ManufacturerReportDigestValid}" Value="True">
<Setter Property="Foreground" Value="{StaticResource Color.SuccessGreen}" />
</DataTrigger>
</Style.Triggers>
......@@ -337,7 +337,7 @@
<Style TargetType="TextBox" BasedOn="{StaticResource DigestValueTextboxStyle}">
<Setter Property="Foreground" Value="{StaticResource Color.ErrorRed}" />
<Style.Triggers>
<DataTrigger Binding="{Binding ManufacturerReportMatchesReport}" Value="True">
<DataTrigger Binding="{Binding ManufacturerReportDigestValid}" Value="True">
<Setter Property="Foreground" Value="{StaticResource Color.SuccessGreen}" />
</DataTrigger>
</Style.Triggers>
......
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