aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters
diff options
context:
space:
mode:
authorVictoria Plitt <Victoria.Plitt@twine-s.com>2023-04-18 20:25:46 +0300
committerVictoria Plitt <Victoria.Plitt@twine-s.com>2023-04-18 20:25:46 +0300
commit1133972c0c51feb478aa3944fad5f374a8a2da35 (patch)
treeaa02e09e89e5e80c918500dbe3d59ea2b5259248 /Software/Visual_Studio/PPC/Tango.PPC.UI/Converters
parent1c7f16c34f85dd65a02ad08dde984f04a4d82b83 (diff)
downloadTango-1133972c0c51feb478aa3944fad5f374a8a2da35.tar.gz
Tango-1133972c0c51feb478aa3944fad5f374a8a2da35.zip
Added connective icons and time to bottom of menu.
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/Converters')
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/ProgressLengthSpoolConverter.cs20
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/ProgressWeightSpoolConverter.cs67
2 files changed, 75 insertions, 12 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/ProgressLengthSpoolConverter.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/ProgressLengthSpoolConverter.cs
index 00473955b..3be7a8818 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/ProgressLengthSpoolConverter.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/ProgressLengthSpoolConverter.cs
@@ -15,13 +15,11 @@ namespace Tango.PPC.UI.Converters
{
try
{
- if (values.Count() == 4)
+ if (values.Count() == 2)
{
double length = System.Convert.ToDouble(values[0]);
- int spools = System.Convert.ToInt32(values[1]);
- int NumberOfUnits = System.Convert.ToInt32(values[2]);
- bool forOneSpool = System.Convert.ToBoolean(values[3]);
- var totalBy4Spools = (double)length* spools * NumberOfUnits/ 4;
+ bool forOneSpool = System.Convert.ToBoolean(values[1]);
+ var totalBy4Spools = (double)length*4;// spools ;
if (forOneSpool)
{
return (double)totalBy4Spools / 4;
@@ -29,16 +27,14 @@ namespace Tango.PPC.UI.Converters
return totalBy4Spools;
}
- if (values.Count() == 5)
+ if (values.Count() == 3)
{
double length = System.Convert.ToDouble(values[0]);
- int spools = System.Convert.ToInt32(values[1]);
- int NumberOfUnits = System.Convert.ToInt32(values[2]);
- bool forOneSpool = System.Convert.ToBoolean(values[3]);
- double currentProgresslength = System.Convert.ToDouble(values[4]) ;
+ bool forOneSpool = System.Convert.ToBoolean(values[1]);
+ double currentProgresslength = System.Convert.ToDouble(values[2]) ;
- var totalBy4Spools = (double)length * spools * NumberOfUnits / 4;
- var currentProgressBy4Spools = (double)currentProgresslength * spools ;
+ var totalBy4Spools = (double)length * 4;
+ var currentProgressBy4Spools = (double)currentProgresslength * 4 ;
int coeff = (int)currentProgressBy4Spools / (int)totalBy4Spools;
var progressCurrent = coeff == 0 ? currentProgressBy4Spools : currentProgressBy4Spools % (coeff * totalBy4Spools);//show for progress
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/ProgressWeightSpoolConverter.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/ProgressWeightSpoolConverter.cs
new file mode 100644
index 000000000..05a41912c
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/ProgressWeightSpoolConverter.cs
@@ -0,0 +1,67 @@
+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 ProgressWeightSpoolConverter : IMultiValueConverter
+ {
+ public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
+ {
+ try
+ {
+ if (values.Count() == 3)
+ {
+ double length = System.Convert.ToDouble(values[0]);
+ bool forOneSpool = System.Convert.ToBoolean(values[1]);
+ double coef = System.Convert.ToDouble(values[2]);
+ var totalBy4Spools = (double)length * 4;// spools ;
+
+ var weight = ((double)totalBy4Spools * coef) / (1000);//(g)
+ if (forOneSpool)
+ {
+ return (double)weight / 4;
+ }
+ return weight;
+
+ }
+ if (values.Count() == 4)
+ {
+ double length = System.Convert.ToDouble(values[0]);
+ bool forOneSpool = System.Convert.ToBoolean(values[1]);
+ double currentProgresslength = System.Convert.ToDouble(values[2]);
+ double coef = System.Convert.ToDouble(values[3]);
+
+ var totalBy4Spools = (double)length * 4;
+ var currentProgressBy4Spools = (double)currentProgresslength * 4;
+
+ int coeff = (int)currentProgressBy4Spools / (int)totalBy4Spools;
+ var progressCurrent = coeff == 0 ? currentProgressBy4Spools : currentProgressBy4Spools % (coeff * totalBy4Spools);//show for progress
+ var weight = ((double)progressCurrent * coef) / (1000);//(g)
+ if (forOneSpool)
+ {
+ return (double)weight / 4;
+
+ }
+ return weight;
+ }
+ return "-";
+ }
+ catch
+ {
+ return "-";
+ }
+ }
+
+ public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}