From 97904f88f3949339c713286b592ad156baa8d41f Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Sun, 19 Jan 2025 19:47:50 +0200 Subject: Buzzer. White Skip. Thread Loading Abort. --- .../ThreadLoading/DefaultThreadLoadingService.cs | 37 ++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/ThreadLoading') diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ThreadLoading/DefaultThreadLoadingService.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ThreadLoading/DefaultThreadLoadingService.cs index cc8f867cc..aea423c12 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ThreadLoading/DefaultThreadLoadingService.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ThreadLoading/DefaultThreadLoadingService.cs @@ -5,6 +5,7 @@ using System.Text; using System.Threading.Tasks; using Tango.Core.DI; using Tango.Integration.Operation; +using Tango.Logging; using Tango.PPC.Common.Build; using Tango.PPC.Common.Connection; using Tango.PPC.Common.Notifications; @@ -37,8 +38,24 @@ namespace Tango.PPC.UI.ThreadLoading _dialogShown = true; _dispatcher.Invoke(async () => { - await _notificationsProvider.ShowDialog(new ThreadLoadingViewVM()); + var vm = await _notificationsProvider.ShowDialog(new ThreadLoadingViewVM()); _dialogShown = false; + if (!vm.DialogResult && vm.Stage != ThreadLoadingViewVM.ThreadLoadingStage.Completed) + { + if (_machineProvider.IsConnected) + { + try + { + await _machineProvider.MachineOperator.AbortThreadLoading(); + } + catch (Exception ex) + { + LogManager.Default.Log(ex, "Error aborting thread loading."); + } + + await _notificationsProvider.ShowInfo("Thread loading aborted."); + } + } }); } } @@ -46,8 +63,24 @@ namespace Tango.PPC.UI.ThreadLoading public async void StartThreadLoadingWizard() { _dialogShown = true; - await _notificationsProvider.ShowDialog(new ThreadLoadingViewVM(true)); + var vm = await _notificationsProvider.ShowDialog(new ThreadLoadingViewVM(true)); _dialogShown = false; + if (!vm.DialogResult && vm.Stage != ThreadLoadingViewVM.ThreadLoadingStage.Completed) + { + if (_machineProvider.IsConnected) + { + try + { + await _machineProvider.MachineOperator.AbortThreadLoading(); + } + catch (Exception ex) + { + LogManager.Default.Log(ex, "Error aborting thread loading."); + } + + await _notificationsProvider.ShowInfo("Thread loading aborted."); + } + } } public async void StartThreadBreakWizard() -- cgit v1.3.1