aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-12-19 14:52:54 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-12-19 14:52:54 +0200
commitc3ed01b6c75c44cfeca650b43deb058b1551a9bb (patch)
tree87f8c8391373c3fa50eb7248798ce8fd99fde8c6 /Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels
parentde762e7e5b346af5a12eff04cbaa0696eec15b8c (diff)
downloadTango-c3ed01b6c75c44cfeca650b43deb058b1551a9bb.tar.gz
Tango-c3ed01b6c75c44cfeca650b43deb058b1551a9bb.zip
Moved machine studio update azure !!!
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels')
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs6
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs5
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs35
3 files changed, 17 insertions, 29 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs
index cafd0328a..545d51ef2 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs
@@ -94,15 +94,15 @@ namespace Tango.MachineStudio.UI.ViewModels
Status = "Checking for critical updates...";
LogManager.Log("Checking for forced update...");
- var service = UpdateServiceHelper.GetUpdateServiceChannel();
- var client = service.CreateChannel();
+
+ var client = new MachineStudioUpdateService();
CheckForUpdatesResponse response = client.CheckForUpdates(new CheckForUpdatesRequest()
{
Email = "ForceUpdate",
Password = "ForceUpdate",
Version = ApplicationManager.Version.ToString(),
- });
+ }).Result;
if (response.IsUpdateAvailable && response.ForcedUpdate)
{
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs
index c9cd3276f..befad162c 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs
@@ -359,8 +359,7 @@ namespace Tango.MachineStudio.UI.ViewModels
{
if (_authenticationProvider.CurrentUser != null)
{
- var service = UpdateServiceHelper.GetUpdateServiceChannel();
- var client = service.CreateChannel();
+ var client = new MachineStudioUpdateService();
CheckForUpdatesResponse response = client.CheckForUpdates(new CheckForUpdatesRequest()
{
@@ -368,7 +367,7 @@ namespace Tango.MachineStudio.UI.ViewModels
Password = _authenticationProvider.CurrentUser.Password,
Version = _applicationManager.Version.ToString(),
AcceptBetaRelease = _settings.AcceptBetaRelease,
- });
+ }).Result;
IsUpdateAvailable = response.IsUpdateAvailable;
LatestVersion = response.Version;
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;