diff options
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/ThreadLoading/DefaultThreadLoadingService.cs')
| -rw-r--r-- | Software/Visual_Studio/PPC/Tango.PPC.UI/ThreadLoading/DefaultThreadLoadingService.cs | 37 |
1 files changed, 35 insertions, 2 deletions
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<ThreadLoadingViewVM>(new ThreadLoadingViewVM()); + var vm = await _notificationsProvider.ShowDialog<ThreadLoadingViewVM>(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<ThreadLoadingViewVM>(new ThreadLoadingViewVM(true)); + var vm = await _notificationsProvider.ShowDialog<ThreadLoadingViewVM>(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() |
