From daea2a2dae0f0b8722b8645a0936a8e84d0af112 Mon Sep 17 00:00:00 2001
From: "harald.martini@student.tugraz.at" <harald.martini@student.tugraz.at>
Date: Mon, 10 May 2021 08:50:08 +0200
Subject: [PATCH] Changed display of square and cubic meter si,

removed background from AirdragView
---
 .gitignore                                    |  1 +
 .../Helper/Converter/SIToUnitString.cs        | 70 ++++++++++++-------
 .../Views/Multistage/AirDragView_v2_8.xaml    |  2 +-
 3 files changed, 47 insertions(+), 26 deletions(-)

diff --git a/.gitignore b/.gitignore
index c6bd82666d..a5db239d27 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 e84ca3d203..23cb170b8d 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 c42665b938..f09fcfaecd 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 
-- 
GitLab