aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/MainViewVM.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/MainViewVM.cs')
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/MainViewVM.cs21
1 files changed, 16 insertions, 5 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/MainViewVM.cs
index 087e30be6..7869e6990 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/MainViewVM.cs
@@ -24,6 +24,7 @@ namespace Tango.PPC.Jobs.ViewModels
public class MainViewVM : PPCViewModel
{
private NotificationItem _last_failed_job_notification;
+ private bool resuming;
/// <summary>
/// Called when the application has been started.
@@ -33,15 +34,14 @@ namespace Tango.PPC.Jobs.ViewModels
MachineProvider.MachineOperator.PrintingCompleted += MachineOperator_PrintingCompleted;
MachineProvider.MachineOperator.PrintingFailed += MachineOperator_PrintingFailed;
MachineProvider.MachineOperator.ResumingJob += MachineOperator_ResumingJob;
+ MachineProvider.MachineOperator.PrintingStarted += MachineOperator_PrintingStarted;
}
- private void MachineOperator_ResumingJob(object sender, ResumingJobEventArgs e)
+ private void MachineOperator_PrintingStarted(object sender, PrintingEventArgs e)
{
- LogManager.Log($"Trying to resume job '{e.JobGuid}'...");
-
- try
+ if (resuming)
{
- e.Approve();
+ resuming = false;
InvokeUI(() =>
{
@@ -54,6 +54,17 @@ namespace Tango.PPC.Jobs.ViewModels
}
});
}
+ }
+
+ private void MachineOperator_ResumingJob(object sender, ResumingJobEventArgs e)
+ {
+ LogManager.Log($"Job resume request '{e.JobGuid}' approving...");
+
+ try
+ {
+ e.Approve();
+ resuming = true;
+ }
catch (Exception ex)
{
LogManager.Log(ex, "An error occurred while trying to resume the job.");