From 5e66f7f601bfbb2f4d46b7b379fd37a5cb88d0bf Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Wed, 8 Aug 2018 18:06:43 +0300 Subject: Working on machine setup. --- .../MachineSetup/IMachineSetupManager.cs | 2 ++ .../MachineSetup/MachineSetupManager.cs | 27 ++++++++++++++++------ .../MachineSetup/MachineSetupSteps.cs | 2 +- 3 files changed, 23 insertions(+), 8 deletions(-) (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Common') diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/IMachineSetupManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/IMachineSetupManager.cs index 69acfbbcf..52fc5acd1 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/IMachineSetupManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/IMachineSetupManager.cs @@ -10,6 +10,8 @@ namespace Tango.PPC.Common.MachineSetup { MachineSetupSteps CurrentStep { get; } event EventHandler ProgressLog; + double UpdatingPackagesProgress { get; } + String UpdatingPackagesStatus { get; } event EventHandler ProgressStep; Task Setup(String serialNumber, String hostAddress); } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs index f469fb799..dc5164465 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs @@ -37,10 +37,17 @@ namespace Tango.PPC.Common.MachineSetup } private double _downloadProgress; - public double DownloadProgress + public double UpdatingPackagesProgress { get { return _downloadProgress; } - set { _downloadProgress = value; RaisePropertyChangedAuto(); } + private set { _downloadProgress = value; RaisePropertyChangedAuto(); } + } + + private String _updatingPackagesStatus; + public String UpdatingPackagesStatus + { + get { return _updatingPackagesStatus; } + set { _updatingPackagesStatus = value; RaisePropertyChangedAuto(); } } public Task Setup(string serialNumber, string machineServiceAddress) @@ -49,7 +56,9 @@ namespace Tango.PPC.Common.MachineSetup { //Connect to machine service and get matching packages for this machine. - CurrentStep = MachineSetupSteps.DownloadingPackage; + CurrentStep = MachineSetupSteps.UpdatingPackages; + UpdatingPackagesProgress = 0; + UpdatingPackagesStatus = "Connecting to machine service..."; MachineSetupRequest request = new MachineSetupRequest(); request.SerialNumber = serialNumber; @@ -72,15 +81,17 @@ namespace Tango.PPC.Common.MachineSetup //Download software package. var tempFile = TemporaryManager.CreateFile(".zip"); + UpdatingPackagesStatus = "Downloading application package..."; + int fileSize = 0; - DownloadProgress = 0; + UpdatingPackagesProgress = 0; using (FileStreamWrapper fs = new FileStreamWrapper(tempFile.Path, FileMode.Create, (current) => { InvokeUINow(() => { Thread.Sleep(10); - DownloadProgress = ((double)current / (double)fileSize) * 100d; + UpdatingPackagesProgress = ((double)current / (double)fileSize) * 100d; }); })) { @@ -102,15 +113,17 @@ namespace Tango.PPC.Common.MachineSetup //Download embedded package. tempFile = TemporaryManager.CreateFile(".zip"); + UpdatingPackagesStatus = "Downloading embedded package..."; + fileSize = 0; - DownloadProgress = 0; + UpdatingPackagesProgress = 0; using (FileStreamWrapper fs = new FileStreamWrapper(tempFile.Path, FileMode.Create, (current) => { InvokeUINow(() => { Thread.Sleep(10); - DownloadProgress = ((double)current / (double)fileSize) * 100d; + UpdatingPackagesProgress = ((double)current / (double)fileSize) * 100d; }); })) { diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupSteps.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupSteps.cs index 3db1eb4b0..1262eb248 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupSteps.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupSteps.cs @@ -10,7 +10,7 @@ namespace Tango.PPC.Common.MachineSetup public enum MachineSetupSteps { [Description("Downloading Package")] - DownloadingPackage, + UpdatingPackages, [Description("Synchronizing Schema")] SynchronizingSchema, [Description("Synchronizing Data")] -- cgit v1.3.1