From 5cda8b0a3ab579dd6f33b1cb19a1d295dc661d28 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Mon, 29 Jan 2018 18:45:10 +0200 Subject: Added gradient display of color Brush Stops. --- .../Views/MainView.xaml | 514 ++++++++++++--------- .../Views/MainView.xaml.cs | 40 +- 2 files changed, 329 insertions(+), 225 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views') 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 73c00fea8..9c761309c 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 @@ -19,7 +19,7 @@ xmlns:shapes="clr-namespace:Tango.SharedUI.Shapes;assembly=Tango.SharedUI" xmlns:local="clr-namespace:Tango.MachineStudio.Developer.Views" mc:Ignorable="d" - d:DesignHeight="1080" d:DesignWidth="1920" Background="White" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=True}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> + d:DesignHeight="1080" d:DesignWidth="1920" Background="White" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> + + + + @@ -295,7 +342,7 @@ - + @@ -448,7 +495,7 @@ - + @@ -503,10 +550,18 @@ - - - SEGMENT BRUSH - + + + + SEGMENT BRUSH + + + + + + + + @@ -516,224 +571,203 @@ - - - - - - - - - - - - - - - - - - Color Space + + + + + + + + + + + + + + + + + + + Color Space + + - + + + + + + - - - - - - - - - - - + + + + + @@ -821,6 +855,7 @@ + @@ -940,7 +975,37 @@ Show Graphs - + + + + + + + MONITORING @@ -1113,5 +1178,6 @@ + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml.cs index c4e853433..52febe37b 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml.cs @@ -14,6 +14,7 @@ using System.Windows.Navigation; using System.Windows.Shapes; using Tango.DAL.Observables; using Tango.DragAndDrop; +using Tango.MachineStudio.Developer.Converters; using Tango.MachineStudio.Developer.ViewModels; namespace Tango.MachineStudio.Developer.Views @@ -43,7 +44,7 @@ namespace Tango.MachineStudio.Developer.Views _vm = DataContext as MainViewVM; }; - chkGraphs.Checked += (x, y) => { graphRowDefinition.Height = new GridLength(161, GridUnitType.Star); }; + chkGraphs.Checked += (x, y) => { graphRowDefinition.Height = new GridLength(440, GridUnitType.Pixel); }; chkGraphs.Unchecked += (x, y) => { graphRowDefinition.Height = new GridLength(80, GridUnitType.Pixel); }; } @@ -54,5 +55,42 @@ namespace Tango.MachineStudio.Developer.Views _vm.OnDropAvailableSensor(e.Draggable.DataContext as Sensor); } } + + private void ColorPickerCombo_SelectedColorChanged(object sender, RoutedPropertyChangedEventArgs e) + { + UpdateGradientBrushDisplay(); + } + + private void Offset_Slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs e) + { + UpdateGradientBrushDisplay(); + } + + private void UpdateGradientBrushDisplay() + { + if (_vm.SelectedSegment != null) + { + SegmentToGradientStopsConverter converter = new SegmentToGradientStopsConverter(); + GradientStopCollection stops = converter.Convert(_vm.SelectedSegment, null, null, null) as GradientStopCollection; + gradientBrush.GradientStops = stops; + } + else + { + gradientBrush.GradientStops = new GradientStopCollection(); + } + } + + private void OnBrushStopBorderDrop(object sender, DropEventArgs e) + { + if (e.Draggable.DataContext is BrushStop) + { + _vm.OnDropBrushStop(e.Draggable.DataContext as BrushStop, e.Droppable.DataContext as BrushStop); + } + } + + private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + UpdateGradientBrushDisplay(); + } } } -- cgit v1.3.1