aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-12-17 16:43:40 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-12-17 16:43:40 +0200
commitae1cfd30f1efbd385eac04b3d02fa1ed161058a3 (patch)
tree5b77d7484e80491b06f1b726a57a61c782b5569e /Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels
parent8270aa37dee33cda98603a995de823df393f7294 (diff)
downloadTango-ae1cfd30f1efbd385eac04b3d02fa1ed161058a3.tar.gz
Tango-ae1cfd30f1efbd385eac04b3d02fa1ed161058a3.zip
Add AppButtons to PPC.
Implemented Stop & Start job app buttons!
Diffstat (limited to 'Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels')
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs23
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs14
2 files changed, 37 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 16ffdd906..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,7 @@ 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;
@@ -19,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;
@@ -43,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>
@@ -81,6 +99,8 @@ namespace Tango.PPC.Jobs.ViewModels
{
NotificationProvider.CurrentAppBarItem.Close();
}
+
+ _stop_job_btn.Push();
}
#endregion
@@ -94,6 +114,7 @@ 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;
@@ -131,6 +152,8 @@ namespace Tango.PPC.Jobs.ViewModels
{
NotificationProvider.CurrentAppBarItem.Close();
}
+
+ _stop_job_btn.Pop();
}
/// <summary>
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 98f429889..6a05eee12 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
@@ -30,6 +30,7 @@ using Tango.PPC.Common.Models;
using Tango.Logging;
using Tango.PPC.Common.Messages;
using Tango.BL.Builders;
+using Tango.PPC.Jobs.AppButtons;
namespace Tango.PPC.Jobs.ViewModels
{
@@ -45,6 +46,7 @@ namespace Tango.PPC.Jobs.ViewModels
private Job _job_to_load;
private JobNavigationIntent _job_to_load_intent;
private static Dictionary<String, List<FineTuneItem>> _jobs_fine_tune_items;
+ private StartPrintingButton _start_printing_btn;
#region Properties
@@ -458,6 +460,8 @@ namespace Tango.PPC.Jobs.ViewModels
LogManager.Log("Directing view to display fine tuning region.");
View.DisplayFineTuning();
}
+
+ DyeCommand.RaiseCanExecuteChanged();
}
catch (Exception ex)
{
@@ -1017,6 +1021,8 @@ namespace Tango.PPC.Jobs.ViewModels
/// </summary>
public override void OnNavigatedTo()
{
+ _start_printing_btn.Push();
+
base.OnNavigatedTo();
LoadJob();
}
@@ -1026,6 +1032,8 @@ namespace Tango.PPC.Jobs.ViewModels
/// </summary>
public override void OnNavigatedFrom()
{
+ _start_printing_btn.Pop();
+
base.OnNavigatedFrom();
_job_to_load_intent = JobNavigationIntent.Default;
}
@@ -1055,6 +1063,12 @@ namespace Tango.PPC.Jobs.ViewModels
return result;
}
+ public override void OnApplicationReady()
+ {
+ base.OnApplicationReady();
+
+ _start_printing_btn = new StartPrintingButton(DyeCommand, MachineProvider.MachineOperator);
+ }
#endregion
#region INavigationObjectReceiver