From 51151796efb23162ca0b3d6701d90dfb6d3baeb9 Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Sat, 14 Dec 2019 22:33:55 +0200 Subject: 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. --- .../Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs | 5 +++++ .../PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml | 3 +-- .../ViewModels/MainViewVM.cs | 10 ++++++++++ .../Tango.PPC.MachineSettings/Views/MainView.xaml | 14 ++++++++++++++ .../MachineUpdate/IMachineUpdateManager.cs | 2 +- .../MachineUpdate/MachineUpdateManager.cs | 19 ++++++++++++------- .../Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs | 6 ++++++ .../PPC/Tango.PPC.Common/Web/CheckForUpdateRequest.cs | 1 + .../Tango.PPC.UI/Printing/DefaultPrintingManager.cs | 2 +- .../Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs | 2 +- 10 files changed, 52 insertions(+), 12 deletions(-) (limited to 'Software/Visual_Studio/PPC') diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs index 798b333e7..785472d0d 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs @@ -414,6 +414,11 @@ namespace Tango.PPC.Jobs.ViewModels Settings.SupportedColorSpaces.Count > 0 ? Settings.SupportedColorSpaces : Enum.GetValues(typeof(ColorSpaces)).Cast().Where(x => x.IsUserSpace() || (ApplicationManager.IsInTechnicianMode && x == ColorSpaces.Volume)).ToList() ); + if (_catalogs.Count == 0) + { + vm.SupportedColorSpaces.Remove(ColorSpaces.Catalog); + } + CatalogSelectionViewVM catalogVM = new CatalogSelectionViewVM(_catalogs.ToList(), _catalogs.ToList().SingleOrDefault(x => x.Guid == settings.LastSelectedCatalogGuid)); if (settings.LastJobType != null) diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml index 9b28d7709..97756ffd5 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml @@ -412,7 +412,6 @@ - @@ -422,7 +421,7 @@ - + diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs index d12617264..5077fd884 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs @@ -144,6 +144,13 @@ namespace Tango.PPC.MachineSettings.ViewModels set { _synchronizeDiagnostics = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } } + private bool _autoCheckForUpdates; + public bool AutoCheckForUpdates + { + get { return _autoCheckForUpdates; } + set { _autoCheckForUpdates = value; RaisePropertyChangedAuto(); } + } + #endregion #region Commands @@ -196,6 +203,7 @@ namespace Tango.PPC.MachineSettings.ViewModels Settings.DefaultSpoolTypeGuid = DefaultSpoolType?.Guid; Settings.SynchronizeJobs = SynchronizeJobs; Settings.SynchronizeDiagnostics = SynchronizeDiagnostics; + Settings.AutoCheckForUpdates = AutoCheckForUpdates; MachineDataSynchronizer.IsEnabled = SynchronizeJobs || SynchronizeDiagnostics; @@ -264,6 +272,8 @@ namespace Tango.PPC.MachineSettings.ViewModels SynchronizeJobs = Settings.SynchronizeJobs; SynchronizeDiagnostics = Settings.SynchronizeDiagnostics; + + AutoCheckForUpdates = Settings.AutoCheckForUpdates; } private async void OnEnableRemoteAssistanceChanged() diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml index 017649f8e..4a2f1e253 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml @@ -199,7 +199,21 @@ + + + Auto Update Check + + + + Automatically check for software and database updates. + + + + + + + Synchronize Jobs 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 /// /// Gets or sets a value indicating whether to automatically check for new application updates. /// - bool AutoCheckForUpdates { get; set; } + bool EnableAutoCheckForUpdates { get; set; } /// /// 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 _logs; private System.Timers.Timer _checkForUpdateTimer; private bool _isUpdating; + private PPCSettings _settings; #region Events @@ -77,7 +78,7 @@ namespace Tango.PPC.Common.MachineUpdate /// /// Gets or sets a value indicating whether to automatically check for new application updates. /// - 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(); } #endregion @@ -421,7 +424,7 @@ namespace Tango.PPC.Common.MachineUpdate { _isUpdating = true; - var machineServiceAddress = SettingsManager.Default.GetOrCreate().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().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(() => { - var machineServiceAddress = SettingsManager.Default.GetOrCreate().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().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().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 @@ -214,6 +214,11 @@ namespace Tango.PPC.Common /// public TimeSpan PowerUpScreenTimeout { get; set; } + /// + /// Gets or sets a value indicating whether to automatically check for software and database (quick) updates. + /// + public bool AutoCheckForUpdates { get; set; } + /// /// Gets the machine service address. /// @@ -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 Rmls { get; set; } public List HardwareVersions { get; set; } public List Catalogs { get; set; } + public DateTime MachineLastUpdated { get; set; } public CheckForUpdateRequest() { diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs index 56ec2fa7e..4c5a87ab4 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs @@ -259,7 +259,7 @@ namespace Tango.PPC.UI.Printing { throw new InvalidOperationException("Error starting job. Color is out of range."); } - if (job.Segments.SelectMany(x => x.BrushStops).Any(x => x.BrushColorSpace == ColorSpaces.Catalog && x.ColorCatalogsItem == null)) + if (job.Segments.SelectMany(x => x.BrushStops).Any(x => x.BrushColorSpace == ColorSpaces.Catalog && x.ColorCatalogsItem == null && !x.IsTransparent)) { throw new InvalidOperationException("Error starting job. Please select a catalog color."); } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs index c0654f643..49b2aef89 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs @@ -297,7 +297,7 @@ namespace Tango.PPC.UI.ViewModels } else { - MachineUpdateManager.AutoCheckForUpdates = MachineProvider.Machine.AutoCheckForUpdates; + MachineUpdateManager.EnableAutoCheckForUpdates = true; } } -- cgit v1.3.1