From 3c0deb94bb7e0a758d35b7e4ebafb27f07fdc3a9 Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Tue, 9 Aug 2022 16:15:14 +0300 Subject: Brush gradient problem in new PPC. Related Work Items: #7059 --- .../PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobViewVM.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels') diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobViewVM.cs index dac84bc7b..1cc98bede 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobViewVM.cs @@ -1415,12 +1415,14 @@ namespace Tango.PPC.Jobs.ViewModels dbSegment.SegmentIndex = segment.SegmentIndex; dbSegment.Length = segment.Length; _db.Segments.Add(dbSegment); + List brushStopList = new List();//to prevent collection changed event and override offset in timer foreach (var stop in innerSegment.BrushStops.OrderBy(x => x.StopIndex).ToList()) { var dbStop = new BrushStop(); dbStop.Guid = stop.Guid; dbStop.Segment = dbSegment; - _db.BrushStops.Add(dbStop); + //_db.BrushStops.Add(dbStop); + brushStopList.Add(dbStop); dbStop.ColorSpace = colorSpaces.FirstOrDefault(x => x.Code == (int)stop.ColorSpace); dbStop.Red = stop.Red; @@ -1449,6 +1451,7 @@ namespace Tango.PPC.Jobs.ViewModels dbStop.ColorCatalog = stop.ColorCatalog; dbStop.ColorCatalogsItem = stop.ColorCatalogsItem; } + _db.BrushStops.AddRange(brushStopList); } else if( segment is SegmentsGroupModel group) { @@ -1469,11 +1472,13 @@ namespace Tango.PPC.Jobs.ViewModels dbSegment.Length = segm_group.Length; dbSegment.SegmentsGroupGuid = dbSegmentsGroup.Guid; _db.Segments.Add(dbSegment); + List brushStopList = new List();//to prevent collection changed event and override offset in timer foreach (var stop in segm_group.BrushStops.OrderBy(x => x.StopIndex).ToList()) { var dbStop = new BrushStop(); dbStop.Segment = dbSegment; - _db.BrushStops.Add(dbStop); + //_db.BrushStops.Add(dbStop); + brushStopList.Add(dbStop); dbStop.ColorSpace = colorSpaces.FirstOrDefault(x => x.Code == (int)stop.ColorSpace); dbStop.Red = stop.Red; @@ -1502,6 +1507,7 @@ namespace Tango.PPC.Jobs.ViewModels dbStop.ColorCatalog = stop.ColorCatalog; dbStop.ColorCatalogsItem = stop.ColorCatalogsItem; } + _db.BrushStops.AddRange(brushStopList); } } } -- cgit v1.3.1