diff options
Diffstat (limited to 'Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobViewVM.cs')
| -rw-r--r-- | Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobViewVM.cs | 10 |
1 files changed, 8 insertions, 2 deletions
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<BrushStop> brushStopList = new List<BrushStop>();//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<BrushStop> brushStopList = new List<BrushStop>();//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); } } } |
