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

Skip to content
Snippets Groups Projects
Commit de64d370 authored by Harald MARTINI's avatar Harald MARTINI
Browse files

Fixed an issue with non nullable enums

Added remove airdragdata button

fixed some formatting issues when writing an XML file

Added a new Error Template

Added Validation for mandatory fields in VehicleViewModel
parent 78174212
No related branches found
No related tags found
No related merge requests found
Showing
with 296 additions and 20 deletions
...@@ -13,7 +13,9 @@ ...@@ -13,7 +13,9 @@
<ResourceDictionary Source="Resources/Styles/Colors.xaml"/> <ResourceDictionary Source="Resources/Styles/Colors.xaml"/>
<ResourceDictionary Source="Resources/Styles/ButtonStyles.xaml"/> <ResourceDictionary Source="Resources/Styles/ButtonStyles.xaml"/>
<ResourceDictionary Source="DataGridStyles.xaml"/> <ResourceDictionary Source="DataGridStyles.xaml"/>
<ResourceDictionary Source="Resources/ObjectProvider.xaml"></ResourceDictionary> <ResourceDictionary Source="Resources/Templates/ErrorTemplates.xaml"/>
<ResourceDictionary Source="Resources/ObjectProvider.xaml"/>
<ResourceDictionary Source="Resources/Icons/drawables.xaml"></ResourceDictionary>
</ResourceDictionary.MergedDictionaries> </ResourceDictionary.MergedDictionaries>
</ResourceDictionary> </ResourceDictionary>
</Application.Resources> </Application.Resources>
......
...@@ -13,10 +13,9 @@ namespace VECTO3GUI2020.Helper.Converter ...@@ -13,10 +13,9 @@ namespace VECTO3GUI2020.Helper.Converter
{ {
return Visibility.Collapsed; return Visibility.Collapsed;
} }
else else {
{ return Visibility.Visible;
return Binding.DoNothing; }
}
} }
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
......
...@@ -27,7 +27,7 @@ namespace VECTO3GUI2020.Helper.Converter ...@@ -27,7 +27,7 @@ namespace VECTO3GUI2020.Helper.Converter
return convertedSI.Units; return convertedSI.Units;
} }
return Binding.DoNothing;
//TRY GET DYNAMIC UNIT STRING //TRY GET DYNAMIC UNIT STRING
try { try {
......
...@@ -17,8 +17,6 @@ namespace VECTO3GUI2020.Helper.Converter ...@@ -17,8 +17,6 @@ namespace VECTO3GUI2020.Helper.Converter
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{ {
if (value == null) { if (value == null) {
_si = null;
_convertedSI = null;
return value; return value;
} }
if(value is SI SIvalue) { if(value is SI SIvalue) {
...@@ -53,8 +51,7 @@ namespace VECTO3GUI2020.Helper.Converter ...@@ -53,8 +51,7 @@ namespace VECTO3GUI2020.Helper.Converter
} }
} }
catch (Exception e) catch (Exception e) {
{
return value; return value;
} }
......
using System;
namespace VECTO3GUI2020.Helper
{
/// <summary>
/// Exception to notify the view that a field is not allowed to be empty. Should be ignored by the debugger
/// </summary>
public class VectoEmptyFieldException : Exception
{
public VectoEmptyFieldException()
: base("Field must not be empty")
{
}
public VectoEmptyFieldException(string message)
: base(message)
{
}
public VectoEmptyFieldException(string message, Exception inner)
: base(message, inner)
{
}
}
}
\ No newline at end of file
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using System.Windows.Forms;
using System.Xml; using System.Xml;
using System.Xml.Linq; using System.Xml.Linq;
using System.Xml.Schema; using System.Xml.Schema;
...@@ -96,5 +97,11 @@ namespace VECTO3GUI2020.Helper ...@@ -96,5 +97,11 @@ namespace VECTO3GUI2020.Helper
return version; return version;
} }
public static string ToXmlFormat(this DateTime dateTime)
{
return XmlConvert.ToString(dateTime, XmlDateTimeSerializationMode.Utc);
}
} }
} }
\ No newline at end of file
using System; using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Xml; using System.Xml;
using System.Xml.Linq; using System.Xml.Linq;
using System.Xml.Schema; using System.Xml.Schema;
using Castle.Core.Internal; using Castle.Core.Internal;
using TUGraz.VectoCommon.Exceptions; using TUGraz.VectoCommon.Exceptions;
using TUGraz.VectoCommon.Resources;
using TUGraz.VectoCore.Utils; using TUGraz.VectoCore.Utils;
using VECTO3GUI2020.Util.XML;
using XmlDocumentType = TUGraz.VectoCore.Utils.XmlDocumentType;
namespace VECTO3GUI2020.Helper namespace VECTO3GUI2020.Helper
{ {
...@@ -56,5 +62,51 @@ namespace VECTO3GUI2020.Helper ...@@ -56,5 +62,51 @@ namespace VECTO3GUI2020.Helper
return Uri.UnescapeDataString(new Uri(baseUri).AbsolutePath); return Uri.UnescapeDataString(new Uri(baseUri).AbsolutePath);
} }
public static XDocument CreateWrapperDocument(this XElement xElement, XNamespace defaultNamespace,
XmlDocumentType docType = XmlDocumentType.DeclarationJobData)
{
var prefixMap = new Dictionary<string, XNamespace>();
var xDocument = new XDocument();
var rootElement = new XElement(XMLNamespaces.Tns_v20 + XMLNames.VectoInputDeclaration, new XAttribute(XNamespace.Xmlns + "tns",
XMLNamespaces.Tns_v20));
Debug.WriteLine(rootElement.ToString());
rootElement.Add(new XAttribute("xmlns", defaultNamespace));
rootElement.Add(new XAttribute("schemaVersion", XMLHelper.GetVersionFromNamespaceUri(defaultNamespace)));
xDocument.Add(rootElement);
Dictionary<string, XNamespace> nsAttributes = new Dictionary<string, XNamespace> {
["xsi"] = XMLNamespaces.Xsi
};
foreach (var element in xElement.DescendantsAndSelf()) {
var ns = element.Name.Namespace;
if (ns != defaultNamespace) {
var prefix = XMLNamespaces.GetPrefix(ns);
if(prefix != null)
nsAttributes[prefix] = ns;
}
}
foreach (var nsAttribute in nsAttributes) {
rootElement.Add(new XAttribute(XNamespace.Xmlns + nsAttribute.Key, nsAttribute.Value));
}
var LocalSchemaLocation = @"V:\VectoCore\VectoCore\Resources\XSD\";
rootElement.Add(new XAttribute(XMLNamespaces.Xsi + "schemaLocation",
$"{XMLNamespaces.DeclarationRootNamespace} {LocalSchemaLocation}VectoDeclarationJob.xsd"));
rootElement.Add(xElement);
return xDocument;
}
} }
} }
using System; using System;
using System.Windows.Forms;
using TUGraz.VectoCore.InputData.FileIO.XML; using TUGraz.VectoCore.InputData.FileIO.XML;
using TUGraz.VectoCore.InputData.FileIO.XML.Declaration.Factory; using TUGraz.VectoCore.InputData.FileIO.XML.Declaration.Factory;
using TUGraz.VectoCore.Utils; using TUGraz.VectoCore.Utils;
using VECTO3GUI2020.Helper; using VECTO3GUI2020.Helper;
using VECTO3GUI2020.Util.XML.Interfaces;
using VECTO3GUI2020.ViewModel.Interfaces.JobEdit.Vehicle.Components; using VECTO3GUI2020.ViewModel.Interfaces.JobEdit.Vehicle.Components;
namespace VECTO3GUI2020.Ninject namespace VECTO3GUI2020.Ninject
...@@ -16,5 +18,7 @@ namespace VECTO3GUI2020.Ninject ...@@ -16,5 +18,7 @@ namespace VECTO3GUI2020.Ninject
IXMLInputDataReader InputDataReader { get; } IXMLInputDataReader InputDataReader { get; }
IDeclarationInjectFactory InjectFactory { get; } IDeclarationInjectFactory InjectFactory { get; }
IComponentViewModelFactory ComponentViewModelFactory { get; } IComponentViewModelFactory ComponentViewModelFactory { get; }
IXMLWriterFactory XMLWriterFactory { get; }
} }
} }
\ No newline at end of file
...@@ -3,6 +3,7 @@ using TUGraz.VectoCore.InputData.FileIO.XML; ...@@ -3,6 +3,7 @@ using TUGraz.VectoCore.InputData.FileIO.XML;
using TUGraz.VectoCore.InputData.FileIO.XML.Declaration.Factory; using TUGraz.VectoCore.InputData.FileIO.XML.Declaration.Factory;
using TUGraz.VectoCore.Utils; using TUGraz.VectoCore.Utils;
using VECTO3GUI2020.Helper; using VECTO3GUI2020.Helper;
using VECTO3GUI2020.Util.XML.Interfaces;
using VECTO3GUI2020.ViewModel.Interfaces.JobEdit.Vehicle.Components; using VECTO3GUI2020.ViewModel.Interfaces.JobEdit.Vehicle.Components;
namespace VECTO3GUI2020.Ninject namespace VECTO3GUI2020.Ninject
...@@ -26,16 +27,26 @@ namespace VECTO3GUI2020.Ninject ...@@ -26,16 +27,26 @@ namespace VECTO3GUI2020.Ninject
public IDeclarationInjectFactory InjectFactory => _injectFactory.Value; public IDeclarationInjectFactory InjectFactory => _injectFactory.Value;
public IComponentViewModelFactory ComponentViewModelFactory => _componentViewModelFactory.Value; public IComponentViewModelFactory ComponentViewModelFactory => _componentViewModelFactory.Value;
public IXMLWriterFactory XMLWriterFactory => _xmlWriterFactory.Value;
private Lazy<IXMLWriterFactory> _xmlWriterFactory;
private readonly Lazy<IDeclarationInjectFactory> _injectFactory; private readonly Lazy<IDeclarationInjectFactory> _injectFactory;
private readonly Lazy<IComponentViewModelFactory> _componentViewModelFactory; private readonly Lazy<IComponentViewModelFactory> _componentViewModelFactory;
public MultistageLazyDependencies(Lazy<IDialogHelper> dialogHelper, Lazy<IXMLInputDataReader> inputDataReader, Lazy<IDeclarationInjectFactory> injectFactory, Lazy<IComponentViewModelFactory> componentViewModelFactory) public MultistageLazyDependencies(
Lazy<IDialogHelper> dialogHelper,
Lazy<IXMLInputDataReader> inputDataReader,
Lazy<IDeclarationInjectFactory> injectFactory,
Lazy<IComponentViewModelFactory> componentViewModelFactory,
Lazy<IXMLWriterFactory> xmlWriterFactory)
{ {
_dialogHelper = dialogHelper; _dialogHelper = dialogHelper;
_inputDataReader = inputDataReader; _inputDataReader = inputDataReader;
_componentViewModelFactory = componentViewModelFactory; _componentViewModelFactory = componentViewModelFactory;
_injectFactory = injectFactory; _injectFactory = injectFactory;
_xmlWriterFactory = xmlWriterFactory;
} }
} }
} }
\ No newline at end of file
...@@ -44,6 +44,11 @@ namespace VECTO3GUI2020.Ninject ...@@ -44,6 +44,11 @@ namespace VECTO3GUI2020.Ninject
sv => sv =>
Bind<IXMLVehicleWriter>().To<XMLVehicleWriter_v2_0>().Named(sv)); Bind<IXMLVehicleWriter>().To<XMLVehicleWriter_v2_0>().Named(sv));
Array.ForEach(
XMLVehicleWriter_v2_8.SUPPORTEDVERSIONS,
sv =>
Bind<IXMLVehicleWriter>().To<XMLVehicleWriter_v2_8>().Named(sv));
Array.ForEach( Array.ForEach(
XMLComponentsWriter_v1_0.SUPPORTED_VERSIONS, XMLComponentsWriter_v1_0.SUPPORTED_VERSIONS,
sv => Bind<IXMLComponentsWriter>().To<XMLComponentsWriter_v1_0>().Named(sv)); sv => Bind<IXMLComponentsWriter>().To<XMLComponentsWriter_v1_0>().Named(sv));
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
xmlns:converter="clr-namespace:VECTO3GUI2020.Helper.Converter"> xmlns:converter="clr-namespace:VECTO3GUI2020.Helper.Converter">
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" /> <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
<converter:SIToUnitString x:Key="SIToUnitStringConverter"/> <converter:SIToUnitString x:Shared="False" x:Key="SIToUnitStringConverter"/>
<converter:SIValueToStringConverter x:Key="SIValueToStringConverter"/> <converter:SIValueToStringConverter x:Shared="False" x:Key="SIValueToStringConverter"/>
<converter:NullToVisibilityConverter x:Key="NullToVisibilityConverter"/> <converter:NullToVisibilityConverter x:Key="NullToVisibilityConverter"/>
<converter:AlwaysVisibleConverter x:Key="AlwaysVisibleConverter"/> <converter:AlwaysVisibleConverter x:Key="AlwaysVisibleConverter"/>
<converter:LabledTextBoxConverter x:Key="LabledTextBoxConverter" x:Shared="false" /> <converter:LabledTextBoxConverter x:Key="LabledTextBoxConverter" x:Shared="false" />
......
<!-- This file was generated by the AiToXaml tool.-->
<!-- Tool Version: 14.0.22307.0 -->
<Viewbox Width="16" Height="16" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<Rectangle Width="16" Height="16">
<Rectangle.Fill>
<DrawingBrush>
<DrawingBrush.Drawing>
<DrawingGroup>
<DrawingGroup.Children>
<GeometryDrawing Brush="#00FFFFFF" Geometry="F1M16,16L0,16 0,0 16,0z" />
<GeometryDrawing Brush="#FFF6F6F6" Geometry="F1M1.9998,-0.000199999999999534L1.9998,2.0188 0.9998,2.0188 0.9998,5.9998 1.9998,5.9998 1.9998,15.9998 15.0008,15.9998 15.0008,4.3788 10.6208,-0.000199999999999534z" />
<GeometryDrawing Brush="#FF424242" Geometry="F1M10,5L10,2.207 12.793,5z M10.207,1L7,1 7,2 9,2 9,2.018 9,6 13,6 13,14 4,14 4,8 3.019,8 3,15 14,15 14,4.793z" />
<GeometryDrawing Brush="#FF424242" Geometry="F1M10,5L10,2.207 12.793,5z M10.207,1L7,1 7,2 9,2 9,2.018 9,6 13,6 13,14 4,14 4,8 3.019,8 3,15 14,15 14,4.793z" />
<GeometryDrawing Brush="#FFF0EFF1" Geometry="F1M7,2.018L9,2.018 9,1.999 7,1.999z" />
<GeometryDrawing Brush="#FFF0EFF1" Geometry="F1M10,2.207L10,5 12.793,5z" />
<GeometryDrawing Brush="#FFF0EFF1" Geometry="F1M9,6L7,6 7,8 4,8 4,14 13,14 13,6z" />
<GeometryDrawing Brush="#FFEFEFF0" Geometry="F1M7,2.018L9,2.018 9,1.999 7,1.999z" />
<GeometryDrawing Brush="#FFEFEFF0" Geometry="F1M10,2.207L10,5 12.793,5z" />
<GeometryDrawing Brush="#FFEFEFF0" Geometry="F1M9,6L7,6 7,8 4,8 4,14 13,14 13,6z" />
<GeometryDrawing Brush="#FF388A34" Geometry="F1M8,3.0181L6,3.0181 6,1.0001 4.019,1.0001 4.019,3.0181 2,3.0181 2,5.0001 4.019,5.0001 4.019,7.0001 6,7.0001 6,5.0001 8,5.0001z" />
</DrawingGroup.Children>
</DrawingGroup>
</DrawingBrush.Drawing>
</DrawingBrush>
</Rectangle.Fill>
</Rectangle>
</Viewbox>
\ No newline at end of file
VECTO3GUI2020/Resources/Icons/Trash_16x.ico

10.2 KiB

<!-- This file was generated by the AiToXaml tool.-->
<!-- Tool Version: 14.0.22307.0 -->
<Viewbox Width="16" Height="16" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<Rectangle Width="16" Height="16">
<Rectangle.Fill>
<DrawingBrush>
<DrawingBrush.Drawing>
<DrawingGroup>
<DrawingGroup.Children>
<GeometryDrawing Brush="#00FFFFFF" Geometry="F1M16,16L0,16 0,0 16,0z" />
<GeometryDrawing Brush="#FFF6F6F6" Geometry="F1M4,16C2.897,16,2,15.103,2,14L2,5 1,5 1,2 4,2C4,0.897,4.897,0,6,0L9,0C10.103,0,11,0.897,11,2L14,2 14,5 13,5 13,14C13,15.103,12.103,16,11,16z" />
<GeometryDrawing Brush="#FFEFEFF0" Geometry="F1M10,12L9,12 9,6 10,6z M8,12L7,12 7,6 8,6z M6,12L5,12 5,6 6,6z M4,14L11,14 11,4 4,4z" />
<GeometryDrawing Brush="#FF424242" Geometry="F1M11,4L4,4 4,14 11,14z M6,3L9,3 9,2 6,2z M13,3L13,4 12,4 12,14C12,14.552,11.552,15,11,15L4,15C3.448,15,3,14.552,3,14L3,4 2,4 2,3 5,3 5,2C5,1.448,5.448,1,6,1L9,1C9.552,1,10,1.448,10,2L10,3z M10,6L9,6 9,12 10,12z M8,6L7,6 7,12 8,12z M6,12L5,12 5,6 6,6z" />
</DrawingGroup.Children>
</DrawingGroup>
</DrawingBrush.Drawing>
</DrawingBrush>
</Rectangle.Fill>
</Rectangle>
</Viewbox>
\ No newline at end of file
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<DataTemplate x:Key="TrashIcon">
<Viewbox Stretch="Uniform" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<Rectangle Width="16" Height="16">
<Rectangle.Fill>
<DrawingBrush>
<DrawingBrush.Drawing>
<DrawingGroup>
<DrawingGroup.Children>
<GeometryDrawing Brush="#00FFFFFF" Geometry="F1M16,16L0,16 0,0 16,0z" />
<GeometryDrawing Brush="#FFF6F6F6" Geometry="F1M4,16C2.897,16,2,15.103,2,14L2,5 1,5 1,2 4,2C4,0.897,4.897,0,6,0L9,0C10.103,0,11,0.897,11,2L14,2 14,5 13,5 13,14C13,15.103,12.103,16,11,16z" />
<GeometryDrawing Brush="#FFEFEFF0" Geometry="F1M10,12L9,12 9,6 10,6z M8,12L7,12 7,6 8,6z M6,12L5,12 5,6 6,6z M4,14L11,14 11,4 4,4z" />
<GeometryDrawing Brush="#FF424242" Geometry="F1M11,4L4,4 4,14 11,14z M6,3L9,3 9,2 6,2z M13,3L13,4 12,4 12,14C12,14.552,11.552,15,11,15L4,15C3.448,15,3,14.552,3,14L3,4 2,4 2,3 5,3 5,2C5,1.448,5.448,1,6,1L9,1C9.552,1,10,1.448,10,2L10,3z M10,6L9,6 9,12 10,12z M8,6L7,6 7,12 8,12z M6,12L5,12 5,6 6,6z" />
</DrawingGroup.Children>
</DrawingGroup>
</DrawingBrush.Drawing>
</DrawingBrush>
</Rectangle.Fill>
</Rectangle>
</Viewbox>
</DataTemplate>
<DataTemplate x:Key="AddDocumentIcon">
<Viewbox Stretch="Uniform" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<Rectangle Width="16" Height="16">
<Rectangle.Fill>
<DrawingBrush>
<DrawingBrush.Drawing>
<DrawingGroup>
<DrawingGroup.Children>
<GeometryDrawing Brush="#00FFFFFF" Geometry="F1M16,16L0,16 0,0 16,0z" />
<GeometryDrawing Brush="#FFF6F6F6" Geometry="F1M1.9998,-0.000199999999999534L1.9998,2.0188 0.9998,2.0188 0.9998,5.9998 1.9998,5.9998 1.9998,15.9998 15.0008,15.9998 15.0008,4.3788 10.6208,-0.000199999999999534z" />
<GeometryDrawing Brush="#FF424242" Geometry="F1M10,5L10,2.207 12.793,5z M10.207,1L7,1 7,2 9,2 9,2.018 9,6 13,6 13,14 4,14 4,8 3.019,8 3,15 14,15 14,4.793z" />
<GeometryDrawing Brush="#FF424242" Geometry="F1M10,5L10,2.207 12.793,5z M10.207,1L7,1 7,2 9,2 9,2.018 9,6 13,6 13,14 4,14 4,8 3.019,8 3,15 14,15 14,4.793z" />
<GeometryDrawing Brush="#FFF0EFF1" Geometry="F1M7,2.018L9,2.018 9,1.999 7,1.999z" />
<GeometryDrawing Brush="#FFF0EFF1" Geometry="F1M10,2.207L10,5 12.793,5z" />
<GeometryDrawing Brush="#FFF0EFF1" Geometry="F1M9,6L7,6 7,8 4,8 4,14 13,14 13,6z" />
<GeometryDrawing Brush="#FFEFEFF0" Geometry="F1M7,2.018L9,2.018 9,1.999 7,1.999z" />
<GeometryDrawing Brush="#FFEFEFF0" Geometry="F1M10,2.207L10,5 12.793,5z" />
<GeometryDrawing Brush="#FFEFEFF0" Geometry="F1M9,6L7,6 7,8 4,8 4,14 13,14 13,6z" />
<GeometryDrawing Brush="#FF388A34" Geometry="F1M8,3.0181L6,3.0181 6,1.0001 4.019,1.0001 4.019,3.0181 2,3.0181 2,5.0001 4.019,5.0001 4.019,7.0001 6,7.0001 6,5.0001 8,5.0001z" />
</DrawingGroup.Children>
</DrawingGroup>
</DrawingBrush.Drawing>
</DrawingBrush>
</Rectangle.Fill>
</Rectangle>
</Viewbox>
</DataTemplate>
</ResourceDictionary>
\ No newline at end of file
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:customControls="clr-namespace:VECTO3GUI2020.Views.Multistage.CustomControls">
<ControlTemplate x:Key="multistageParameterControlErrorTemplate">
<Grid>
<AdornedElementPlaceholder></AdornedElementPlaceholder>
<TextBlock Text="!" Height="Auto" FontWeight="ExtraBold" Foreground="OrangeRed" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="4"></TextBlock>
</Grid>
</ControlTemplate>
</ResourceDictionary>
\ No newline at end of file
...@@ -15,8 +15,9 @@ ...@@ -15,8 +15,9 @@
<StackPanel> <StackPanel>
<customControls:MultiStageParameter Content="{Binding ConvertedSI}" DummyContent="{Binding Source={StaticResource milimeterDummy}}"/> <customControls:MultiStageParameter Content="{Binding ConvertedSI}" DummyContent="{Binding Source={StaticResource milimeterDummy}}"/>
<customControls:MultiStageParameter Content="{Binding ConvertedSI1}" DummyContent="{Binding Source={StaticResource milimeterDummy}}"/> <customControls:MultiStageParameter Content="{Binding ConvertedSI1}" DummyContent="{Binding Source={StaticResource milimeterDummy}}"/>
<customControls:MultiStageParameter Content="{Binding Meter}"/>
<customControls:MultiStageParameter Mode="COMBOBOX" Content="{Binding HeatPumpMode}"></customControls:MultiStageParameter> <customControls:MultiStageParameter Mode="COMBOBOX" Content="{Binding HeatPumpMode}"></customControls:MultiStageParameter>
<customControls:MultiStageParameter Mode="TEXTBOX" Content="{Binding TestString}"></customControls:MultiStageParameter> <customControls:MultiStageParameter Mode="TEXTBOX" Content="{Binding TestString, ValidatesOnExceptions=True}"></customControls:MultiStageParameter>
</StackPanel> </StackPanel>
</Grid> </Grid>
</UserControl> </UserControl>
...@@ -4,8 +4,10 @@ using System.Collections.Generic; ...@@ -4,8 +4,10 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Castle.Core.Internal;
using TUGraz.VectoCommon.BusAuxiliaries; using TUGraz.VectoCommon.BusAuxiliaries;
using TUGraz.VectoCommon.Utils; using TUGraz.VectoCommon.Utils;
using VECTO3GUI2020.Helper;
using VECTO3GUI2020.ViewModel.Implementation.Common; using VECTO3GUI2020.ViewModel.Implementation.Common;
using VECTO3GUI2020.ViewModel.Interfaces; using VECTO3GUI2020.ViewModel.Interfaces;
using VECTO3GUI2020.ViewModel.Interfaces.Common; using VECTO3GUI2020.ViewModel.Interfaces.Common;
...@@ -52,12 +54,19 @@ namespace VECTO3GUI2020 ...@@ -52,12 +54,19 @@ namespace VECTO3GUI2020
public String TestString public String TestString
{ {
get => _testString; get => _testString;
set => SetProperty(ref _testString, value); set
{
if (value.IsNullOrEmpty()) {
throw new VectoEmptyFieldException();
}
SetProperty(ref _testString, value);
}
} }
public TestViewModel() public TestViewModel()
{ {
TestString = "Value loaded";
} }
} }
} }
...@@ -10,6 +10,7 @@ using TUGraz.VectoCore.InputData.FileIO.XML.Engineering.Interfaces; ...@@ -10,6 +10,7 @@ using TUGraz.VectoCore.InputData.FileIO.XML.Engineering.Interfaces;
using VECTO3GUI2020.Helper; using VECTO3GUI2020.Helper;
using VECTO3GUI2020.Util.XML.Interfaces; using VECTO3GUI2020.Util.XML.Interfaces;
using VECTO3GUI2020.ViewModel.Implementation.JobEdit.Vehicle.Components; using VECTO3GUI2020.ViewModel.Implementation.JobEdit.Vehicle.Components;
using VECTO3GUI2020.ViewModel.MultiStage.Implementation;
namespace VECTO3GUI2020.Util.XML.Implementation.ComponentWriter namespace VECTO3GUI2020.Util.XML.Implementation.ComponentWriter
{ {
...@@ -45,7 +46,8 @@ namespace VECTO3GUI2020.Util.XML.Implementation.ComponentWriter ...@@ -45,7 +46,8 @@ namespace VECTO3GUI2020.Util.XML.Implementation.ComponentWriter
public class XMLAirDragWriter_v2_0 : XMLAirDragWriter public class XMLAirDragWriter_v2_0 : XMLAirDragWriter
{ {
public static readonly string[] SUPPORTED_VERSIONS = { public static readonly string[] SUPPORTED_VERSIONS = {
typeof(AirDragViewModel_v2_0).ToString() typeof(AirDragViewModel_v2_0).ToString(),
typeof(MultistageAirdragViewModel).ToString()
}; };
public XMLAirDragWriter_v2_0(IAirdragDeclarationInputData inputData) : base(inputData) { } public XMLAirDragWriter_v2_0(IAirdragDeclarationInputData inputData) : base(inputData) { }
protected override void CreateDataElements() protected override void CreateDataElements()
...@@ -60,8 +62,8 @@ namespace VECTO3GUI2020.Util.XML.Implementation.ComponentWriter ...@@ -60,8 +62,8 @@ namespace VECTO3GUI2020.Util.XML.Implementation.ComponentWriter
dataElement.Add(new XElement(_defaultNamespace + XMLNames.Component_CertificationNumber, _inputData.CertificationNumber)); dataElement.Add(new XElement(_defaultNamespace + XMLNames.Component_CertificationNumber, _inputData.CertificationNumber));
dataElement.Add(new XElement(_defaultNamespace + XMLNames.Component_Date, _inputData.Date)); dataElement.Add(new XElement(_defaultNamespace + XMLNames.Component_Date, _inputData.Date));
dataElement.Add(new XElement(_defaultNamespace + XMLNames.Component_AppVersion, _inputData.AppVersion)); dataElement.Add(new XElement(_defaultNamespace + XMLNames.Component_AppVersion, _inputData.AppVersion));
dataElement.Add(new XElement(_defaultNamespace + XMLNames.AirDrag_CdxA_0, _inputData.AirDragArea.ToXMLFormat(2))); dataElement.Add(new XElement(_defaultNamespace + XMLNames.AirDrag_CdxA_0, _inputData.AirDragArea_0.ToXMLFormat(2)));
dataElement.Add(new XElement(_defaultNamespace + XMLNames.AirDrag_TransferredCDxA, _inputData.AirDragArea.ToXMLFormat(2))); dataElement.Add(new XElement(_defaultNamespace + XMLNames.AirDrag_TransferredCDxA, _inputData.TransferredAirDragArea.ToXMLFormat(2)));
dataElement.Add(new XElement(_defaultNamespace + XMLNames.AirDrag_DeclaredCdxA, _inputData.AirDragArea.ToXMLFormat(2))); dataElement.Add(new XElement(_defaultNamespace + XMLNames.AirDrag_DeclaredCdxA, _inputData.AirDragArea.ToXMLFormat(2)));
} }
...@@ -69,7 +71,7 @@ namespace VECTO3GUI2020.Util.XML.Implementation.ComponentWriter ...@@ -69,7 +71,7 @@ namespace VECTO3GUI2020.Util.XML.Implementation.ComponentWriter
protected override void Initialize() protected override void Initialize()
{ {
_defaultNamespace = XMLNamespaces.V20; _defaultNamespace = XMLNamespaces.V20;
_xElement = new XElement(_defaultNamespace + XMLNames.Component_AirDrag); _xElement = new XElement(XMLNames.Component_AirDrag);
} }
} }
} }
using System.Xml.Linq;
using TUGraz.VectoCommon.InputData;
namespace VECTO3GUI2020.Util.XML.Implementation.ComponentWriter
{
public abstract class XMLBusAuxiliariesWriter
{
private readonly IBusAuxiliariesDeclarationData _inputData;
private XElement _xElement;
protected XMLBusAuxiliariesWriter(IBusAuxiliariesDeclarationData inputData)
{
_inputData = inputData;
}
public XElement GetElement()
{
if (_xElement == null)
{
Initialize();
CreateElements();
}
return _xElement;
}
public abstract void Initialize();
public abstract void CreateElements();
}
public class XMLBusAuxiliariesWriterMultistage : XMLBusAuxiliariesWriter
{
private XNamespace _defaultNamespace;
public XMLBusAuxiliariesWriterMultistage(IBusAuxiliariesDeclarationData inputData) : base(inputData) { }
#region Overrides of XMLBusAuxiliariesWriter
public override void Initialize()
{
_defaultNamespace = XMLNamespaces.V23;
}
public override void CreateElements()
{
throw new System.NotImplementedException();
}
#endregion
}
}
\ No newline at end of file
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