diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-07-01 17:56:49 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-07-01 17:56:49 +0300 |
| commit | 8a1e772f025eaf3bfdf17905d9e33c460993e559 (patch) | |
| tree | b6d705cca71033cd6c5f814596ceb9abc849bf50 /Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs | |
| parent | c0fd8dcc53e45aa5aa0095cc2c8c5f39a34f7886 (diff) | |
| download | Tango-8a1e772f025eaf3bfdf17905d9e33c460993e559.tar.gz Tango-8a1e772f025eaf3bfdf17905d9e33c460993e559.zip | |
Many bug fixes !!!
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs')
| -rw-r--r-- | Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs index 1f09023cb..456c69625 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs @@ -45,6 +45,8 @@ namespace Tango.PPC.UI.Printing /// <returns></returns> public async Task<JobHandler> Print(Job job, ObservablesContext context) { + ThrowIfJobInvalid(job); + JobHandler handler = null; #if STUBPRINT @@ -149,6 +151,8 @@ namespace Tango.PPC.UI.Printing /// <returns></returns> public async Task<JobHandler> PrintSample(Job job, ObservablesContext context) { + ThrowIfJobInvalid(job); + LogManager.Log("Cloning job..."); Job sampleDyeJob = job.Clone(); sampleDyeJob.Guid = job.Guid; @@ -202,6 +206,8 @@ namespace Tango.PPC.UI.Printing /// <returns></returns> public async Task<JobHandler> PrintFineTuning(Job job, ObservablesContext context, IEnumerable<FineTuneItem> fineTuneItems) { + ThrowIfJobInvalid(job); + LogManager.Log("Cloning job..."); Job fineTuneJob = job.Clone(); fineTuneJob.NumberOfUnits = 1; @@ -241,5 +247,21 @@ namespace Tango.PPC.UI.Printing { TangoMessenger.Default.Send(new JobSavedMessage() { Job = job }); } + + private void ThrowIfJobInvalid(Job job) + { + if (job.Segments.SelectMany(x => x.BrushStops).Any(x => x.IsOutOfGamut)) + { + throw new InvalidOperationException("Error starting job. Color is out of range."); + } + if (job.Segments.SelectMany(x => x.BrushStops).Any(x => x.ColorSpace.IsCatalog && x.ColorCatalog == null)) + { + throw new InvalidOperationException("Error starting job. Please select a catalog color."); + } + if (job.Rml.Ccts.Count == 0) + { + throw new InvalidOperationException($"Error starting job. No color table found for thread '{job.Rml.Name}'."); + } + } } } |
