diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2019-01-02 08:47:29 +0200 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2019-01-02 08:47:29 +0200 |
| commit | 520e878bf98efcec9c75abcfe483175ff72620a2 (patch) | |
| tree | 62a7221e3c22187821f6a5e399eca0f7bd31168a /Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs | |
| parent | 30574fe4a6e1bb4f60a43e9000acaf919811689a (diff) | |
| parent | 25f5e6ddef7ef2fa0a747305847eeb4ceee5a2c9 (diff) | |
| download | Tango-520e878bf98efcec9c75abcfe483175ff72620a2.tar.gz Tango-520e878bf98efcec9c75abcfe483175ff72620a2.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
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.cs | 45 |
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> |
