aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs')
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs45
1 files changed, 45 insertions, 0 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs
index 387b3e6a0..264f41131 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs
@@ -8,6 +8,8 @@ using Tango.Integration.Operation;
using Tango.PPC.Common;
using Tango.PPC.Common.Navigation;
using Tango.PPC.Jobs.AppBarItems;
+using Tango.PPC.Jobs.AppButtons;
+using Tango.PPC.Jobs.Dialogs;
using Tango.PPC.Jobs.Views;
namespace Tango.PPC.Jobs.ViewModels
@@ -18,6 +20,9 @@ namespace Tango.PPC.Jobs.ViewModels
/// <seealso cref="Tango.PPC.Common.PPCViewModel" />
public class JobProgressViewVM : PPCViewModel
{
+ private StopPrintingButton _stop_job_btn;
+ private JobHandler _handler;
+
#region Properties
private Job _job;
@@ -42,6 +47,20 @@ namespace Tango.PPC.Jobs.ViewModels
#endregion
+ public JobProgressViewVM()
+ {
+ _stop_job_btn = new StopPrintingButton();
+ _stop_job_btn.Pressed += _stop_job_btn_Pressed;
+ }
+
+ private void _stop_job_btn_Pressed()
+ {
+ if (_handler != null)
+ {
+ _handler.Cancel();
+ }
+ }
+
#region Override Methods
/// <summary>
@@ -80,6 +99,8 @@ namespace Tango.PPC.Jobs.ViewModels
{
NotificationProvider.CurrentAppBarItem.Close();
}
+
+ _stop_job_btn.Push();
}
#endregion
@@ -93,12 +114,34 @@ namespace Tango.PPC.Jobs.ViewModels
/// <param name="e">The <see cref="PrintingEventArgs"/> instance containing the event data.</param>
private void MachineOperator_PrintingStarted(object sender, PrintingEventArgs e)
{
+ _handler = e.JobHandler;
Job = e.Job;
e.JobHandler.StatusChanged += JobHandler_StatusChanged;
+ e.JobHandler.SpoolChangeRequired += JobHandler_SpoolChangeRequired;
e.JobHandler.Stopped += JobHandler_Stopped;
}
/// <summary>
+ /// Handles the SpoolChangeRequired event of the JobHandler.
+ /// </summary>
+ /// <param name="sender">The source of the event.</param>
+ /// <param name="e">The <see cref="SpoolChangeRequiredEventArgs"/> instance containing the event data.</param>
+ private void JobHandler_SpoolChangeRequired(object sender, SpoolChangeRequiredEventArgs e)
+ {
+ InvokeUI(async () =>
+ {
+ if ((await NotificationProvider.ShowDialog(new SpoolChangeViewVM(e))).DialogResult)
+ {
+ e.Confirm();
+ }
+ else
+ {
+ e.Abort();
+ }
+ });
+ }
+
+ /// <summary>
/// Handles the Stopped event of the JobHandler.
/// </summary>
/// <param name="sender">The source of the event.</param>
@@ -109,6 +152,8 @@ namespace Tango.PPC.Jobs.ViewModels
{
NotificationProvider.CurrentAppBarItem.Close();
}
+
+ _stop_job_btn.Pop();
}
/// <summary>