diff options
Diffstat (limited to 'Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs')
| -rw-r--r-- | Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs | 37 |
1 files changed, 12 insertions, 25 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs index a2acf5893..bff6beff5 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs @@ -26,7 +26,6 @@ namespace Tango.PPC.Jobs.ViewModels { private ObservablesContext _context; private bool _canStartJob; - private bool _startingJob; private bool _isPreparingJob; /// <summary> @@ -60,6 +59,7 @@ namespace Tango.PPC.Jobs.ViewModels set { _estimatedDuration = value; RaisePropertyChangedAuto(); } } + /// <summary> /// Gets or sets the dye command. /// </summary> @@ -96,20 +96,12 @@ namespace Tango.PPC.Jobs.ViewModels /// </summary> private async void StartJob() { - if (_startingJob) return; - - _startingJob = true; - _canStartJob = false; - InvalidateRelayCommands(); - NavigationManager.IsBackEnabled = false; - try { LogManager.Log("Start job command pressed. Starting job and navigating to job progress view..."); await PrintingManager.Print(Job, _context); await NavigationManager.NavigateTo<JobsModule>(false, nameof(JobProgressView)); - _startingJob = false; } catch (InsufficientLiquidQuantityException) { @@ -120,13 +112,6 @@ namespace Tango.PPC.Jobs.ViewModels LogManager.Log(ex, "Could not start the current job."); await NotificationProvider.ShowError($"{ex.Message}"); } - finally - { - _startingJob = false; - _canStartJob = true; - NavigationManager.IsBackEnabled = true; - InvalidateRelayCommands(); - } } /// <summary> @@ -145,6 +130,16 @@ namespace Tango.PPC.Jobs.ViewModels _context = obj.Context; Job = obj.Job; + if (Job.ColorSpace.Space == BL.Enumerations.ColorSpaces.Catalog) + { + if (_context.ColorCatalogs.SingleOrDefault(x => x.Guid == Job.ColorCatalogGuid) == null) + { + await NotificationProvider.ShowError("The selected color catalog for this job could not be found.\nCannot load job."); + await NavigationManager.NavigateBack(); + return; + } + } + IsPreparingJob = true; Job = await new JobBuilder(_context).Set(Job.Guid) @@ -155,15 +150,7 @@ namespace Tango.PPC.Jobs.ViewModels .WithBrushStops() .BuildAsync(); - if (Job.ColorSpace.Space == BL.Enumerations.ColorSpaces.Catalog) - { - if (_context.ColorCatalogs.SingleOrDefault(x => x.Guid == Job.ColorCatalogGuid) == null) - { - await NotificationProvider.ShowError("The selected color catalog for this job could not be found.\nCannot load job."); - await NavigationManager.NavigateBack(); - return; - } - } + await Task.Delay(2000); await Task.Factory.StartNew(() => { |
