diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-08-19 04:53:19 +0300 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-08-19 04:53:19 +0300 |
| commit | 1ba3500b421ddc58888a909fefdf2e2792c8e2be (patch) | |
| tree | 57d9a908d0c57bc65cd9f3e6f2cc616fbbfcbe04 /Software/Visual_Studio/Tango.Integration | |
| parent | b9d18dcd6e6795ed2c870a73e3111b608118a35b (diff) | |
| download | Tango-1ba3500b421ddc58888a909fefdf2e2792c8e2be.tar.gz Tango-1ba3500b421ddc58888a909fefdf2e2792c8e2be.zip | |
Implemeneted continuous ActivateVersionRequest.
Added Progress & Total.
Diffstat (limited to 'Software/Visual_Studio/Tango.Integration')
| -rw-r--r-- | Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs index 57613aae2..a95d34e96 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs @@ -3612,11 +3612,43 @@ namespace Tango.Integration.Operation { try { + TaskCompletionSource<object> activationCompletion = new TaskCompletionSource<object>(); + + bool completed = false; + LogManager.Log("Activating version..."); + upgradeHandler.RaiseProgress(upgradeHandler.Total, FirmwareUpgradeStatus.Activating, "Activating version..."); + var activateRequest = new ActivateVersionRequest(); activateRequest.Path = package_folder; - var activateResponse = SendRequest<ActivateVersionRequest, ActivateVersionResponse>(activateRequest, new TransportRequestConfig() { Timeout = TimeSpan.FromSeconds(10), ShouldLog = true }).Result; + + SendContinuousRequest<ActivateVersionRequest, ActivateVersionResponse>(activateRequest, new TransportContinuousRequestConfig() { Timeout = TimeSpan.FromSeconds(10), ContinuousTimeout = TimeSpan.FromSeconds(10), ShouldLog = true }) + .Subscribe((response) => + { + if (!completed && response.Message.Progress > 0) + { + upgradeHandler.Total = (long)response.Message.Total; + upgradeHandler.RaiseProgress((long)response.Message.Progress, FirmwareUpgradeStatus.Activating, "Activating version..."); + } + }, (ex) => + { + if (!completed) + { + completed = true; + activationCompletion.SetException(ex); + } + }, () => + { + if (!completed) + { + completed = true; + activationCompletion.SetResult(true); + } + }); + + var result = activationCompletion.Task.GetAwaiter().GetResult(); + postActivation(); } catch (Exception ex) |
