aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs
diff options
context:
space:
mode:
authorMirta <mirta@twine-s.com>2020-12-30 16:39:52 +0200
committerMirta <mirta@twine-s.com>2020-12-30 16:39:52 +0200
commit00a491d93733d4625ad329b2ba8237f445364b3f (patch)
tree4b24c6fa78d7648f4bb7cefafa464bb0b063fec4 /Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs
parent124ad4150f80c6846fdee41dbbda9848c105f6e5 (diff)
downloadTango-00a491d9.tar.gz
Tango-00a491d9.zip
merge
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.cs37
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(() =>
{