From 3df1dc3b608bbbb67d6c46bba13bc657f76c0ddd Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Fri, 1 Jan 2021 02:48:32 +0200 Subject: Several bug fixes --- .../PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs') diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs index 6f7717a90..e8325b8ea 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs @@ -519,7 +519,7 @@ namespace Tango.PPC.Jobs.ViewModels ValidateBrushStops(); - CoerceBrushStopsColorSpaceChange(); + RegisterJobBrushStopsColorSpaceChange(); DyeCommand.RaiseCanExecuteChanged(); StartSampleDyeCommand.RaiseCanExecuteChanged(); @@ -702,7 +702,7 @@ namespace Tango.PPC.Jobs.ViewModels LogManager.Log("Adding new solid segment..."); var s = Job.AddSolidSegment(Settings.DefaultSegmentLength > 0 ? Settings.DefaultSegmentLength : 10); SetSegmentLiquidVolumes(s); - CoerceBrushStopsColorSpaceChange(); + RegisterJobBrushStopsColorSpaceChange(); return s; } catch (Exception ex) @@ -723,7 +723,7 @@ namespace Tango.PPC.Jobs.ViewModels LogManager.Log("Adding new gradient segment..."); var s = Job.AddGradientSegment(Settings.DefaultSegmentLength > 0 ? Settings.DefaultSegmentLength : 10); SetSegmentLiquidVolumes(s); - CoerceBrushStopsColorSpaceChange(); + RegisterJobBrushStopsColorSpaceChange(); return s; } catch (Exception ex) @@ -771,6 +771,7 @@ namespace Tango.PPC.Jobs.ViewModels segment.BrushStops.ToList().ForEach(x => { + x.ColorSpaceChanged -= Stop_ColorSpaceChanged; _db.BrushStops.Remove(x); }); _db.Segments.Remove(segment); @@ -826,7 +827,7 @@ namespace Tango.PPC.Jobs.ViewModels #region Brush Stops Management - private void CoerceBrushStopsColorSpaceChange() + private void RegisterJobBrushStopsColorSpaceChange() { if (Job != null) { @@ -853,7 +854,7 @@ namespace Tango.PPC.Jobs.ViewModels LogManager.Log($"Adding new brush stop to segment {segment.SegmentIndex}."); segment.AddBrushStop(); SetSegmentLiquidVolumes(segment); - CoerceBrushStopsColorSpaceChange(); + RegisterJobBrushStopsColorSpaceChange(); } /// @@ -866,6 +867,7 @@ namespace Tango.PPC.Jobs.ViewModels { LogManager.Log($"removing brush stop {brushStop.StopIndex} from segment {brushStop.Segment.SegmentIndex}."); var segment = brushStop.Segment; + brushStop.ColorSpaceChanged -= Stop_ColorSpaceChanged; _db.BrushStops.Remove(brushStop); ArrangeBrushStopsIndices(segment); } -- cgit v1.3.1