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.cs | 40 +++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml.cs') 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