aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.BL
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/Tango.BL')
-rw-r--r--Software/Visual_Studio/Tango.BL/Entities/BrushStop.cs40
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>