From 26ab24349861999cef4def86ed92da54cba2fc68 Mon Sep 17 00:00:00 2001 From: Roy Date: Tue, 30 Jan 2018 00:24:58 +0200 Subject: Added BrushStop Index... --- .../Converters/BrushStopToOffsetLimitConverter.cs | 54 ++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/BrushStopToOffsetLimitConverter.cs (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/BrushStopToOffsetLimitConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/BrushStopToOffsetLimitConverter.cs new file mode 100644 index 000000000..c18a5679b --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/BrushStopToOffsetLimitConverter.cs @@ -0,0 +1,54 @@ +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.DAL.Observables; + +namespace Tango.MachineStudio.Developer.Converters +{ + public class BrushStopToOffsetLimitConverter : IMultiValueConverter + { + public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + { + try + { + BrushStop stop = values[0] as BrushStop; + Segment segment = values[1] as Segment; + String sign = parameter.ToString(); + + if (stop != null && segment != null) + { + + if (segment.BrushStops.IndexOf(stop) == segment.BrushStops.Count - 1) + { + return 100d; + } + else if (segment.BrushStops.IndexOf(stop) == 0) + { + return 0d; + } + else + { + return sign == "min" ? 0 : 100d; + } + } + else + { + return 100; + } + } + catch + { + return 100d; + } + } + + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} -- cgit v1.3.1