aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs')
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs29
1 files changed, 21 insertions, 8 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs
index efaf98966..5e90d3b5b 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs
@@ -56,6 +56,7 @@ namespace Tango.PPC.Jobs.ViewModels
private ActionTimer _volumeConversionTimer;
private IColorConverter _converter;
private string _current_job_string;
+ private bool startingJob = false;
#region Properties
@@ -545,18 +546,15 @@ namespace Tango.PPC.Jobs.ViewModels
}
catch (Exception ex)
{
- LogManager.Log(ex, $"Error loading job '{_job_to_load.Name}'");
+ IsFree = true;
+ LogManager.Log(ex, $"Error loading job '{(_job_to_load != null ? _job_to_load.Name : "null")}'");
await NotificationProvider.ShowError("An error occurred while trying to load the selected job.");
_can_navigate_back = true;
await NavigationManager.NavigateBack();
}
finally
{
- InvokeUI(() =>
- {
- IsFree = true;
- //NotificationProvider.ReleaseGlobalBusyMessage();
- });
+ IsFree = true;
}
}
@@ -647,11 +645,16 @@ namespace Tango.PPC.Jobs.ViewModels
/// </summary>
private async void StartJob()
{
+ if (startingJob) return;
+
try
{
+ Debug.WriteLine("Job Starting...");
+ startingJob = true;
LogManager.Log("Start job command pressed. Starting job and navigating to job progress view...");
var handler = await PrintingManager.Print(Job, _db);
await NavigationManager.NavigateTo<JobsModule>(nameof(JobProgressView));
+ startingJob = false;
}
catch (InsufficientLiquidQuantityException)
{
@@ -662,6 +665,10 @@ namespace Tango.PPC.Jobs.ViewModels
LogManager.Log(ex, "Could not start the current job.");
await NotificationProvider.ShowError($"{ex.Message}.");
}
+ finally
+ {
+ startingJob = false;
+ }
}
/// <summary>
@@ -670,8 +677,7 @@ namespace Tango.PPC.Jobs.ViewModels
private bool CanStartJob()
{
return
- Job != null && Job.Validate(_db) &&
- !Job.Segments.SelectMany(x => x.BrushStops).Where(x => !x.IsTransparent && !x.IsWhite).ToList().Exists(x => x.IsOutOfGamut);
+ Job != null && Job.Validate(_db) && !Job.Segments.SelectMany(x => x.BrushStops).Where(x => !x.IsTransparent && !x.IsWhite).ToList().Exists(x => x.IsOutOfGamut || x.IsLiquidVolumesOutOfRange);
}
#endregion
@@ -997,6 +1003,11 @@ namespace Tango.PPC.Jobs.ViewModels
stop.Blue = output.SingleCoordinates.Blue;
stop.Corrected = true;
stop.IsOutOfGamut = false;
+
+ InvokeUI(() =>
+ {
+ DyeCommand.RaiseCanExecuteChanged();
+ });
}
catch (Exception ex)
{
@@ -1417,6 +1428,8 @@ namespace Tango.PPC.Jobs.ViewModels
{
bool result = true;
+ if (!IsFree) return false;
+
if (!_can_navigate_back)
{
bool jobChainged = false;