diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-06-26 13:54:56 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-06-26 13:54:56 +0300 |
| commit | 3c76016cff1a5e5d9c2ad270a954056e77ea9ce8 (patch) | |
| tree | c800bfea49b6e3aebcb6b9f0b968724a519d72e4 /Software/Visual_Studio/Tango.SharedUI/Converters | |
| parent | af19a5785e20b8ca742038e7213ddbf2a2d9cd87 (diff) | |
| download | Tango-3c76016cff1a5e5d9c2ad270a954056e77ea9ce8.tar.gz Tango-3c76016cff1a5e5d9c2ad270a954056e77ea9ce8.zip | |
Fixed issue on numeric text input.
Updated machine studio update service to accept hashed passwords..
Added Job summery to job view.
Diffstat (limited to 'Software/Visual_Studio/Tango.SharedUI/Converters')
3 files changed, 102 insertions, 0 deletions
diff --git a/Software/Visual_Studio/Tango.SharedUI/Converters/OneToPercentConverter.cs b/Software/Visual_Studio/Tango.SharedUI/Converters/OneToPercentConverter.cs new file mode 100644 index 000000000..1aaf8a873 --- /dev/null +++ b/Software/Visual_Studio/Tango.SharedUI/Converters/OneToPercentConverter.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; + +namespace Tango.SharedUI.Converters +{ + public class OneToPercentConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + return System.Convert.ToDouble(value) * 100d; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return System.Convert.ToDouble(value) / 100d; + } + } +} diff --git a/Software/Visual_Studio/Tango.SharedUI/Converters/SegmentLengthToWidthConverter.cs b/Software/Visual_Studio/Tango.SharedUI/Converters/SegmentLengthToWidthConverter.cs new file mode 100644 index 000000000..64699e053 --- /dev/null +++ b/Software/Visual_Studio/Tango.SharedUI/Converters/SegmentLengthToWidthConverter.cs @@ -0,0 +1,53 @@ +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; +using Tango.BL.Entities; + +namespace Tango.SharedUI.Converters +{ + public class SegmentLengthToWidthConverter : IMultiValueConverter + { + public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + { + try + { + if (values.Length == 4) + { + Job job = values[0] as Job; + + if (job != null && values[1] is double) + { + double jobLength = System.Convert.ToDouble(values[1]); + double elementWidth = System.Convert.ToDouble(values[2]); + double segmentLength = System.Convert.ToDouble(values[3]); + double totalLength = job.Length; + + return (segmentLength / totalLength) * elementWidth; + } + else + { + return 0d; + } + } + else + { + return 0d; + } + } + catch + { + return 0d; + } + } + + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/Tango.SharedUI/Converters/WidthHeightToRectConverter.cs b/Software/Visual_Studio/Tango.SharedUI/Converters/WidthHeightToRectConverter.cs new file mode 100644 index 000000000..25d7c7579 --- /dev/null +++ b/Software/Visual_Studio/Tango.SharedUI/Converters/WidthHeightToRectConverter.cs @@ -0,0 +1,26 @@ +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.SharedUI.Converters +{ + public class WidthHeightToRectConverter : IMultiValueConverter + { + public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + { + double width = (double)values[0]; + double height = (double)values[1]; + return new Rect(new Size(width, height)); + } + + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} |
