diff --git a/.gitignore b/.gitignore index c6bd82666dc58816bf38a74bb24c6c789340fe7c..a5db239d276f18d59dd1c4ad912650da92e797c3 100644 --- a/.gitignore +++ b/.gitignore @@ -211,3 +211,4 @@ Documentation/VehiclesReleaseComparisonDeclarationMode/tmp/ .vs/ **/dev/*.vmod **/dev/*.vsum +/VectoCore/VectoCoreTest/TestData/XML/XMLReaderDeclaration/testVif.VIF_Report_5.xml diff --git a/VECTO3GUI2020/Helper/Converter/SIToUnitString.cs b/VECTO3GUI2020/Helper/Converter/SIToUnitString.cs index e84ca3d203839d0a38fa95912f4147b313097975..23cb170b8d864236c93d0776fc229da8718df7f5 100644 --- a/VECTO3GUI2020/Helper/Converter/SIToUnitString.cs +++ b/VECTO3GUI2020/Helper/Converter/SIToUnitString.cs @@ -9,38 +9,34 @@ namespace VECTO3GUI2020.Helper.Converter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { - if (value == null) { + var unitString = getUnitString(value); + if (unitString != null) { + unitString = unitString.Replace("^2", ((char)0xB2).ToString()); + unitString = unitString.Replace("^3", ((char)0xB3).ToString()); + return unitString; + } else { return Binding.DoNothing; } + //if (value == null) { + // return Binding.DoNothing; + //} - if(value is SI SIValue) - { - if (SIValue.UnitString == "1/s") - { - return "rpm"; - } - return SIValue.UnitString; - } - if (value is ConvertedSI convertedSI) { - return convertedSI.Units; - } + // if(value is SI SIValue) + // { + // if (SIValue.UnitString == "1/s") + // { + // return "rpm"; + // } + // return SIValue.UnitString; + // } - return Binding.DoNothing; + //if (value is ConvertedSI convertedSI) { + // return convertedSI.Units; + //} - //TRY GET DYNAMIC UNIT STRING - try { - dynamic type = value?.GetType(); - if (type == null) { - return Binding.DoNothing; - } - - var unitString = type.GetUnitString(); - return unitString; - } catch (Exception e){ - return Binding.DoNothing; - } + //return Binding.DoNothing; } @@ -48,5 +44,29 @@ namespace VECTO3GUI2020.Helper.Converter { throw new NotImplementedException(); } + + private string getUnitString(object value) + { + if (value == null) { + return null; + } + + + if (value is SI SIValue) + { + if (SIValue.UnitString == "1/s") + { + return "rpm"; + } + return SIValue.UnitString; + } + + if (value is ConvertedSI convertedSI) + { + return convertedSI.Units; + } + + return null; + } } } diff --git a/VECTO3GUI2020/Views/Multistage/AirDragView_v2_8.xaml b/VECTO3GUI2020/Views/Multistage/AirDragView_v2_8.xaml index c42665b938a87b8d48b7ae9917b6d75788b01097..f09fcfaecd01282da28029b2559b740a029aaecc 100644 --- a/VECTO3GUI2020/Views/Multistage/AirDragView_v2_8.xaml +++ b/VECTO3GUI2020/Views/Multistage/AirDragView_v2_8.xaml @@ -7,7 +7,7 @@ xmlns:customControls="clr-namespace:VECTO3GUI2020.Views.Multistage.CustomControls" xmlns:implementation="clr-namespace:VECTO3GUI2020.ViewModel.Implementation.JobEdit.Vehicle.Components" d:DataContext="{d:DesignInstance Type=implementation:AirDragViewModel_v2_8}" mc:Ignorable="d" - d:DesignHeight="450" d:DesignWidth="800" Background="BlueViolet"> + d:DesignHeight="450" d:DesignWidth="800"> <Grid> <StackPanel> <Label