aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher/MainWindowVM.cs
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.Publisher/MainWindowVM.cs
parentde762e7e5b346af5a12eff04cbaa0696eec15b8c (diff)
downloadTango-c3ed01b6c75c44cfeca650b43deb058b1551a9bb.tar.gz
Tango-c3ed01b6c75c44cfeca650b43deb058b1551a9bb.zip
Moved machine studio update azure !!!
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher/MainWindowVM.cs')
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher/MainWindowVM.cs40
1 files changed, 17 insertions, 23 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher/MainWindowVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher/MainWindowVM.cs
index ffeefb820..73f3f5bed 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher/MainWindowVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher/MainWindowVM.cs
@@ -19,6 +19,7 @@ using Tango.MachineStudio.Common;
using Tango.MachineStudio.Common.Update;
using Tango.Settings;
using Tango.SharedUI;
+using Tango.Transport.Web;
namespace Tango.MachineStudio.Publisher
{
@@ -26,7 +27,6 @@ namespace Tango.MachineStudio.Publisher
{
private BasicHashGenerator _hashGenerator;
private String _appPath = AppDomain.CurrentDomain.BaseDirectory + "..\\Release";
- private ChannelFactory<IMachineStudioUpdateService> _service;
private IMachineStudioUpdateService _client;
private String _email;
@@ -114,14 +114,15 @@ namespace Tango.MachineStudio.Publisher
public MainWindowVM()
{
+ _client = new MachineStudioUpdateService();
+
MaxProgress = 100;
_hashGenerator = new BasicHashGenerator();
PublishCommand = new RelayCommand(Publish, () => Email != null && Password != null && Comments != null && CurrentVersion != null && LatestVersion != null && !IsUpdating && Version.Parse(CurrentVersion) > Version.Parse(LatestVersion));
- _service = UpdateServiceHelper.GetUpdateServiceChannel();
- _client = _service.CreateChannel();
+ var client = new MachineStudioUpdateService();
UpdateVersions();
@@ -136,7 +137,7 @@ namespace Tango.MachineStudio.Publisher
private void UpdateVersions()
{
CurrentVersion = FileVersionInfo.GetVersionInfo(_appPath + "\\Tango.MachineStudio.UI.exe").ProductVersion;
- LatestVersion = _client.GetLatestVersion();
+ LatestVersion = _client.GetLatestVersion(new LatestVersionRequest()).Result.Version;
}
private void Publish()
@@ -152,7 +153,7 @@ namespace Tango.MachineStudio.Publisher
Task.Factory.StartNew(() =>
{
IsUpdating = true;
- String tempFile = String.Empty;
+ String tempFile = TemporaryManager.CreateFile();
try
{
@@ -164,9 +165,7 @@ namespace Tango.MachineStudio.Publisher
Comments = Comments,
ForcedUpdate = ForcedUpdate,
IsStable = IsStable,
- });
-
- tempFile = Path.Combine(Path.GetTempPath(), response.FileName);
+ }).Result;
using (ZipFile zip = new ZipFile())
{
@@ -190,28 +189,23 @@ namespace Tango.MachineStudio.Publisher
Progress = 0;
MaxProgress = 100;
- FileStreamWrapper fs = null;
-
- using (fs = new FileStreamWrapper(tempFile, FileMode.Open, (current) =>
- {
- InvokeUINow(() =>
- {
- Thread.Sleep(10);
- Progress = ((double)current / (double)fs.Length) * 100d;
- });
- }))
+ using (StorageBlobUploader uploader = new StorageBlobUploader(response.BlobAddress,tempFile))
{
- using (FtpClient ftp = new FtpClient(response.FtpHost, response.UserName, response.Password))
+ uploader.Progress += (x, e) =>
{
- ftp.ConnectAsync().Wait();
- ftp.UploadAsync(fs, response.FilePath, FtpExists.Overwrite, true).Wait();
- }
+ InvokeUINow(() =>
+ {
+ Progress = ((double)e.Current / (double)e.Total) * 100d;
+ });
+ };
+
+ uploader.Upload().Wait();
}
_client.NotifyUploadCompleted(new UploadCompletedRequest()
{
Token = response.Token,
- });
+ }).Wait();
Progress = 0;
UpdateVersions();