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 +++ .../Tango.MachineStudio.Developer.csproj | 1 + .../ViewModels/MainViewVM.cs | 4 + .../Views/MainView.xaml | 413 +++++++++++---------- 4 files changed, 272 insertions(+), 200 deletions(-) create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/BrushStopToOffsetLimitConverter.cs (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer') 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(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj index 47604e64d..5bae48c1a 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj @@ -74,6 +74,7 @@ + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs index a3be7a2d6..5a1b46041 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs @@ -593,6 +593,10 @@ namespace Tango.MachineStudio.Developer.ViewModels /// The dropped stop. public void OnDropBrushStop(BrushStop draggedStop, BrushStop droppedStop) { + int tmpIndex = draggedStop.StopIndex; + draggedStop.StopIndex = droppedStop.StopIndex; + droppedStop.StopIndex = tmpIndex; + SelectedSegment.BrushStops.Swap(draggedStop, droppedStop); } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml index 9c761309c..90842b672 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml @@ -36,6 +36,7 @@ + @@ -123,16 +124,14 @@ - - - - - - - - - - - - - - - Color Space - - + + + + + + + + + + + + + + + + + + + Color Space - - - - - - + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.3.1