aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters
diff options
context:
space:
mode:
authorVictoria Plitt <Victoria.Plitt@twine-s.com>2023-03-29 17:51:32 +0300
committerVictoria Plitt <Victoria.Plitt@twine-s.com>2023-03-29 17:51:32 +0300
commitc61d12100372054de07f6201c27c7755c7be35e8 (patch)
treeeca0ada6201de7dd90a0227a8a06bc681060d2fb /Software/Visual_Studio/PPC/Tango.PPC.UI/Converters
parent0766ff8488c961c7f73eec50fb9ee64c89da5eb1 (diff)
downloadTango-c61d12100372054de07f6201c27c7755c7be35e8.tar.gz
Tango-c61d12100372054de07f6201c27c7755c7be35e8.zip
Eureka PPC. Added weight of job by length and RML.
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/Converters')
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/LengthToWeightConverter.cs35
1 files changed, 35 insertions, 0 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/LengthToWeightConverter.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/LengthToWeightConverter.cs
new file mode 100644
index 000000000..32ba01ad2
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/LengthToWeightConverter.cs
@@ -0,0 +1,35 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Data;
+
+namespace Tango.PPC.UI.Converters
+{
+ public class LengthToWeightConverter : IMultiValueConverter
+ {
+ public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
+ {
+ try
+ {
+ double length = System.Convert.ToDouble(values[0]);
+ double coef = System.Convert.ToDouble(values[1]);
+ var weight = ((double)length * coef) / (1000 * 1000);//(kg)
+
+ return weight;
+ }
+ catch
+ {
+ return 0d;
+ }
+ }
+
+ public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}