diff options
| author | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2022-09-01 17:01:45 +0300 |
|---|---|---|
| committer | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2022-09-01 17:01:45 +0300 |
| commit | ea4957385f2d1a3da2a3a6f5e0db95ca624c8173 (patch) | |
| tree | 65793184c7ab0d417e49f443b24df93c884378a2 /Software/Visual_Studio | |
| parent | 13e76d80896d61c476ff755a892c795ed4af6de6 (diff) | |
| download | Tango-ea4957385f2d1a3da2a3a6f5e0db95ca624c8173.tar.gz Tango-ea4957385f2d1a3da2a3a6f5e0db95ca624c8173.zip | |
MS. RML Extension. Save White point.
Related Work Items: #7130
Diffstat (limited to 'Software/Visual_Studio')
5 files changed, 32 insertions, 16 deletions
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 /// <summary> /// Applies calibration points to RML. /// </summary> - 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; /// <summary> /// 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 @@ <TextBlock FontSize="12" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="10 0 0 0" Foreground="{StaticResource GrayBrush200}">White point</TextBlock> </Border> <Border BorderThickness="1 1 0 0" Background="Transparent" BorderBrush="{StaticResource BorderBrushGainsboro}"> - <mahapps:NumericUpDown Minimum="-500" Maximum="500" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" HideUpDownButtons="True" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Left" Value="{Binding Path=DataContext.ActiveRML.WhitePointL, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}" FontSize="14" Margin="10 0 0 0"></mahapps:NumericUpDown> + <mahapps:NumericUpDown Minimum="0" Maximum="100" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" HideUpDownButtons="True" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Left" Value="{Binding Path= WhitePointL, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="14" Margin="10 0 0 0"></mahapps:NumericUpDown> </Border> <Border BorderThickness="1 1 0 0" Background="Transparent" BorderBrush="{StaticResource BorderBrushGainsboro}"> - <mahapps:NumericUpDown Minimum="-500" Maximum="500" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" HideUpDownButtons="True" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Left" Value="{Binding Path=DataContext.ActiveRML.WhitePointA,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}" FontSize="14" Margin="10 0 0 0"></mahapps:NumericUpDown> + <mahapps:NumericUpDown Minimum="-128" Maximum="127" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" HideUpDownButtons="True" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Left" Value="{Binding Path= WhitePointA,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="14" Margin="10 0 0 0"></mahapps:NumericUpDown> </Border> <Border BorderThickness="1 1 0 0" Background="Transparent" BorderBrush="{StaticResource BorderBrushGainsboro}"> - <mahapps:NumericUpDown Minimum="-500" Maximum="500" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" HideUpDownButtons="True" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Left" Value="{Binding Path=DataContext.ActiveRML.WhitePointB,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}" FontSize="14" Margin="10 0 0 0"></mahapps:NumericUpDown> + <mahapps:NumericUpDown Minimum="-128" Maximum="127" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" HideUpDownButtons="True" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Left" Value="{Binding Path=WhitePointB,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="14" Margin="10 0 0 0"></mahapps:NumericUpDown> </Border> </UniformGrid> </Border> |
