diff options
5 files changed, 25 insertions, 77 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialogVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialogVM.cs index b24611796..89b44d175 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialogVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialogVM.cs @@ -810,36 +810,10 @@ namespace Tango.PPC.Jobs.Dialogs BrushStopModel.PreventPropertyUpdate = true; BrushStopModel.LiquidVolumes.ResetVolume(); - var cyanVolume = BrushStopModel.LiquidVolumes.FindLiquidVolumeForCatalog("cyan"); - if (cyanVolume != null) cyanVolume.Volume = brushstop.ColorCatalogsItem.Cyan; - - var magentaVolume = BrushStopModel.LiquidVolumes.FindLiquidVolumeForCatalog("magenta"); - if (magentaVolume != null) magentaVolume.Volume = brushstop.ColorCatalogsItem.Magenta; - - var yellowVolume = BrushStopModel.LiquidVolumes.FindLiquidVolumeForCatalog("yellow"); - if (yellowVolume != null) yellowVolume.Volume = brushstop.ColorCatalogsItem.Yellow; - - var blackVolume = BrushStopModel.LiquidVolumes.FindLiquidVolumeForCatalog("black"); - if (blackVolume != null) blackVolume.Volume = brushstop.ColorCatalogsItem.Black; - - var blueVolume = BrushStopModel.LiquidVolumes.FindLiquidVolumeForCatalog("blue"); - if (blueVolume != null) blueVolume.Volume = brushstop.ColorCatalogsItem.Blue; - - var navyVolume = BrushStopModel.LiquidVolumes.FindLiquidVolumeForCatalog("navy"); - if (navyVolume != null) navyVolume.Volume = brushstop.ColorCatalogsItem.NavyExtra; - - var orangeVolume = BrushStopModel.LiquidVolumes.FindLiquidVolumeForCatalog("orange"); - if (orangeVolume != null) orangeVolume.Volume = brushstop.ColorCatalogsItem.OrangeExtra; - - var redVolume = BrushStopModel.LiquidVolumes.FindLiquidVolumeForCatalog("red"); - if (redVolume != null) redVolume.Volume = brushstop.ColorCatalogsItem.RedExtra; - - var rubineVolume = BrushStopModel.LiquidVolumes.FindLiquidVolumeForCatalog("rubine"); - if (rubineVolume != null) rubineVolume.Volume = brushstop.ColorCatalogsItem.RubineExtra; - - var violetVolume = BrushStopModel.LiquidVolumes.FindLiquidVolumeForCatalog("violet"); - if (violetVolume != null) violetVolume.Volume = brushstop.ColorCatalogsItem.VioletExtra; - + foreach (var liquidVolume in BrushStopModel.LiquidVolumes.Where(x => x.IdsPack.LiquidType.AvailableForStandardUser)) + { + liquidVolume.Volume = brushstop.ColorCatalogsItem.GetLiquidVolumeByName(liquidVolume.IdsPack.LiquidType.DisplayName); + } BrushStopModel.PreventPropertyUpdate = false; IsOnlyManual = false; diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs index dd82d8d1a..ad3dc60e9 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs @@ -1352,16 +1352,11 @@ namespace Tango.PPC.Jobs.Models { LiquidVolumes.ResetVolumeSilent(); - LiquidVolumes.FindLiquidVolumeForCatalog("cyan")?.SetVolumeSilent(ColorCatalogsItem.Cyan); - LiquidVolumes.FindLiquidVolumeForCatalog("magenta")?.SetVolumeSilent(ColorCatalogsItem.Magenta); - LiquidVolumes.FindLiquidVolumeForCatalog("yellow")?.SetVolumeSilent(ColorCatalogsItem.Yellow); - LiquidVolumes.FindLiquidVolumeForCatalog("black")?.SetVolumeSilent(ColorCatalogsItem.Black); - LiquidVolumes.FindLiquidVolumeForCatalog("blue")?.SetVolumeSilent(ColorCatalogsItem.BlueExtra); - LiquidVolumes.FindLiquidVolumeForCatalog("navy")?.SetVolumeSilent(ColorCatalogsItem.NavyExtra); - LiquidVolumes.FindLiquidVolumeForCatalog("orange")?.SetVolumeSilent(ColorCatalogsItem.OrangeExtra); - LiquidVolumes.FindLiquidVolumeForCatalog("red")?.SetVolumeSilent(ColorCatalogsItem.RedExtra); - LiquidVolumes.FindLiquidVolumeForCatalog("rubine")?.SetVolumeSilent(ColorCatalogsItem.RubineExtra); - LiquidVolumes.FindLiquidVolumeForCatalog("violet")?.SetVolumeSilent(ColorCatalogsItem.VioletExtra); + foreach (var liquidVolume in LiquidVolumes.Where(x => x.IdsPack.LiquidType.AvailableForStandardUser)) + { + liquidVolume.SetVolumeSilent(ColorCatalogsItem.GetLiquidVolumeByName(liquidVolume.IdsPack.LiquidType.DisplayName)); + } + LiquidVolumes.RaiseVolume(); IsOutOfGamut = false; // RaisePropertyChanged(nameof(IsLiquidVolumesOutOfRange)); diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/LiquidVolumesCollection.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/LiquidVolumesCollection.cs index 8eaae4452..704fc36b0 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/LiquidVolumesCollection.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/LiquidVolumesCollection.cs @@ -43,12 +43,6 @@ namespace Tango.PPC.Jobs.Models return this.FirstOrDefault(x => x.IdsPack.LiquidType.Type == (LiquidTypes)type); } - public LiquidVolumeModel FindLiquidVolumeForCatalog(String name) - { - var volume = this.Where(x => x.IdsPack.LiquidType.HasPigment && !x.IdsPack.LiquidType.IsLightInk).FirstOrDefault(x => x.IdsPack.LiquidType.Type.ToString().ToLower().Contains(name.ToLower())); - return volume; - } - public void Undo() { this.ToList().ForEach(x => x.Undo()); diff --git a/Software/Visual_Studio/Tango.BL/Entities/BrushStop.cs b/Software/Visual_Studio/Tango.BL/Entities/BrushStop.cs index b26576647..857640c04 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/BrushStop.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/BrushStop.cs @@ -684,37 +684,10 @@ namespace Tango.BL.Entities { if (LiquidVolumes != null) { - var noneLightLiquidVolumes = LiquidVolumes.Where(x => !x.IdsPack.LiquidType.IsLightInk && x.IdsPack.LiquidType.HasPigment).ToList(); - - var cyan = noneLightLiquidVolumes.FirstOrDefault(x => x.LiquidType.ToString().ToLower().Contains("cyan")); - if (cyan != null) cyan.Volume = ColorCatalogsItem.Cyan; - - var magenta = noneLightLiquidVolumes.FirstOrDefault(x => x.LiquidType.ToString().ToLower().Contains("magenta")); - if (magenta != null) magenta.Volume = ColorCatalogsItem.Magenta; - - var yellow = noneLightLiquidVolumes.FirstOrDefault(x => x.LiquidType.ToString().ToLower().Contains("yellow")); - if (yellow != null) yellow.Volume = ColorCatalogsItem.Yellow; - - var black = noneLightLiquidVolumes.FirstOrDefault(x => x.LiquidType.ToString().ToLower().Contains("black")); - if (black != null) black.Volume = ColorCatalogsItem.Black; - - var blue = noneLightLiquidVolumes.FirstOrDefault(x => x.LiquidType.ToString().ToLower().Contains("blue")); - if (blue != null) blue.Volume = ColorCatalogsItem.BlueExtra; - - var navy = noneLightLiquidVolumes.FirstOrDefault(x => x.LiquidType.ToString().ToLower().Contains("navy")); - if (navy != null) navy.Volume = ColorCatalogsItem.NavyExtra; - - var orange = noneLightLiquidVolumes.FirstOrDefault(x => x.LiquidType.ToString().ToLower().Contains("orange")); - if (orange != null) orange.Volume = ColorCatalogsItem.OrangeExtra; - - var red = noneLightLiquidVolumes.FirstOrDefault(x => x.LiquidType.ToString().ToLower().Contains("red")); - if (red != null) red.Volume = ColorCatalogsItem.RedExtra; - - var rubine = noneLightLiquidVolumes.FirstOrDefault(x => x.LiquidType.ToString().ToLower().Contains("rubine")); - if (rubine != null) red.Volume = ColorCatalogsItem.RubineExtra; - - var violet = noneLightLiquidVolumes.FirstOrDefault(x => x.LiquidType.ToString().ToLower().Contains("violet")); - if (violet != null) violet.Volume = ColorCatalogsItem.VioletExtra; + foreach (var liquidVolume in LiquidVolumesOrderedPigmentedForStandardUser.ToList()) + { + liquidVolume.Volume = ColorCatalogsItem.GetLiquidVolumeByName(liquidVolume.IdsPack.LiquidType.DisplayName); + } } } catch (Exception ex) diff --git a/Software/Visual_Studio/Tango.BL/Entities/ColorCatalogsItem.cs b/Software/Visual_Studio/Tango.BL/Entities/ColorCatalogsItem.cs index 3911d0189..9c87e1296 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/ColorCatalogsItem.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/ColorCatalogsItem.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations.Schema; using System.Linq; +using System.Reflection; using System.Text; using System.Threading.Tasks; using System.Windows.Media; @@ -50,5 +51,16 @@ namespace Tango.BL.Entities context.ColorCatalogsItems.Remove(this); } + + public double GetLiquidVolumeByName(String liquidTypeDisplayName) + { + var prop = this.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public).FirstOrDefault(x => x.Name.ToLower().StartsWith(liquidTypeDisplayName.ToLower())); + if (prop != null) + { + return (double)prop.GetValue(this); + } + + return 0; + } } } |
