diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2025-08-14 03:43:16 +0300 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2025-08-14 03:43:16 +0300 |
| commit | d9322cdd83c46d1add0a3c8421e28ee878c29396 (patch) | |
| tree | db0dd91f24b9ae7af438f498a4f6200e04977599 /Software/Visual_Studio/Tango.BL | |
| parent | 61bc5d6672a0dd3c7fd0f8e1a95d5c037fb20cab (diff) | |
| download | Tango-d9322cdd83c46d1add0a3c8421e28ee878c29396.tar.gz Tango-d9322cdd83c46d1add0a3c8421e28ee878c29396.zip | |
Machine Operator Printing Operations Major Refactoring.
Revived Job Resume for X1/X4/PPC.
Diffstat (limited to 'Software/Visual_Studio/Tango.BL')
| -rw-r--r-- | Software/Visual_Studio/Tango.BL/Entities/BrushStop.cs | 40 |
1 files changed, 36 insertions, 4 deletions
diff --git a/Software/Visual_Studio/Tango.BL/Entities/BrushStop.cs b/Software/Visual_Studio/Tango.BL/Entities/BrushStop.cs index 8de903a46..f41cfec9c 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/BrushStop.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/BrushStop.cs @@ -29,6 +29,7 @@ namespace Tango.BL.Entities private ActionTimer _syncTimer; private static List<String> _colorPropertyNames; public const double MAX_INK_UPTAKE = 400; + private object _lock = new object(); #region Enums @@ -155,7 +156,21 @@ namespace Tango.BL.Entities [JsonIgnore] public ObservableCollection<LiquidVolume> LiquidVolumesOrderedPigmented { - get { return LiquidVolumes != null ? LiquidVolumes.Where(x => x.IdsPack.LiquidType.HasPigment).OrderBy(x => x.IdsPack.LiquidType.PreferredIndex).ToObservableCollection() : null; } + get + { + if (LiquidVolumes != null) + { + lock (_lock) + { + var list = LiquidVolumes.ToList().Where(x => x.IdsPack.LiquidType.HasPigment).OrderBy(x => x.IdsPack.LiquidType.PreferredIndex).ToObservableCollection(); + return list; + } + } + else + { + return null; + } + } } public void SetLiquidVolume(LiquidTypes liquidType, double volume) @@ -170,7 +185,21 @@ namespace Tango.BL.Entities [JsonIgnore] public ObservableCollection<LiquidVolume> LiquidVolumesOrderedPigmentedForStandardUser { - get { return LiquidVolumes != null ? LiquidVolumes.Where(x => x.IdsPack.LiquidType.HasPigment && x.IdsPack.LiquidType.AvailableForStandardUser).OrderBy(x => x.IdsPack.LiquidType.PreferredIndex).ToObservableCollection() : null; } + get + { + if (LiquidVolumes != null) + { + lock (_lock) + { + var list = LiquidVolumes.ToList().Where(x => x.IdsPack.LiquidType.HasPigment && x.IdsPack.LiquidType.AvailableForStandardUser).OrderBy(x => x.IdsPack.LiquidType.PreferredIndex).ToList().ToObservableCollection(); + return list; + } + } + else + { + return null; + } + } } /// <summary> @@ -515,17 +544,19 @@ namespace Tango.BL.Entities /// <param name="processParametersTable">The process parameters table.</param> public void SetLiquidVolumes(Configuration configuration, Rml rml, ProcessParametersTable processParametersTable) { + //lock (_lock) + //{ LiquidVolumes = new ObservableCollection<LiquidVolume>(); - lock (LiquidVolumes) + lock (_lock) { foreach (var idsPack in configuration.GetSupportedIdsPacks(rml)) { var liquidVolume = new LiquidVolume(configuration, idsPack, rml, processParametersTable, this); liquidVolume.VolumeChanged += LiquidVolume_VolumeChanged; LiquidVolumes.Add(liquidVolume); - } + } } foreach (var volume in LiquidVolumes.ToList()) @@ -537,6 +568,7 @@ namespace Tango.BL.Entities RaisePropertyChanged(nameof(LiquidVolumesOrdered)); RaisePropertyChanged(nameof(LiquidVolumesOrderedPigmented)); RaisePropertyChanged(nameof(LiquidVolumesOrderedPigmentedForStandardUser)); + //} } /// <summary> |
