From 941679fac898ab6c488674f611e157d5094a8c83 Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Wed, 23 Dec 2020 23:06:51 +0200 Subject: Fixed issue with machine studio job view performance. Added support for cct caching on RmlBuilder. --- .../Controls/JobSummeryViewer.xaml | 131 +++++++++++++++++++++ .../Controls/JobSummeryViewer.xaml.cs | 56 +++++++++ .../Tango.MachineStudio.Developer.csproj | 9 +- .../ViewModels/MainViewVM.cs | 13 +- .../Views/JobView.xaml | 74 +----------- .../Views/JobView.xaml.cs | 46 ++++---- 6 files changed, 229 insertions(+), 100 deletions(-) create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Controls/JobSummeryViewer.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Controls/JobSummeryViewer.xaml.cs (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Controls/JobSummeryViewer.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Controls/JobSummeryViewer.xaml new file mode 100644 index 000000000..eeb25dc83 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Controls/JobSummeryViewer.xaml @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Controls/JobSummeryViewer.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Controls/JobSummeryViewer.xaml.cs new file mode 100644 index 000000000..daa0d30cf --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Controls/JobSummeryViewer.xaml.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; +using Tango.BL.Entities; + +namespace Tango.MachineStudio.Developer.Controls +{ + /// + /// Represents a summary viewer control. + /// + /// + /// + public partial class JobSummeryViewer : UserControl + { + /// + /// Maybe not necessary! + /// + public bool IsActive + { + get { return (bool)GetValue(IsActiveProperty); } + set { SetValue(IsActiveProperty, value); } + } + public static readonly DependencyProperty IsActiveProperty = + DependencyProperty.Register("IsActive", typeof(bool), typeof(JobSummeryViewer), new PropertyMetadata(false)); + + /// + /// Gets or sets a value indicating whether to display summery markers. + /// + public bool DisplayMarkers + { + get { return (bool)GetValue(DisplayMarkersProperty); } + set { SetValue(DisplayMarkersProperty, value); } + } + public static readonly DependencyProperty DisplayMarkersProperty = + DependencyProperty.Register("DisplayMarkers", typeof(bool), typeof(JobSummeryViewer), new PropertyMetadata(true)); + + /// + /// Initializes a new instance of the class. + /// + public JobSummeryViewer() + { + InitializeComponent(); + } + } +} 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 012ed8d0d..3853e6763 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 @@ -103,6 +103,9 @@ GlobalVersionInfo.cs + + JobSummeryViewer.xaml + @@ -158,6 +161,10 @@ MSBuild:Compile Designer + + MSBuild:Compile + Designer + Designer MSBuild:Compile @@ -386,7 +393,7 @@ - + \ No newline at end of file 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 fc0680d9c..4cc41e5a7 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 @@ -91,6 +91,7 @@ namespace Tango.MachineStudio.Developer.ViewModels private JobDTO _beforeSaveJobDTO; private IActionLogManager _actionLogManager; private RmlDTO _selectedRMLBeforeLiquidFactorsSaves; + private List _cctCache; #region Properties @@ -757,6 +758,8 @@ namespace Tango.MachineStudio.Developer.ViewModels { _converter = new DefaultColorConverter(); + _cctCache = new List(); + CanWork = true; EnableColorConversion = true; @@ -1622,7 +1625,7 @@ namespace Tango.MachineStudio.Developer.ViewModels { LogManager.Log("Invalidating liquid factors, process parameters and process group history..."); - _selectedRML = new RmlBuilder(_activeJobDbContext).Set(SelectedRML.Guid).WithAllParametersGroup().WithCAT(SelectedMachine.Guid).WithCCT().WithLiquidFactors().WithSpools().Build(); + _selectedRML = new RmlBuilder(_activeJobDbContext).Set(SelectedRML).WithAllParametersGroup().WithCAT(SelectedMachine.Guid).WithCctCache(_cctCache).WithCCT().WithLiquidFactors().WithSpools().Build(); _selectedRMLBeforeLiquidFactorsSaves = RmlDTO.FromObservable(_selectedRML); @@ -1679,7 +1682,7 @@ namespace Tango.MachineStudio.Developer.ViewModels InvalidateLiquidFactorsAndProcessTables(); } catch - {} + { } finally { IsFree = true; @@ -1867,7 +1870,7 @@ namespace Tango.MachineStudio.Developer.ViewModels _activeJobDbContext.Spools.Where(x => x.MachineGuid == SelectedMachine.Guid).Load(); LogManager.Log("Setting active job..."); - ActiveJob = new JobBuilder(_activeJobDbContext).Set(SelectedMachineJob.Guid).WithUser().WithSegments().WithBrushStops().WithConfiguration().WithRML().Build(); + ActiveJob = new JobBuilder(_activeJobDbContext).Set(SelectedMachineJob.Guid).WithUser().WithSegments().WithBrushStops().WithConfiguration().WithRML(_cctCache).Build(); //_activeJobDbContext.Ccts.Where(x => x.RmlGuid == ActiveJob.RmlGuid).ToList(); //_activeJobDbContext.Cats.Where(x => x.RmlGuid == ActiveJob.RmlGuid).ToList(); @@ -2332,7 +2335,7 @@ namespace Tango.MachineStudio.Developer.ViewModels } SelectedSegment.BrushStops.Remove(x); var existingBrushStop = _activeJobDbContext.BrushStops.FirstOrDefault(y => y.Guid == x.Guid); - if(existingBrushStop != null) + if (existingBrushStop != null) { _activeJobDbContext.BrushStops.Remove(existingBrushStop); } @@ -2372,7 +2375,7 @@ namespace Tango.MachineStudio.Developer.ViewModels stop.SetAllDispensingStepDivisions(BL.Dispensing.DispenserStepDivisions.D8); stop.SetLiquidVolumes(SelectedMachine.Configuration, SelectedRML, SelectedProcessParametersTable); SelectedSegment.BrushStops.Add(stop); - // _activeJobDbContext.BrushStops.Add(stop); + // _activeJobDbContext.BrushStops.Add(stop); SelectedSegment.BrushStops.ToList().ForEach(x => x.RaiseOffsetChanged()); ArrangeBrushStopsIndices(); } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml index 32b7ccd86..395809c6f 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml @@ -27,6 +27,7 @@ xmlns:shapes="clr-namespace:Tango.SharedUI.Shapes;assembly=Tango.SharedUI" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Tango.MachineStudio.Developer.Views" + xmlns:localControls="clr-namespace:Tango.MachineStudio.Developer.Controls" mc:Ignorable="d" d:DesignHeight="1080" d:DesignWidth="1920" Background="Transparent" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}" x:Name="control"> @@ -1320,78 +1321,9 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - x - - - - - - - - - - - + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml.cs index 94c1ed802..6e9c62e74 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml.cs @@ -64,29 +64,29 @@ namespace Tango.MachineStudio.Developer.Views { if (_vm != null && _vm.ActiveJob != null) { - List segments = new List(); - foreach (var s in _vm.ActiveJob.OrderedSegments) - { - segments.Add(s); - - if (_vm.ActiveJob.EnableInterSegment && _vm.ActiveJob.OrderedSegments.IndexOf(s) != _vm.ActiveJob.OrderedSegments.Count - 1) - { - segments.Add(new Segment() - { - Length = _vm.ActiveJob.InterSegmentLength, - BrushStops = new SynchronizedObservableCollection() - { - new BrushStop() - { - ColorSpace = new ColorSpace(), - Color = Colors.White, - } - }, - }); - } - } - - jobBrushList.ItemsSource = segments; + //List segments = new List(); + //foreach (var s in _vm.ActiveJob.OrderedSegments) + //{ + // segments.Add(s); + + // if (_vm.ActiveJob.EnableInterSegment && _vm.ActiveJob.OrderedSegments.IndexOf(s) != _vm.ActiveJob.OrderedSegments.Count - 1) + // { + // segments.Add(new Segment() + // { + // Length = _vm.ActiveJob.InterSegmentLength, + // BrushStops = new SynchronizedObservableCollection() + // { + // new BrushStop() + // { + // ColorSpace = new ColorSpace(), + // Color = Colors.White, + // } + // }, + // }); + // } + //} + + //jobBrushList.ItemsSource = segments; UpdateGradientBrushDisplay(); } } -- cgit v1.3.1