From 80c023fa734d7788e155d4f311ab16220aa80650 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Wed, 31 Jan 2018 13:30:15 +0200 Subject: Job Brush working nicely. --- .../Views/MainView.xaml | 97 ++++++++++++++++------ .../Views/MainView.xaml.cs | 37 ++++++++- 2 files changed, 109 insertions(+), 25 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 e0786a1ba..0c3cd62b5 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 @@ -40,6 +40,8 @@ + + @@ -232,15 +234,34 @@ - - + + + + + - - + + - + + + + @@ -305,8 +326,8 @@ - - + + @@ -448,7 +469,7 @@ - + @@ -549,7 +570,7 @@ Length - + @@ -952,7 +973,7 @@ ESTIMATED DURATION: - 00:00:00 + @@ -969,12 +990,12 @@ - - - + + + - + @@ -990,22 +1011,50 @@ - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 c76cf657f..143280e66 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 @@ -16,6 +16,7 @@ using Tango.Integration.Observables; using Tango.DragAndDrop; using Tango.MachineStudio.Developer.Converters; using Tango.MachineStudio.Developer.ViewModels; +using System.Windows.Threading; namespace Tango.MachineStudio.Developer.Views { @@ -25,6 +26,7 @@ namespace Tango.MachineStudio.Developer.Views public partial class MainView : UserControl { private MainViewVM _vm; + private DispatcherTimer _jobBrushTimer; public DraggingSurface DraggingSurface { @@ -46,6 +48,40 @@ namespace Tango.MachineStudio.Developer.Views chkGraphs.Checked += (x, y) => { graphRowDefinition.Height = new GridLength(440, GridUnitType.Pixel); }; chkGraphs.Unchecked += (x, y) => { graphRowDefinition.Height = new GridLength(80, GridUnitType.Pixel); }; + + _jobBrushTimer = new DispatcherTimer(); + _jobBrushTimer.Interval = TimeSpan.FromSeconds(1); + _jobBrushTimer.Tick += _jobBrushTimer_Tick; + _jobBrushTimer.Start(); + } + + private void _jobBrushTimer_Tick(object sender, EventArgs e) + { + if (_vm != null && _vm.SelectedJob != null) + { + List segments = new List(); + foreach (var s in _vm.SelectedJob.Segments) + { + segments.Add(s); + + if (_vm.SelectedJob.EnableInterSegment && _vm.SelectedJob.Segments.IndexOf(s) != _vm.SelectedJob.Segments.Count - 1) + { + segments.Add(new Segment() + { + Length = _vm.SelectedJob.InterSegmentLength, + BrushStops = new System.Collections.ObjectModel.ObservableCollection() + { + new BrushStop() + { + Color = Colors.White, + } + }, + }); + } + } + + jobBrushList.ItemsSource = segments; + } } private void OnDropAvailableSensor(object sender, DropEventArgs e) @@ -73,7 +109,6 @@ namespace Tango.MachineStudio.Developer.Views SegmentToGradientStopsConverter converter = new SegmentToGradientStopsConverter(); GradientStopCollection stops = converter.Convert(_vm.SelectedSegment, null, null, null) as GradientStopCollection; gradientBrush.GradientStops = stops; - jobBrushList.UpdateLayout(); } else { -- cgit v1.3.1