aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.BL
diff options
context:
space:
mode:
authorRoy Ben Shabat <roy.mail.net@gmail.com>2025-09-12 18:02:38 +0300
committerRoy Ben Shabat <roy.mail.net@gmail.com>2025-09-12 18:02:38 +0300
commit9a5f4fde8f1e0fa46c9bf75b9492c57a58249a8a (patch)
tree892424fe173f1ce0182616d543a3fe56748f2d2f /Software/Visual_Studio/Tango.BL
parent7eb361c1201381c6ad88efa0ebed2c6595b45d13 (diff)
downloadTango-9a5f4fde8f1e0fa46c9bf75b9492c57a58249a8a.tar.gz
Tango-9a5f4fde8f1e0fa46c9bf75b9492c57a58249a8a.zip
Improved dynamic assignment of catalog item <-> Liquid Volume.
Diffstat (limited to 'Software/Visual_Studio/Tango.BL')
-rw-r--r--Software/Visual_Studio/Tango.BL/Entities/BrushStop.cs35
-rw-r--r--Software/Visual_Studio/Tango.BL/Entities/ColorCatalogsItem.cs12
2 files changed, 16 insertions, 31 deletions
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;
+ }
}
}