diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2019-12-14 22:33:55 +0200 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2019-12-14 22:33:55 +0200 |
| commit | 51151796efb23162ca0b3d6701d90dfb6d3baeb9 (patch) | |
| tree | 4d159e48858f6e14fb7c689496e67feaa1a88fd5 /Software/Visual_Studio/PPC/Tango.PPC.Common | |
| parent | 76a028f95dc2bdb2aba4a58ca298268be32a5879 (diff) | |
| download | Tango-51151796efb23162ca0b3d6701d90dfb6d3baeb9.tar.gz Tango-51151796efb23162ca0b3d6701d90dfb6d3baeb9.zip | |
Enabled transparent color for catalogs.
Added machine last update check for quick db check PPC = >Service.
Implemented AutoUpdateCheck vai PPC settings. Dropped use of AutoUpdateCheck from DB.
Added skipping over TFP firmware upgrade upload if no other files other than mcu were found.
Added more logs to firmware upgrade.
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Common')
4 files changed, 20 insertions, 8 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/IMachineUpdateManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/IMachineUpdateManager.cs index e11eab3a5..421b4ee54 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/IMachineUpdateManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/IMachineUpdateManager.cs @@ -20,7 +20,7 @@ namespace Tango.PPC.Common.MachineUpdate /// <summary> /// Gets or sets a value indicating whether to automatically check for new application updates. /// </summary> - bool AutoCheckForUpdates { get; set; } + bool EnableAutoCheckForUpdates { get; set; } /// <summary> /// Gets the current machine update progress status. diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs index 4c71c2a1a..088e80f61 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs @@ -41,6 +41,7 @@ namespace Tango.PPC.Common.MachineUpdate private List<LogItemBase> _logs; private System.Timers.Timer _checkForUpdateTimer; private bool _isUpdating; + private PPCSettings _settings; #region Events @@ -77,7 +78,7 @@ namespace Tango.PPC.Common.MachineUpdate /// <summary> /// Gets or sets a value indicating whether to automatically check for new application updates. /// </summary> - public bool AutoCheckForUpdates + public bool EnableAutoCheckForUpdates { get { return _autoCheckForUpdates; } set { _autoCheckForUpdates = value; RaisePropertyChangedAuto(); } @@ -105,6 +106,8 @@ namespace Tango.PPC.Common.MachineUpdate _checkForUpdateTimer = new System.Timers.Timer(TimeSpan.FromMinutes(1).TotalMilliseconds); _checkForUpdateTimer.Elapsed += _checkForUpdateTimer_Elapsed; _checkForUpdateTimer.Start(); + + _settings = SettingsManager.Default.GetOrCreate<PPCSettings>(); } #endregion @@ -421,7 +424,7 @@ namespace Tango.PPC.Common.MachineUpdate { _isUpdating = true; - var machineServiceAddress = SettingsManager.Default.GetOrCreate<PPCSettings>().GetMachineServiceAddress(); + var machineServiceAddress = _settings.GetMachineServiceAddress(); LogManager.Log($"Starting machine update for serial number {serialNumber}..."); @@ -688,7 +691,7 @@ namespace Tango.PPC.Common.MachineUpdate { _isUpdating = true; - var machineServiceAddress = SettingsManager.Default.GetOrCreate<PPCSettings>().GetMachineServiceAddress(); + var machineServiceAddress = _settings.GetMachineServiceAddress(); LogManager.Log($"Connecting to machine service on {machineServiceAddress}..."); @@ -702,6 +705,8 @@ namespace Tango.PPC.Common.MachineUpdate try { + request.MachineLastUpdated = _machineProvider.Machine.LastUpdated; + using (ObservablesContext db = ObservablesContext.CreateDefault()) { request.Rmls = db.Rmls.ToList().Select(x => new UpdatedEntity(x)).ToList(); @@ -861,7 +866,7 @@ namespace Tango.PPC.Common.MachineUpdate { return Task.Factory.StartNew<DbCompareResult>(() => { - var machineServiceAddress = SettingsManager.Default.GetOrCreate<PPCSettings>().GetMachineServiceAddress(); + var machineServiceAddress = _settings.GetMachineServiceAddress(); LogManager.Log($"Checking if database update is required for serial number {serialNumber}..."); @@ -1042,7 +1047,7 @@ namespace Tango.PPC.Common.MachineUpdate throw new InvalidOperationException("The specified tup file is invalid. The package was generated for a different machine."); } - if (publishInfo.MachineDeploymentSlot != SettingsManager.Default.GetOrCreate<PPCSettings>().DeploymentSlot) + if (publishInfo.MachineDeploymentSlot != _settings.DeploymentSlot) { throw new InvalidOperationException("The specified tup file is invalid. The package was generated on a different environment."); } @@ -1292,7 +1297,7 @@ namespace Tango.PPC.Common.MachineUpdate String packagesFolder = Path.Combine(AssemblyHelper.GetCurrentAssemblyFolder(), "packages"); Version previousVersion = null; - String str = SettingsManager.Default.GetOrCreate<PPCSettings>().PreviousApplicationVersion; + String str = _settings.PreviousApplicationVersion; if (Version.TryParse(str, out previousVersion)) { @@ -1333,7 +1338,7 @@ namespace Tango.PPC.Common.MachineUpdate private async void _checkForUpdateTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { - if (AutoCheckForUpdates && !_isUpdating) + if (EnableAutoCheckForUpdates && _settings.AutoCheckForUpdates && !_isUpdating) { _checkForUpdateTimer.Stop(); diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs index acdfb6a8a..cb17f5be3 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs @@ -215,6 +215,11 @@ namespace Tango.PPC.Common public TimeSpan PowerUpScreenTimeout { get; set; } /// <summary> + /// Gets or sets a value indicating whether to automatically check for software and database (quick) updates. + /// </summary> + public bool AutoCheckForUpdates { get; set; } + + /// <summary> /// Gets the machine service address. /// </summary> /// <returns></returns> @@ -255,6 +260,7 @@ namespace Tango.PPC.Common FirmwareVersion = "1.0.0.0"; DisplayPowerUpScreen = true; PowerUpScreenTimeout = TimeSpan.FromSeconds(20); + AutoCheckForUpdates = true; } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/CheckForUpdateRequest.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/CheckForUpdateRequest.cs index 0feb32aaf..3d606b918 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/CheckForUpdateRequest.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/CheckForUpdateRequest.cs @@ -15,6 +15,7 @@ namespace Tango.PPC.Common.Web public List<UpdatedEntity> Rmls { get; set; } public List<UpdatedEntity> HardwareVersions { get; set; } public List<UpdatedEntity> Catalogs { get; set; } + public DateTime MachineLastUpdated { get; set; } public CheckForUpdateRequest() { |
