diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-02-01 11:39:19 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-02-01 11:39:19 +0200 |
| commit | 06ad24ef8a414fc89c0cf42b9f5264d584292afe (patch) | |
| tree | 7bbe6eadb54d21996aba8d50855137ce20750578 /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters | |
| parent | f573292928d08acbf04acb8ea74f55f7561390a0 (diff) | |
| download | Tango-06ad24ef8a414fc89c0cf42b9f5264d584292afe.tar.gz Tango-06ad24ef8a414fc89c0cf42b9f5264d584292afe.zip | |
Improved RequestShutDown Mechanism on machine studio UI implementation.
Fixed issue with job brush markers visibility.
Implemented Job Progress Indicator.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters')
3 files changed, 88 insertions, 7 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/JobProgressToPositionConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/JobProgressToPositionConverter.cs new file mode 100644 index 000000000..9865b26f8 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/JobProgressToPositionConverter.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; +using Tango.Integration.Observables; + +namespace Tango.MachineStudio.Developer.Converters +{ + public class JobProgressToPositionConverter : IMultiValueConverter + { + public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + { + try + { + Job job = values[0] as Job; + + if (job != null) + { + double progress = System.Convert.ToDouble(values[1]); + double parentElementWidth = System.Convert.ToDouble(values[2]); + + return (progress / job.Length) * parentElementWidth; + } + 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/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/ObjectsNotEqualToBooleanConveter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/ObjectsNotEqualToBooleanConveter.cs new file mode 100644 index 000000000..15bfd6add --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/ObjectsNotEqualToBooleanConveter.cs @@ -0,0 +1,30 @@ +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.MachineStudio.Developer.Converters +{ + public class ObjectsNotEqualToBooleanConveter : IMultiValueConverter + { + public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + { + try + { + return (values[0] != values[1]); + } + catch + { + return true; + } + } + + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/SegmentLengthToWidthConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/SegmentLengthToWidthConverter.cs index 959fb6410..b632d9d12 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/SegmentLengthToWidthConverter.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/SegmentLengthToWidthConverter.cs @@ -19,21 +19,29 @@ namespace Tango.MachineStudio.Developer.Converters if (values.Length == 4) { Job job = values[0] as Job; - 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; + 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 0; + return 0d; } } catch { - return 0; + return 0d; } } |
