diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2019-02-19 11:19:21 +0200 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2019-02-19 11:19:21 +0200 |
| commit | 93e6a6bfa7238826dcdea989e279ec3450067f83 (patch) | |
| tree | 212b5023935862346a7de311e37cf1ef727efcd5 /Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs | |
| parent | e99efd9d9b7b67a76db82a9a40525f96bcf064c0 (diff) | |
| parent | 3fcd0dbc6650749421f0390a60154c52254682e6 (diff) | |
| download | Tango-93e6a6bfa7238826dcdea989e279ec3450067f83.tar.gz Tango-93e6a6bfa7238826dcdea989e279ec3450067f83.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs')
| -rw-r--r-- | Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs index 63cff2242..17edf1dfd 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs @@ -19,7 +19,7 @@ using Tango.MachineStudio.Common.Authentication; using Tango.MachineStudio.Common.Navigation; using Tango.MachineStudio.Common.Notifications; using Tango.MachineStudio.Common.StudioApplication; -using Tango.MachineStudio.Common.Update; +using Tango.MachineStudio.Common.Web; using Tango.SharedUI; using Tango.MachineStudio.UI.Messages; using Tango.Settings; @@ -55,6 +55,7 @@ namespace Tango.MachineStudio.UI.ViewModels private CheckForUpdatesResponse _updateInfo; private TemporaryFolder _newPackageTempFolder; private TemporaryFolder _previousPackageTempFolder; + private MachineStudioWebClient _machineStudioWebClient; private bool _forcedUpdate; public bool ForcedUpdate @@ -139,8 +140,9 @@ namespace Tango.MachineStudio.UI.ViewModels public RelayCommand TryRollbackAgainCommand { get; set; } - public UpdateViewVM(INotificationProvider notification, IAuthenticationProvider authentication, INavigationManager navigation, IStudioApplicationManager application) + public UpdateViewVM(MachineStudioWebClient machineStudioWebClient, INotificationProvider notification, IAuthenticationProvider authentication, INavigationManager navigation, IStudioApplicationManager application) { + _machineStudioWebClient = machineStudioWebClient; _notification = notification; _navigation = navigation; _application = application; @@ -168,11 +170,9 @@ namespace Tango.MachineStudio.UI.ViewModels Status = UpdateStatus.CheckingForUpdate; - var client = new MachineStudioUpdateService(); - - DownloadLatestVersionResponse response = await client.DownloadLatestVersion(new DownloadLatestVersionRequest() + DownloadLatestVersionResponse response = await _machineStudioWebClient.DownloadLatestVersion(new DownloadLatestVersionRequest() { - AccessToken = _authentication.AccessToken, + }); _updateInfo = new CheckForUpdatesResponse(); @@ -209,17 +209,14 @@ namespace Tango.MachineStudio.UI.ViewModels var settings = SettingsManager.Default.GetOrCreate<MachineStudioSettings>(); - Task.Factory.StartNew(() => + Task.Factory.StartNew((Action)(() => { try { Thread.Sleep(2000); - var client = new MachineStudioUpdateService(); - - CheckForUpdatesResponse response = client.CheckForUpdates(new CheckForUpdatesRequest() + CheckForUpdatesResponse response = _machineStudioWebClient.CheckForUpdates(new CheckForUpdatesRequest() { - AccessToken = _authentication.AccessToken, Version = _application.Version.ToString(), }).Result; @@ -240,7 +237,7 @@ namespace Tango.MachineStudio.UI.ViewModels logManager.Log(ex, "Error while checking for version update!"); Status = UpdateStatus.Error; } - }); + })); } private void BackToApplication() |
