diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2025-01-27 10:40:17 +0200 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2025-01-27 10:40:17 +0200 |
| commit | c24aaa736334929d64ca8f52d06c6f36142ab191 (patch) | |
| tree | e352046f097c609538e84010195f62924ae6dfe3 /Software/Visual_Studio | |
| parent | a712332e02b8346de626e267b3cba3f819fd3743 (diff) | |
| download | Tango-c24aaa736334929d64ca8f52d06c6f36142ab191.tar.gz Tango-c24aaa736334929d64ca8f52d06c6f36142ab191.zip | |
Abort Thread Loading...
Diffstat (limited to 'Software/Visual_Studio')
3 files changed, 20 insertions, 3 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 aea423c12..7cb0163af 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ThreadLoading/DefaultThreadLoadingService.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ThreadLoading/DefaultThreadLoadingService.cs @@ -65,20 +65,24 @@ namespace Tango.PPC.UI.ThreadLoading _dialogShown = true; var vm = await _notificationsProvider.ShowDialog<ThreadLoadingViewVM>(new ThreadLoadingViewVM(true)); _dialogShown = false; - if (!vm.DialogResult && vm.Stage != ThreadLoadingViewVM.ThreadLoadingStage.Completed) + if (!vm.DialogResult && vm.Stage != ThreadLoadingViewVM.ThreadLoadingStage.Completed && vm.Stage != ThreadLoadingViewVM.ThreadLoadingStage.Welcome) { if (_machineProvider.IsConnected) { try { + _notificationsProvider.SetGlobalBusyMessage("Aborting thread loading..."); + await Task.Delay(1000); await _machineProvider.MachineOperator.AbortThreadLoading(); + _notificationsProvider.ReleaseGlobalBusyMessage(); + await _notificationsProvider.ShowInfo("Thread loading aborted."); } catch (Exception ex) { + _notificationsProvider.ReleaseGlobalBusyMessage(); LogManager.Default.Log(ex, "Error aborting thread loading."); + await _notificationsProvider.ShowError("Could not properly abort the thread loading process."); } - - await _notificationsProvider.ShowInfo("Thread loading aborted."); } } } diff --git a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs index 6b32567a6..21aee7387 100644 --- a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs +++ b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs @@ -504,6 +504,9 @@ namespace Tango.Emulations.Emulators case MessageType.StartThreadLoadingRequest: HandleStartThreadLoadingRequest(MessageFactory.ParseTangoMessageFromContainer<StartThreadLoadingRequest>(container)); break; + case MessageType.AbortThreadLoadingRequest: + HandleAbortThreadLoadingRequest(MessageFactory.ParseTangoMessageFromContainer<AbortThreadLoadingRequest>(container)); + break; case MessageType.TryThreadLoadingRequest: HandleTryThreadLoadingRequest(MessageFactory.ParseTangoMessageFromContainer<TryThreadLoadingRequest>(container)); break; @@ -556,6 +559,15 @@ namespace Tango.Emulations.Emulators #region Request Handlers + private void HandleAbortThreadLoadingRequest(TangoMessage<AbortThreadLoadingRequest> request) + { + Task.Factory.StartNew(() => + { + Thread.Sleep(1000); + Transporter.SendResponse<AbortThreadLoadingResponse>(new AbortThreadLoadingResponse(), request.Container.Token); + }); + } + private void HandleCalculateRequest(TangoMessage<CalculateRequest> request) { Task.Factory.StartNew(() => diff --git a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs index 5a10f643a..1c2ce0042 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs @@ -4586,6 +4586,7 @@ namespace Tango.Integration.Operation public async Task AbortThreadLoading() { + ThreadLoadingStatus = null; var response = await SendRequest<AbortThreadLoadingRequest, AbortThreadLoadingResponse>(new AbortThreadLoadingRequest()); } |
