From 33a68a0e46e55e86a4c1f100ea3d7e9180a801a3 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Thu, 12 Jul 2018 19:07:24 +0300 Subject: Working on PPC & Tango.Integration. --- .../PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs') 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 /// public class LayoutViewVM : PPCViewModel { + private JobHandler _jobHandler; + /// /// Gets or sets the module loader. /// @@ -66,6 +69,11 @@ namespace Tango.PPC.UI.ViewModels /// public RelayCommand NotificationsAreaPressedCommand { get; set; } + /// + /// Gets or sets the stop printing command. + /// + public RelayCommand StopPrintingCommand { get; set; } + /// /// Initializes a new instance of the class. /// @@ -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; } /// @@ -118,6 +141,7 @@ namespace Tango.PPC.UI.ViewModels { base.OnApplicationStarted(); ModuleLoader.ModulesLoaded += ModuleLoader_ModulesLoaded; + MachineProvider.MachineOperator.PrintingStarted += MachineOperator_PrintingStarted; } /// -- cgit v1.3.1