From ea4957385f2d1a3da2a3a6f5e0db95ca624c8173 Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Thu, 1 Sep 2022 17:01:45 +0300 Subject: MS. RML Extension. Save White point. Related Work Items: #7130 --- .../ViewModels/ColorCalibrationViewVM.cs | 6 ++--- .../ViewModels/ColorCalibrationViewVM.cs | 4 ++-- .../ViewModels/ColorParametersVewVM.cs | 26 +++++++++++++++++----- .../ViewModels/MainViewVM.cs | 6 ++--- .../Views/ColorParametersView.xaml | 6 ++--- 5 files changed, 32 insertions(+), 16 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/ColorCalibrationViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/ColorCalibrationViewVM.cs index 30e17d6db..feee2637a 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/ColorCalibrationViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/ColorCalibrationViewVM.cs @@ -100,9 +100,9 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels } - private void OnChangeSelectedRML() + private async void OnChangeSelectedRML() { - Invalidate(); + await Invalidate(); } #region RML @@ -113,7 +113,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels { IsFree = false; - await Task.Factory.StartNew(() => + await Task.Run(() => { using (_notification.PushTaskItem("Loading RML data...")) { diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/ColorCalibrationViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/ColorCalibrationViewVM.cs index 2144d05f5..01c3b2d4f 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/ColorCalibrationViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/ColorCalibrationViewVM.cs @@ -223,7 +223,7 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels /// /// Applies calibration points to RML. /// - private void ApplyToRML(object obj) + private async void ApplyToRML(object obj) { if(SelectedTab != null && ActiveRML != null) { @@ -232,7 +232,7 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels { IsFree = false; DateTime lastUpdated = DateTime.UtcNow; - var rml = new RmlBuilder(_active_context).Set(ActiveRML.Guid).WithLiquidFactors().Build(); + var rml = await new RmlBuilder(_active_context).Set(ActiveRML.Guid).WithLiquidFactors().BuildAsync(); if (rml != null) { var liquidTypesRmls = rml.LiquidTypesRmls; diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/ColorParametersVewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/ColorParametersVewVM.cs index 2ab1f81f1..d784c69a9 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/ColorParametersVewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/ColorParametersVewVM.cs @@ -209,7 +209,7 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels OnRMLExtensionGUIDChanged(); } } - + protected string _selectedMachineGuid; /// /// Gets or sets the selected machine. @@ -431,8 +431,8 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels _active_context = ObservablesContext.CreateDefault(); - await Task.Factory.StartNew(() => - { + await Task.Run(async () => + { using (_notification.PushTaskItem("Loading Color Process Parameters ...")) { @@ -441,6 +441,7 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels { SelectedColorProcessParameter = new ColorProcessParametersBuilder(_active_context).Set(currentcolorProcessParameter.Guid).WithColorProcessData().WithColorProcessFactor().WithColorProcessInkUptake().Build(); } + if (SelectedColorProcessParameter == null) { @@ -448,6 +449,8 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels SelectedColorProcessParameter.WhitePointL = 0.0; SelectedColorProcessParameter.WhitePointA = 0.0; SelectedColorProcessParameter.WhitePointB = 0.0; + + SelectedColorProcessParameter.ColorProcessFactors.Add(new ColorProcessFactor() { FactorColor = FactorColors.CYAN, FactorPercent = 100, ColorProcessParametersGuid = SelectedColorProcessParameter.Guid }); SelectedColorProcessParameter.ColorProcessFactors.Add(new ColorProcessFactor() { FactorColor = FactorColors.MAGENTA, FactorPercent = 100, ColorProcessParametersGuid = SelectedColorProcessParameter.Guid }); SelectedColorProcessParameter.ColorProcessFactors.Add(new ColorProcessFactor() { FactorColor = FactorColors.YELLOW, FactorPercent = 100, ColorProcessParametersGuid = SelectedColorProcessParameter.Guid }); @@ -461,7 +464,7 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels SelectedColorProcessParameter.ColorProcessInkUptake.Add(new ColorProcessInkUptake() { InkUptakeZoneType = InkUptakeZoneTypes.MININKUPTAKEZONE2, ColorProcessParametersGuid = SelectedColorProcessParameter.Guid }); SelectedColorProcessParameter.ColorProcessInkUptake.Add(new ColorProcessInkUptake() { InkUptakeZoneType = InkUptakeZoneTypes.MAXINKUPTAKEZONE2, ColorProcessParametersGuid = SelectedColorProcessParameter.Guid }); _active_context.ColorProcessParameters.Add(SelectedColorProcessParameter); - _active_context.SaveChangesAsync(); + await _active_context.SaveChangesAsync(); } else if(SelectedColorProcessParameter.ColorProcessInkUptake.Count == 0) { @@ -470,7 +473,13 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels SelectedColorProcessParameter.ColorProcessInkUptake.Add(new ColorProcessInkUptake() { InkUptakeZoneType = InkUptakeZoneTypes.MININKUPTAKEZONE2, ColorProcessParametersGuid = SelectedColorProcessParameter.Guid }); SelectedColorProcessParameter.ColorProcessInkUptake.Add(new ColorProcessInkUptake() { InkUptakeZoneType = InkUptakeZoneTypes.MAXINKUPTAKEZONE2, ColorProcessParametersGuid = SelectedColorProcessParameter.Guid }); } - + var rml = await new RmlBuilder(_active_context).Set(RMLGUID).BuildAsync(); + if (rml != null && SelectedColorProcessParameter != null) + { + SelectedColorProcessParameter.WhitePointL = rml.WhitePointL; + SelectedColorProcessParameter.WhitePointA = rml.WhitePointA; + SelectedColorProcessParameter.WhitePointB = rml.WhitePointB; + } } }); @@ -775,6 +784,13 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels IsFree = false; SelectedColorProcessParameter.LastUpdated = DateTime.UtcNow; + var rml = await new RmlBuilder(_active_context).Set(RMLGUID).BuildAsync(); + if (rml != null) + { + rml.WhitePointL = SelectedColorProcessParameter.WhitePointL; + rml.WhitePointA = SelectedColorProcessParameter.WhitePointA; + rml.WhitePointB = SelectedColorProcessParameter.WhitePointB; + } foreach (var item in RemovedColorProcessDataBeforeSave) { diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/MainViewVM.cs index b2f3d99cf..458bc913a 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/MainViewVM.cs @@ -1069,11 +1069,11 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels - ActiveRML = new RmlBuilder(_active_context).Set(SelectedRMLExtension.RMLGuid).WithLiquidFactors().Build(); + ActiveRML = await new RmlBuilder(_active_context).Set(SelectedRMLExtension.RMLGuid).WithLiquidFactors().BuildAsync(); - ActiveRMLExtension = new RmlExtensionsBuilder(_active_context) + ActiveRMLExtension = await new RmlExtensionsBuilder(_active_context) .Set(guid) - .Build(); + .BuildAsync(); if (!String.IsNullOrEmpty(ActiveRML.Manufacturer) && false == Manufacturers.Any(x => x == ActiveRML.Manufacturer)) { diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/ColorParametersView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/ColorParametersView.xaml index 504bf0610..376392d89 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/ColorParametersView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/ColorParametersView.xaml @@ -335,13 +335,13 @@ White point - + - + - + -- cgit v1.3.1