diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2020-01-22 18:26:17 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2020-01-22 18:26:17 +0200 |
| commit | 511a59999aca7f19e824a23ee0777756db16e6cd (patch) | |
| tree | d682d219364936c9794daa48951e487877eb1705 /Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs | |
| parent | bf432bf7b7faa7c51e74462e19eb3e50c28b4aa8 (diff) | |
| download | Tango-511a59999aca7f19e824a23ee0777756db16e6cd.tar.gz Tango-511a59999aca7f19e824a23ee0777756db16e6cd.zip | |
DB CHANGE from previous commit.
Implemented multiple job stops until success.
Related Work Items: #2412
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 | 25 |
1 files changed, 23 insertions, 2 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 a2f67b2ba..d94dfb61f 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 @@ -178,7 +178,6 @@ namespace Tango.PPC.Jobs.ViewModels { if (_handler != null) { - _stop_job_btn.Pop(); _handler.Cancel(); } } @@ -195,6 +194,7 @@ namespace Tango.PPC.Jobs.ViewModels e.JobHandler.StatusChanged += JobHandler_StatusChanged; e.JobHandler.SpoolChangeRequired += JobHandler_SpoolChangeRequired; e.JobHandler.Stopped += JobHandler_Stopped; + e.JobHandler.CanCancelChanged += JobHandler_CanCancelChanged; _stop_job_btn.Push(); } @@ -226,12 +226,23 @@ namespace Tango.PPC.Jobs.ViewModels /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> private void JobHandler_Stopped(object sender, EventArgs e) { + if (_stop_job_btn != null) + { + _stop_job_btn.Pop(); + } + if (NotificationProvider.HasAppBarItem && NotificationProvider.CurrentAppBarItem is JobProgressAppBarItem) { NotificationProvider.CurrentAppBarItem.Close(); } - _stop_job_btn.Pop(); + if (_handler != null) + { + _handler.StatusChanged += JobHandler_StatusChanged; + _handler.SpoolChangeRequired += JobHandler_SpoolChangeRequired; + _handler.Stopped += JobHandler_Stopped; + _handler.CanCancelChanged += JobHandler_CanCancelChanged; + } } /// <summary> @@ -247,6 +258,16 @@ namespace Tango.PPC.Jobs.ViewModels }); } + /// <summary> + /// Handles the CanCancelChanged event of the JobHandler control. + /// </summary> + /// <param name="sender">The source of the event.</param> + /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> + private void JobHandler_CanCancelChanged(object sender, EventArgs e) + { + _stop_job_btn.IsEnabled = _handler.CanCancel; + } + #endregion } } |
