From c3ed01b6c75c44cfeca650b43deb058b1551a9bb Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Wed, 19 Dec 2018 14:52:54 +0200 Subject: Moved machine studio update azure !!! --- .../ViewModels/UpdateViewVM.cs | 35 ++++++++-------------- 1 file changed, 12 insertions(+), 23 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs') 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 a9624da2d..af197ca3b 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs @@ -24,6 +24,7 @@ using Tango.SharedUI; using Tango.MachineStudio.UI.Messages; using Tango.Settings; using Tango.MachineStudio.Common; +using Tango.Transport.Web; namespace Tango.MachineStudio.UI.ViewModels { @@ -193,8 +194,7 @@ namespace Tango.MachineStudio.UI.ViewModels { Thread.Sleep(2000); - service = UpdateServiceHelper.GetUpdateServiceChannel(); - var client = service.CreateChannel(); + var client = new MachineStudioUpdateService(); CheckForUpdatesResponse response = client.CheckForUpdates(new CheckForUpdatesRequest() { @@ -202,7 +202,7 @@ namespace Tango.MachineStudio.UI.ViewModels Password = _authentication.CurrentUser.Password, Version = _application.Version.ToString(), AcceptBetaRelease = settings.AcceptBetaRelease, - }); + }).Result; if (response.IsUpdateAvailable) { @@ -260,29 +260,18 @@ namespace Tango.MachineStudio.UI.ViewModels { logManager.Log("Creating temporary file " + tempFile); - int fileSize = 0; - - using (FileStreamWrapper fs = new FileStreamWrapper(tempFile.Path, FileMode.Create, (current) => - { - InvokeUINow(() => - { - Thread.Sleep(10); - DownloadProgress = ((double)current / (double)fileSize) * 100d; - }); - })) + using (StorageBlobDownloader downloader = new StorageBlobDownloader(_updateInfo.BlobAddress, tempFile.Path)) { - using (FtpClient ftp = new FtpClient(_updateInfo.FtpHost, _updateInfo.UserName, _updateInfo.Password)) + downloader.Progress += (x, e) => { - logManager.Log("Connecting to FTP site: " + _updateInfo.FtpHost); - ftp.ConnectAsync().Wait(); - logManager.Log("Retrieving download size..."); - fileSize = (int)ftp.GetFileSize(_updateInfo.FilePath); - logManager.Log("Download size: " + fileSize + " bytes."); - logManager.Log("Starting download..."); - ftp.DownloadAsync(fs, _updateInfo.FilePath).Wait(); - } - } + InvokeUINow(() => + { + DownloadProgress = ((double)e.Current / (double)e.Total) * 100d; + }); + }; + downloader.Download().Wait(); + } Status = UpdateStatus.Updating; -- cgit v1.3.1 From cf8bc0e91d375eecb206cfe70fa43b153a1b5860 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Wed, 19 Dec 2018 18:13:00 +0200 Subject: Redundant. --- .../Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs | 9 --------- 1 file changed, 9 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs') 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 af197ca3b..3fec96629 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs @@ -186,8 +186,6 @@ namespace Tango.MachineStudio.UI.ViewModels var settings = SettingsManager.Default.GetOrCreate(); - ChannelFactory service = null; - Task.Factory.StartNew(() => { try @@ -221,13 +219,6 @@ namespace Tango.MachineStudio.UI.ViewModels logManager.Log(ex, "Error while checking for version update!"); Status = UpdateStatus.Error; } - finally - { - if (service != null) - { - service.Close(); - } - } }); } -- cgit v1.3.1