aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs')
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs24
1 files changed, 24 insertions, 0 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs
index 405c19eb7..b3a0c5b1a 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs
@@ -5,6 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using Tango.Core.Commands;
using Tango.Core.DI;
+using Tango.Integration.Operation;
using Tango.PPC.Common;
using Tango.PPC.Common.Modules;
using Tango.PPC.Common.Navigation;
@@ -20,6 +21,8 @@ namespace Tango.PPC.UI.ViewModels
/// <seealso cref="Tango.PPC.Common.PPCViewModel{Tango.PPC.UI.ViewsContracts.ILayoutView}" />
public class LayoutViewVM : PPCViewModel<ILayoutView>
{
+ private JobHandler _jobHandler;
+
/// <summary>
/// Gets or sets the module loader.
/// </summary>
@@ -67,6 +70,11 @@ namespace Tango.PPC.UI.ViewModels
public RelayCommand NotificationsAreaPressedCommand { get; set; }
/// <summary>
+ /// Gets or sets the stop printing command.
+ /// </summary>
+ public RelayCommand StopPrintingCommand { get; set; }
+
+ /// <summary>
/// Initializes a new instance of the <see cref="LayoutViewVM"/> class.
/// </summary>
public LayoutViewVM()
@@ -75,6 +83,21 @@ namespace Tango.PPC.UI.ViewModels
HomeCommand = new RelayCommand(NavigateHome);
MenuOrBackCommand = new RelayCommand(OpenMenuOrNavigateBack);
NotificationsAreaPressedCommand = new RelayCommand(OpenFirstNotificationOrDisplayAll);
+
+ StopPrintingCommand = new RelayCommand(StopPrinting);
+ }
+
+ private void StopPrinting()
+ {
+ if (_jobHandler != null)
+ {
+ _jobHandler.Cancel();
+ }
+ }
+
+ private void MachineOperator_PrintingStarted(object sender, Integration.Operation.JobHandler jobHandler)
+ {
+ _jobHandler = jobHandler;
}
/// <summary>
@@ -118,6 +141,7 @@ namespace Tango.PPC.UI.ViewModels
{
base.OnApplicationStarted();
ModuleLoader.ModulesLoaded += ModuleLoader_ModulesLoaded;
+ MachineProvider.MachineOperator.PrintingStarted += MachineOperator_PrintingStarted;
}
/// <summary>