From eac13ff33d93f4addac5b332d52348e8cc09fd14 Mon Sep 17 00:00:00 2001 From: "harald.martini@student.tugraz.at" <harald.martini@student.tugraz.at> Date: Mon, 17 May 2021 14:30:17 +0200 Subject: [PATCH] Updated Labels, Added possibilty to provide an additional ResourceManager to get Labels for propertynames --- VECTO3GUI2020/MainWindow.xaml | 9 +- .../Properties/BusStrings.Designer.cs | 216 ++++++++++++++++++ VECTO3GUI2020/Properties/BusStrings.resx | 171 ++++++++++++++ VECTO3GUI2020/Resources/ObjectProvider.xaml | 6 +- VECTO3GUI2020/VECTO3GUI2020.csproj | 9 + .../CustomControlExtensionMethods.cs | 32 ++- VECTO3GUI2020/Views/JoblistView.xaml | 1 + .../LabledTextBoxMultistage.xaml | 8 +- .../LabledTextBoxMultistage.xaml.cs | 14 +- .../CustomControls/MultiStageParameter.xaml | 21 +- .../MultiStageParameter.xaml.cs | 48 +++- .../ManufacturingStageAuxiliariesView.xaml | 4 +- .../Views/Multistage/VehicleView_v2_8.xaml | 12 +- .../XMLReaderDeclaration/123.VIF_Report_5.xml | 74 +----- 14 files changed, 529 insertions(+), 96 deletions(-) create mode 100644 VECTO3GUI2020/Properties/BusStrings.Designer.cs create mode 100644 VECTO3GUI2020/Properties/BusStrings.resx diff --git a/VECTO3GUI2020/MainWindow.xaml b/VECTO3GUI2020/MainWindow.xaml index a0a3a80ffa..cd6168a435 100644 --- a/VECTO3GUI2020/MainWindow.xaml +++ b/VECTO3GUI2020/MainWindow.xaml @@ -7,11 +7,12 @@ xmlns:Implementation="clr-namespace:VECTO3GUI2020.ViewModel.Implementation" d:DataContext="{d:DesignInstance Type=Implementation:MainWindowViewModel}" x:Class="VECTO3GUI2020.MainWindow" mc:Ignorable="d" Title="Vecto" Height="450" Width="820" - WindowStartupLocation="CenterScreen"> + WindowStartupLocation="CenterScreen" + AutomationProperties.Name="MainWindow"> - <Grid> + <Grid x:Name="Grid" > <Grid.ColumnDefinitions> <ColumnDefinition Width="1*"/> </Grid.ColumnDefinitions> @@ -23,7 +24,7 @@ <Grid Grid.Row="0"> <StackPanel Orientation="Vertical"> - <Menu IsMainMenu="True"> + <Menu x:Name="menu" IsMainMenu="True"> <MenuItem Header="File" VerticalAlignment="Stretch"> <MenuItem Header="Settings" Command="{Binding OpenSettings}"/> <MenuItem Header="New File" Command="{Binding NewInterimFile}"/> @@ -38,7 +39,7 @@ </Grid> <Grid Grid.Row="2" Margin="0,0,0,0"> - <ContentControl Content="{Binding CurrentViewModelBottom}"/> + <ContentControl Name="ContentControlBottom" Content="{Binding CurrentViewModelBottom}"/> </Grid> </Grid> diff --git a/VECTO3GUI2020/Properties/BusStrings.Designer.cs b/VECTO3GUI2020/Properties/BusStrings.Designer.cs new file mode 100644 index 0000000000..e17be8e7d5 --- /dev/null +++ b/VECTO3GUI2020/Properties/BusStrings.Designer.cs @@ -0,0 +1,216 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace VECTO3GUI2020.Properties { + using System; + + + /// <summary> + /// A strongly-typed resource class, for looking up localized strings, etc. + /// </summary> + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + public class BusStrings { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal BusStrings() { + } + + /// <summary> + /// Returns the cached ResourceManager instance used by this class. + /// </summary> + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + public static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("VECTO3GUI2020.Properties.BusStrings", typeof(BusStrings).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// <summary> + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// </summary> + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + public static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// <summary> + /// Looks up a localized string similar to Airdrag Area 0. + /// </summary> + public static string AirdragArea0 { + get { + return ResourceManager.GetString("AirdragArea0", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to ATP Eco Roll Release Lockup Clutch. + /// </summary> + public static string ATEcoRollReleaseLockupClutch { + get { + return ResourceManager.GetString("ATEcoRollReleaseLockupClutch", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to Compressor Drive. + /// </summary> + public static string CompressorDrive { + get { + return ResourceManager.GetString("CompressorDrive", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to Corrected Actual Mass. + /// </summary> + public static string CurbmassChassis { + get { + return ResourceManager.GetString("CurbmassChassis", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to Eco Roll Type. + /// </summary> + public static string EcoRollTypeNullable { + get { + return ResourceManager.GetString("EcoRollTypeNullable", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to Engine Stop Start. + /// </summary> + public static string EngineStopStartNullable { + get { + return ResourceManager.GetString("EngineStopStartNullable", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to Entrance Height. + /// </summary> + public static string EntranceHeightInMm { + get { + return ResourceManager.GetString("EntranceHeightInMm", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to Tech. Perm. Max. Laden Mass. + /// </summary> + public static string GrossVehicleMassRating { + get { + return ResourceManager.GetString("GrossVehicleMassRating", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to Height. + /// </summary> + public static string HeightInMm { + get { + return ResourceManager.GetString("HeightInMm", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to Legislative Category. + /// </summary> + public static string LegislativeClass { + get { + return ResourceManager.GetString("LegislativeClass", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to Length. + /// </summary> + public static string LengthInMm { + get { + return ResourceManager.GetString("LengthInMm", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to Manufacturer. + /// </summary> + public static string Manufacturer { + get { + return ResourceManager.GetString("Manufacturer", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to Predictive Cruise Control. + /// </summary> + public static string PredictiveCruiseControlNullable { + get { + return ResourceManager.GetString("PredictiveCruiseControlNullable", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to Ng Tank System. + /// </summary> + public static string TankSystem { + get { + return ResourceManager.GetString("TankSystem", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to Transferred Airdrag Area. + /// </summary> + public static string TransferredAirDragArea { + get { + return ResourceManager.GetString("TransferredAirDragArea", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to Bodywork Code. + /// </summary> + public static string VehicleCode { + get { + return ResourceManager.GetString("VehicleCode", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to Width. + /// </summary> + public static string WidthInMm { + get { + return ResourceManager.GetString("WidthInMm", resourceCulture); + } + } + } +} diff --git a/VECTO3GUI2020/Properties/BusStrings.resx b/VECTO3GUI2020/Properties/BusStrings.resx new file mode 100644 index 0000000000..d32171bef1 --- /dev/null +++ b/VECTO3GUI2020/Properties/BusStrings.resx @@ -0,0 +1,171 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" use="required" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <data name="AirdragArea0" xml:space="preserve"> + <value>Airdrag Area 0</value> + </data> + <data name="ATEcoRollReleaseLockupClutch" xml:space="preserve"> + <value>ATP Eco Roll Release Lockup Clutch</value> + </data> + <data name="CompressorDrive" xml:space="preserve"> + <value>Compressor Drive</value> + </data> + <data name="CurbmassChassis" xml:space="preserve"> + <value>Corrected Actual Mass</value> + </data> + <data name="EcoRollTypeNullable" xml:space="preserve"> + <value>Eco Roll Type</value> + </data> + <data name="EngineStopStartNullable" xml:space="preserve"> + <value>Engine Stop Start</value> + </data> + <data name="EntranceHeightInMm" xml:space="preserve"> + <value>Entrance Height</value> + </data> + <data name="GrossVehicleMassRating" xml:space="preserve"> + <value>Tech. Perm. Max. Laden Mass</value> + </data> + <data name="HeightInMm" xml:space="preserve"> + <value>Height</value> + </data> + <data name="LegislativeClass" xml:space="preserve"> + <value>Legislative Category</value> + </data> + <data name="LengthInMm" xml:space="preserve"> + <value>Length</value> + </data> + <data name="Manufacturer" xml:space="preserve"> + <value>Manufacturer</value> + </data> + <data name="PredictiveCruiseControlNullable" xml:space="preserve"> + <value>Predictive Cruise Control</value> + </data> + <data name="TankSystem" xml:space="preserve"> + <value>Ng Tank System</value> + </data> + <data name="TransferredAirDragArea" xml:space="preserve"> + <value>Transferred Airdrag Area</value> + </data> + <data name="VehicleCode" xml:space="preserve"> + <value>Bodywork Code</value> + </data> + <data name="WidthInMm" xml:space="preserve"> + <value>Width</value> + </data> +</root> \ No newline at end of file diff --git a/VECTO3GUI2020/Resources/ObjectProvider.xaml b/VECTO3GUI2020/Resources/ObjectProvider.xaml index 3a81ded570..1c858f64f6 100644 --- a/VECTO3GUI2020/Resources/ObjectProvider.xaml +++ b/VECTO3GUI2020/Resources/ObjectProvider.xaml @@ -1,7 +1,11 @@ <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:helper="clr-namespace:VECTO3GUI2020.Helper"> + xmlns:helper="clr-namespace:VECTO3GUI2020.Helper" + xmlns:properties="clr-namespace:VECTO3GUI2020.Properties" + xmlns:resources="clr-namespace:System.Resources;assembly=mscorlib"> <ObjectDataProvider x:Key="milimeterDummy" ObjectType="{x:Type helper:ConvertedSIDummyCreator}" MethodName="CreateMillimeterDummy"/> + + <ObjectDataProvider x:Key="BusStringResourceManager" ObjectType="{x:Type resources:ResourceManager}" ObjectInstance="{x:Static properties:BusStrings.ResourceManager}"/> </ResourceDictionary> \ No newline at end of file diff --git a/VECTO3GUI2020/VECTO3GUI2020.csproj b/VECTO3GUI2020/VECTO3GUI2020.csproj index 321c88a801..609d62c169 100644 --- a/VECTO3GUI2020/VECTO3GUI2020.csproj +++ b/VECTO3GUI2020/VECTO3GUI2020.csproj @@ -168,6 +168,11 @@ <Compile Include="Ninject\MultistageLazyDependencies.cs" /> <Compile Include="Ninject\MultistageModule.cs" /> <Compile Include="Properties\Annotations.cs" /> + <Compile Include="Properties\BusStrings.Designer.cs"> + <AutoGen>True</AutoGen> + <DesignTime>True</DesignTime> + <DependentUpon>BusStrings.resx</DependentUpon> + </Compile> <Compile Include="Test.xaml.cs"> <DependentUpon>Test.xaml</DependentUpon> </Compile> @@ -654,6 +659,10 @@ <DependentUpon>Settings.settings</DependentUpon> <DesignTimeSharedInput>True</DesignTimeSharedInput> </Compile> + <EmbeddedResource Include="Properties\BusStrings.resx"> + <Generator>PublicResXFileCodeGenerator</Generator> + <LastGenOutput>BusStrings.Designer.cs</LastGenOutput> + </EmbeddedResource> <EmbeddedResource Include="Properties\Strings.resx"> <Generator>PublicResXFileCodeGenerator</Generator> <LastGenOutput>Strings.Designer.cs</LastGenOutput> diff --git a/VECTO3GUI2020/Views/CustomControls/CustomControlExtensionMethods.cs b/VECTO3GUI2020/Views/CustomControls/CustomControlExtensionMethods.cs index 39c340cab1..9e20a7d911 100644 --- a/VECTO3GUI2020/Views/CustomControls/CustomControlExtensionMethods.cs +++ b/VECTO3GUI2020/Views/CustomControls/CustomControlExtensionMethods.cs @@ -2,26 +2,32 @@ using System.Collections.Generic; using System.Diagnostics; using System.Linq; +using System.Net.NetworkInformation; using System.Resources; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using TUGraz.VectoCommon.Utils; +using VECTO3GUI2020.Annotations; namespace VECTO3GUI2020.Views.CustomControls { public static class CustomControlExtensionMethods { + + private static string unresolved = "unresolved"; + private static string _suffix = "_"; //used to mark properties; + /// <summary> /// Looks up the Label by the name the Property that is used for the binding /// </summary> /// <param name="dependencyProperty"></param> - /// <param name="resourceManager"></param> + /// <param name="resourceManagers">The resourceManagers where the name of the property will be looked up if</param> /// <returns></returns> - public static string GetLabelByPropertyName(this UserControl userControl, DependencyProperty dependencyProperty, ResourceManager resourceManager) + public static string GetLabelByPropertyName(this UserControl userControl, DependencyProperty dependencyProperty, params ResourceManager[] resourceManagers) { - var name = "unresolved"; + string name = null; var binding = userControl.GetBindingExpression(dependencyProperty); var propertyName = binding?.ResolvedSourcePropertyName; @@ -30,13 +36,29 @@ namespace VECTO3GUI2020.Views.CustomControls return name; } + foreach (var resourceManager in resourceManagers) { + var resolvedName = resourceManager?.GetString(propertyName); + if (resolvedName != null) { + name = resolvedName; + return name; + } + } + - var extendedPropertyName = binding?.ResolvedSource.GetType().Name + "_" + propertyName; - name = resourceManager?.GetString(extendedPropertyName) ?? resourceManager?.GetString(propertyName) ?? (propertyName + "_"); //_Postfix to label Property Names that are not in strings.resx + name = propertyName + _suffix; + + //var extendedPropertyName = binding?.ResolvedSource.GetType().Name + "_" + propertyName; + //name = resourceManager?.GetString(extendedPropertyName) ?? resourceManager?.GetString(propertyName) ?? (propertyName + "_"); //_Postfix to label Property Names that are not in strings.resx return name; } + public static string GetLabelByPropertyName(this UserControl userControl, DependencyProperty dependencyProperty, + [NotNull] ResourceManager resourceManager) + { + return GetLabelByPropertyName(userControl, dependencyProperty, resourceManagers:resourceManager); + } + public static Type GetPropertyType(this UserControl userControl, DependencyProperty dependencyProperty) { var Binding = userControl.GetBindingExpression(dependencyProperty); diff --git a/VECTO3GUI2020/Views/JoblistView.xaml b/VECTO3GUI2020/Views/JoblistView.xaml index 113e947d74..e73d67579a 100644 --- a/VECTO3GUI2020/Views/JoblistView.xaml +++ b/VECTO3GUI2020/Views/JoblistView.xaml @@ -6,6 +6,7 @@ xmlns:local="clr-namespace:VECTO3GUI2020.Views" xmlns:converter="clr-namespace:VECTO3GUI2020.Helper.Converter" xmlns:implementation="clr-namespace:VECTO3GUI2020.ViewModel.Implementation" d:DataContext="{d:DesignInstance Type=implementation:JobListViewModel}" mc:Ignorable="d" + AutomationProperties.Name="JobListView" d:DesignHeight="450" d:DesignWidth="1000"> <Grid> diff --git a/VECTO3GUI2020/Views/Multistage/CustomControls/LabledTextBoxMultistage.xaml b/VECTO3GUI2020/Views/Multistage/CustomControls/LabledTextBoxMultistage.xaml index 70a9405da6..8cbe483302 100644 --- a/VECTO3GUI2020/Views/Multistage/CustomControls/LabledTextBoxMultistage.xaml +++ b/VECTO3GUI2020/Views/Multistage/CustomControls/LabledTextBoxMultistage.xaml @@ -14,7 +14,13 @@ <ColumnDefinition Width="1*" SharedSizeGroup="N"/> </Grid.ColumnDefinitions> - <Label Content="{Binding LabelText, ElementName=labledTextBoxMultistage}"/> + <Label> + <PriorityBinding> + <Binding ElementName="lableTextBoxMultistage" Path="Label" Converter="{StaticResource NullToUnsetValue}"></Binding> + <Binding ElementName="labledTextBoxMultistage" Path="GeneratedLabelText"></Binding> + </PriorityBinding> + </Label> + <TextBox Grid.Column="1" Name ="TextBoxContent" VerticalAlignment="Center" Margin="2 0 2 0" Text="{Binding ElementName=labledTextBoxMultistage, Path=Content, Converter={StaticResourceExtension SIValueToStringConverter}, diff --git a/VECTO3GUI2020/Views/Multistage/CustomControls/LabledTextBoxMultistage.xaml.cs b/VECTO3GUI2020/Views/Multistage/CustomControls/LabledTextBoxMultistage.xaml.cs index 8fd84d304a..35a572c648 100644 --- a/VECTO3GUI2020/Views/Multistage/CustomControls/LabledTextBoxMultistage.xaml.cs +++ b/VECTO3GUI2020/Views/Multistage/CustomControls/LabledTextBoxMultistage.xaml.cs @@ -63,13 +63,13 @@ namespace VECTO3GUI2020.Views.Multistage.CustomControls } - public static readonly DependencyProperty LabelTextProperty = DependencyProperty.Register( - "LabelText", typeof(string), typeof(LabledTextBoxMultistage), new PropertyMetadata(null)); + public static readonly DependencyProperty GeneratedLabelTextProperty = DependencyProperty.Register( + "GeneratedLabelText", typeof(string), typeof(LabledTextBoxMultistage), new PropertyMetadata(null)); - public string LabelText + public string GeneratedLabelText { - get { return (string)GetValue(LabelTextProperty); } - set { SetValue(LabelTextProperty, value); } + get { return (string)GetValue(GeneratedLabelTextProperty); } + set { SetValue(GeneratedLabelTextProperty, value); } } public static readonly DependencyProperty ModeProperty = DependencyProperty.Register( @@ -91,11 +91,11 @@ namespace VECTO3GUI2020.Views.Multistage.CustomControls labledTextBoxMultistage.DummyContent = labledTextBoxMultistage.CreateDummyContent(e, createEnum:labledTextBoxMultistage.Mode == MultistageParameterViewMode.COMBOBOX); - if (labledTextBoxMultistage.LabelText != null) + if (labledTextBoxMultistage.GeneratedLabelText != null) { return; } - labledTextBoxMultistage.LabelText = labledTextBoxMultistage.GetLabelByPropertyName( + labledTextBoxMultistage.GeneratedLabelText = labledTextBoxMultistage.GetLabelByPropertyName( LabledTextBoxMultistage.ContentProperty, Strings.ResourceManager); } diff --git a/VECTO3GUI2020/Views/Multistage/CustomControls/MultiStageParameter.xaml b/VECTO3GUI2020/Views/Multistage/CustomControls/MultiStageParameter.xaml index f98cf65220..3a9a0549a8 100644 --- a/VECTO3GUI2020/Views/Multistage/CustomControls/MultiStageParameter.xaml +++ b/VECTO3GUI2020/Views/Multistage/CustomControls/MultiStageParameter.xaml @@ -23,7 +23,12 @@ <ColumnDefinition Width="1*" SharedSizeGroup="N"/> </Grid.ColumnDefinitions> - <Label x:Name="label" Content="{Binding LabelText, ElementName=MultistageParameterControl}"></Label> + <Label x:Name="label" > + <PriorityBinding> + <Binding ElementName="MultistageParameterControl" Path="Label" Converter="{StaticResource NullToUnsetValue}"></Binding> + <Binding ElementName="MultistageParameterControl" Path="GeneratedLabelText"></Binding> + </PriorityBinding> + </Label> <CheckBox Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center" Name="CheckBox" Visibility="{Binding ShowCheckBox, ElementName=MultistageParameterControl, @@ -66,7 +71,12 @@ <ColumnDefinition Width="1*" SharedSizeGroup="N"/> </Grid.ColumnDefinitions> - <Label x:Name="label1" Content="{Binding LabelText, ElementName=MultistageParameterControl}"></Label> + <Label x:Name="label1"> + <PriorityBinding> + <Binding ElementName="MultistageParameterControl" Path="Label" Converter="{StaticResource NullToUnsetValue}"></Binding> + <Binding ElementName="MultistageParameterControl" Path="GeneratedLabelText"></Binding> + </PriorityBinding> + </Label> <CheckBox Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center" Name="CheckBoxCombo" Visibility="{Binding ShowCheckBox, ElementName=MultistageParameterControl, @@ -123,7 +133,12 @@ <ColumnDefinition Width="1*" SharedSizeGroup="N"/> </Grid.ColumnDefinitions> - <Label x:Name="label3" Content="{Binding LabelText, ElementName=MultistageParameterControl}"></Label> + <Label x:Name="label3"> + <PriorityBinding> + <Binding ElementName="MultistageParameterControl" Path="Label" Converter="{StaticResource NullToUnsetValue}"></Binding> + <Binding ElementName="MultistageParameterControl" Path="GeneratedLabelText"></Binding> + </PriorityBinding> + </Label> <CheckBox Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center" Name="CheckBoxCheckBox" Visibility="{Binding ShowCheckBox, ElementName=MultistageParameterControl, diff --git a/VECTO3GUI2020/Views/Multistage/CustomControls/MultiStageParameter.xaml.cs b/VECTO3GUI2020/Views/Multistage/CustomControls/MultiStageParameter.xaml.cs index 56b9132540..6c5bcd53d3 100644 --- a/VECTO3GUI2020/Views/Multistage/CustomControls/MultiStageParameter.xaml.cs +++ b/VECTO3GUI2020/Views/Multistage/CustomControls/MultiStageParameter.xaml.cs @@ -87,23 +87,45 @@ namespace VECTO3GUI2020.Views.Multistage.CustomControls set { SetValue(ModeProperty, value); } } + public static readonly DependencyProperty LabelProperty = DependencyProperty.Register( + "Label", typeof(string), typeof(MultiStageParameter), new PropertyMetadata(default(string))); + + public string Label + { + get { return (string)GetValue(LabelProperty); } + set { SetValue(LabelProperty, value); } + } - public static readonly DependencyProperty LabelTextProperty = DependencyProperty.Register( - "LabelText", typeof(string), typeof(MultiStageParameter), new PropertyMetadata(null)); + public static readonly DependencyProperty GeneratedLabelTextProperty = DependencyProperty.Register( + "GeneratedLabelText", typeof(string), typeof(MultiStageParameter), new PropertyMetadata(null)); - public string LabelText + public string GeneratedLabelText { - get { return (string)GetValue(LabelTextProperty); } - set { SetValue(LabelTextProperty, value); } + get { return (string)GetValue(GeneratedLabelTextProperty); } + set { SetValue(GeneratedLabelTextProperty, value); } } + public static readonly DependencyProperty NameLookUpResourceManagerProperty = DependencyProperty.Register( + "NameLookUpResourceManager", typeof(ResourceManager), typeof(MultiStageParameter), new PropertyMetadata(default(ResourceManager), NameLookUpResourceManagerChanged)); + + private static void NameLookUpResourceManagerChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + var multistageParameter = (MultiStageParameter)d; + multistageParameter.SetLabelText(); + } + + public ResourceManager NameLookUpResourceManager + { + get { return (ResourceManager)GetValue(NameLookUpResourceManagerProperty); } + set { SetValue(NameLookUpResourceManagerProperty, value); } + } + + public static readonly DependencyProperty EditingEnabledProperty = DependencyProperty.Register( "EditingEnabled", typeof(bool), typeof(MultiStageParameter), new FrameworkPropertyMetadata( false, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, new PropertyChangedCallback(EditingEnabledChanged))); - - public bool EditingEnabled { get @@ -200,9 +222,17 @@ namespace VECTO3GUI2020.Views.Multistage.CustomControls } - if (multiStageParameter.LabelText == null) { - multiStageParameter.LabelText = multiStageParameter.GetLabelByPropertyName( + if (multiStageParameter.GeneratedLabelText == null) { + multiStageParameter.SetLabelText(); + } + } + + public void SetLabelText() + { + if (Label == null) { + this.GeneratedLabelText = this.GetLabelByPropertyName( MultiStageParameter.ContentProperty, + this.NameLookUpResourceManager, Strings.ResourceManager); } } diff --git a/VECTO3GUI2020/Views/Multistage/ManufacturingStageAuxiliariesView.xaml b/VECTO3GUI2020/Views/Multistage/ManufacturingStageAuxiliariesView.xaml index e972cb9410..0efa6ea2f1 100644 --- a/VECTO3GUI2020/Views/Multistage/ManufacturingStageAuxiliariesView.xaml +++ b/VECTO3GUI2020/Views/Multistage/ManufacturingStageAuxiliariesView.xaml @@ -59,9 +59,9 @@ ListItems="{Binding HeatPumpModePassengerCompartmentAllowedValues}" ShowCheckBox="False"/> <Separator/> - <customControls:MultiStageParameter Mode="COMBOBOX" + <!--<customControls:MultiStageParameter Mode="COMBOBOX" PreviousContent="{Binding ConsolidatedInputData.PneumaticSupply.CompressorDrive}" - Content="{Binding CompressorDrive}"></customControls:MultiStageParameter> + Content="{Binding CompressorDrive}"></customControls:MultiStageParameter>--> <customControls:MultiStageParameter Mode="TEXTBOX" Validation.ErrorTemplate="{DynamicResource multistageParameterControlErrorTemplate}" PreviousContent="{Binding ConsolidatedInputData.HVACAux.AuxHeaterPower}" diff --git a/VECTO3GUI2020/Views/Multistage/VehicleView_v2_8.xaml b/VECTO3GUI2020/Views/Multistage/VehicleView_v2_8.xaml index a456f13b2c..e10142f823 100644 --- a/VECTO3GUI2020/Views/Multistage/VehicleView_v2_8.xaml +++ b/VECTO3GUI2020/Views/Multistage/VehicleView_v2_8.xaml @@ -4,9 +4,18 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:VECTO3GUI2020.Views.Multistage" - xmlns:custom="clr-namespace:VECTO3GUI2020.Views.Multistage.CustomControls" xmlns:implementation="clr-namespace:VECTO3GUI2020.ViewModel.MultiStage.Implementation" d:DataContext="{d:DesignInstance Type=implementation:DeclarationInterimStageBusVehicleViewModel_v2_8}" + xmlns:custom="clr-namespace:VECTO3GUI2020.Views.Multistage.CustomControls" xmlns:implementation="clr-namespace:VECTO3GUI2020.ViewModel.MultiStage.Implementation" + xmlns:properties="clr-namespace:VECTO3GUI2020.Properties" + xmlns:resources="clr-namespace:System.Resources;assembly=mscorlib" + d:DataContext="{d:DesignInstance Type=implementation:DeclarationInterimStageBusVehicleViewModel_v2_8}" mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="800" BorderBrush="{DynamicResource ButtonHighlightColor}" BorderThickness="2px" Margin="4px"> + <UserControl.Resources> + <Style TargetType="custom:MultiStageParameter"> + <!--<Setter Property="NameLookUpResourceManager" Value="{Binding Source=BusStringResourceManager}"></Setter>--> + <Setter Property="NameLookUpResourceManager" Value="{x:Static properties:BusStrings.ResourceManager}"></Setter> + </Style> + </UserControl.Resources> <Grid> <ScrollViewer> <DockPanel> @@ -43,6 +52,7 @@ <custom:MultiStageParameter x:Name="AirdragModified" + Label="Airdrag modified" Validation.ErrorTemplate="{StaticResource multistageParameterControlErrorTemplate}" EditingEnabled="{Binding AirdragModifiedMultistageEditingEnabled}" PreviousContent="{Binding ConsolidatedAirdragmodified}" diff --git a/VectoCore/VectoCoreTest/TestData/XML/XMLReaderDeclaration/123.VIF_Report_5.xml b/VectoCore/VectoCoreTest/TestData/XML/XMLReaderDeclaration/123.VIF_Report_5.xml index b343306110..a73cb24e4a 100644 --- a/VectoCore/VectoCoreTest/TestData/XML/XMLReaderDeclaration/123.VIF_Report_5.xml +++ b/VectoCore/VectoCoreTest/TestData/XML/XMLReaderDeclaration/123.VIF_Report_5.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<VectoOutputMultistage xmlns="urn:tugraz:ivt:VectoAPI:DeclarationOutput:VehicleInterimFile:v0.1" xmlns:di="http://www.w3.org/2000/09/xmldsig#" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:v2.0="urn:tugraz:ivt:VectoAPI:DeclarationDefinitions:v2.0" xmlns:v2.1="urn:tugraz:ivt:VectoAPI:DeclarationDefinitions:v2.1" xmlns:v2.3="urn:tugraz:ivt:VectoAPI:DeclarationDefinitions:DEV:v2.3" xmlns:v2.6="urn:tugraz:ivt:VectoAPI:DeclarationDefinitions:DEV:v2.6" xmlns:v2.8="urn:tugraz:ivt:VectoAPI:DeclarationDefinitions:DEV:v2.8" xmlns:schemaLocation="urn:tugraz:ivt:VectoAPI:DeclarationOutput:VehicleInterimFile:v0.1 E:\VECTO_DEV\fk_vecto-dev\VectoCore\VectoCore\Resources\XSD/VectoOutputMultistage.0.1.xsd"> +<VectoOutputMultistage xmlns="urn:tugraz:ivt:VectoAPI:DeclarationOutput:VehicleInterimFile:v0.1" xmlns:di="http://www.w3.org/2000/09/xmldsig#" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:v2.0="urn:tugraz:ivt:VectoAPI:DeclarationDefinitions:v2.0" xmlns:v2.1="urn:tugraz:ivt:VectoAPI:DeclarationDefinitions:v2.1" xmlns:v2.3="urn:tugraz:ivt:VectoAPI:DeclarationDefinitions:DEV:v2.3" xmlns:v2.6="urn:tugraz:ivt:VectoAPI:DeclarationDefinitions:DEV:v2.6" xmlns:v2.8="urn:tugraz:ivt:VectoAPI:DeclarationDefinitions:DEV:v2.8" xsi:schemaLocation="urn:tugraz:ivt:VectoAPI:DeclarationOutput:VehicleInterimFile:v0.1 E:\VECTO_DEV\fk_vecto-dev\VectoCore\VectoCore\Resources\XSD/VectoOutputMultistage.0.1.xsd"> <PrimaryVehicle> <Data id="text" xsi:type="PrimaryVehicleDataType"> <Vehicle xsi:type="VehiclePIFType"> @@ -809,7 +809,7 @@ </Signature> </ManufacturingStage> <ManufacturingStage stageCount="5"> - <Data xsi:type="BusManufacturingStageDataType" id="MST-8a622efa2f0145e684b7"> + <Data xsi:type="BusManufacturingStageDataType" id="MST-076becd8299f4cd6b7ed"> <HashPreviousStage> <di:Reference URI="#RESULT-8f30c7fe665a47938f7b"> <di:Transforms> @@ -820,78 +820,26 @@ <di:DigestValue>GHpFCKh1bu/YPwYj38kJK1uCrv++BTLf2OUZcOt43Os=</di:DigestValue> </di:Reference> </HashPreviousStage> - <Vehicle xsi:type="v2.8:InterimStageInputType" id="VEH-5cc3b782c52a421d8636"> - <v2.8:Manufacturer>Some Manufacturer</v2.8:Manufacturer> - <v2.8:ManufacturerAddress>Some Manufacturer Address</v2.8:ManufacturerAddress> - <v2.8:VIN>VEH-1234567890</v2.8:VIN> - <v2.8:Date>2021-05-09T22:00:00Z</v2.8:Date> - <v2.8:Model>Sample Bus Model</v2.8:Model> - <v2.8:LegislativeCategory>M3</v2.8:LegislativeCategory> - <v2.8:CorrectedActualMass>500</v2.8:CorrectedActualMass> - <v2.8:TechnicalPermissibleMaximumLadenMass>3500</v2.8:TechnicalPermissibleMaximumLadenMass> - <v2.8:AirdragModifiedMultistage>false</v2.8:AirdragModifiedMultistage> - <v2.8:NgTankSystem>Compressed</v2.8:NgTankSystem> - <v2.8:ClassBus>II+III</v2.8:ClassBus> - <v2.8:NumberPassengersLowerDeck>0</v2.8:NumberPassengersLowerDeck> - <v2.8:NumberPassengersUpperDeck>10</v2.8:NumberPassengersUpperDeck> - <v2.8:BodyworkCode>CB</v2.8:BodyworkCode> - <v2.8:LowEntry>false</v2.8:LowEntry> - <v2.8:HeightIntegratedBody>2500</v2.8:HeightIntegratedBody> - <v2.8:VehicleLength>0</v2.8:VehicleLength> - <v2.8:VehicleWidth>0</v2.8:VehicleWidth> - <v2.8:EntranceHeight>0</v2.8:EntranceHeight> - <v2.8:DoorDriveTechnology>electric</v2.8:DoorDriveTechnology> - <v2.8:VehicleDeclarationType>interim</v2.8:VehicleDeclarationType> - <v2.8:ADAS> - <v2.3:EngineStopStart>true</v2.3:EngineStopStart> - <v2.3:EcoRollWithoutEngineStop>false</v2.3:EcoRollWithoutEngineStop> - <v2.3:EcoRollWithEngineStop>false</v2.3:EcoRollWithEngineStop> - <v2.3:PredictiveCruiseControl>none</v2.3:PredictiveCruiseControl> - <v2.3:APTEcoRollReleaseLockupClutch>true</v2.3:APTEcoRollReleaseLockupClutch> - </v2.8:ADAS> - <v2.8:Components xmlns:v2.8="urn:tugraz:ivt:VectoAPI:DeclarationDefinitions:DEV:v2.8" xsi:type="v2.8:CompletedVehicleComponentsDeclarationType"> - <v2.8:Auxiliaries> - <v2.8:Data xsi:type="v2.8:CompletedVehicleAuxiliaryDataDeclarationType"> - <v2.8:ElectricSystem> - <v2.8:LEDLights> - <v2.8:Interiorlights>false</v2.8:Interiorlights> - <v2.8:Dayrunninglights>true</v2.8:Dayrunninglights> - <v2.8:Positionlights>true</v2.8:Positionlights> - <v2.8:Brakelights>true</v2.8:Brakelights> - <v2.8:Headlights>false</v2.8:Headlights> - </v2.8:LEDLights> - </v2.8:ElectricSystem> - <v2.8:HVAC> - <v2.8:SystemConfiguration>0</v2.8:SystemConfiguration> - <v2.8:HeatPumpTypeDriverCompartment>none</v2.8:HeatPumpTypeDriverCompartment> - <v2.8:HeatPumpModeDriverCompartment>heating</v2.8:HeatPumpModeDriverCompartment> - <v2.8:HeatPumpTypePassengerCompartment>non R-744 2-stage</v2.8:HeatPumpTypePassengerCompartment> - <v2.8:HeatPumpModePassengerCompartment>cooling</v2.8:HeatPumpModePassengerCompartment> - <v2.8:AuxiliaryHeaterPower>50</v2.8:AuxiliaryHeaterPower> - <v2.8:DoubleGlazing>false</v2.8:DoubleGlazing> - <v2.8:AdjustableAuxiliaryHeater>true</v2.8:AdjustableAuxiliaryHeater> - <v2.8:SeparateAirDistributionDucts>false</v2.8:SeparateAirDistributionDucts> - <v2.8:WaterElectricHeater>true</v2.8:WaterElectricHeater> - <v2.8:AirElectricHeater>false</v2.8:AirElectricHeater> - <v2.8:OtherHeatingTechnology>false</v2.8:OtherHeatingTechnology> - </v2.8:HVAC> - </v2.8:Data> - </v2.8:Auxiliaries> - </v2.8:Components> + <Vehicle xsi:type="v2.8:InterimStageInputType" id="VEH-d76d03c792dc4a258381"> + <v2.8:Manufacturer>Manufq</v2.8:Manufacturer> + <v2.8:ManufacturerAddress>asdflköj</v2.8:ManufacturerAddress> + <v2.8:VIN>sadsadf</v2.8:VIN> + <v2.8:Date>2021-05-16T22:00:00Z</v2.8:Date> + <v2.8:VehicleDeclarationType>final</v2.8:VehicleDeclarationType> </Vehicle> <ApplicationInformation> <SimulationToolVersion>0.7.3.2171-DEV</SimulationToolVersion> - <Date>2021-05-10T11:15:01.2883833Z</Date> + <Date>2021-05-17T07:22:26.5083903Z</Date> </ApplicationInformation> </Data> <Signature> - <di:Reference URI="#MST-8a622efa2f0145e684b7"> + <di:Reference URI="#MST-076becd8299f4cd6b7ed"> <di:Transforms> <di:Transform Algorithm="urn:vecto:xml:2017:canonicalization" /> <di:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /> </di:Transforms> <di:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256" /> - <di:DigestValue>Ikl36H/utDgp3JX2g/rJOWb3+GhUeJ4h90gVNz8IUQQ=</di:DigestValue> + <di:DigestValue>OuOo05XjBzDuVaiSHqbLWrQbHy5xdFaDCzNQnCLymYE=</di:DigestValue> </di:Reference> </Signature> </ManufacturingStage> -- GitLab