diff options
4 files changed, 50 insertions, 34 deletions
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 6ef2f946b..642707e87 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs @@ -914,6 +914,7 @@ namespace Tango.PPC.Common.MachineUpdate } catch (Exception ex) { + _isUpdating = false; OnFailed(ex, result, update_response, performDatabaseRollback, dbBackupFile, backupsFolder, null, localDataSource, _newPackageTempFolder); } @@ -929,48 +930,56 @@ namespace Tango.PPC.Common.MachineUpdate { return Task.Factory.StartNew<CheckForUpdateResponse>(() => { - _isUpdating = true; + try + { + _isUpdating = true; - var machineServiceAddress = _settings.GetMachineServiceAddress(); + var machineServiceAddress = _settings.GetMachineServiceAddress(); - LogManager.Log($"Connecting to machine service on {machineServiceAddress}..."); + LogManager.Log($"Connecting to machine service on {machineServiceAddress}..."); - String machineGuid = _machineProvider.Machine.Guid; + String machineGuid = _machineProvider.Machine.Guid; - Login(machineGuid).GetAwaiter().GetResult(); + Login(machineGuid).GetAwaiter().GetResult(); - LogManager.Log($"Checking if updates available..."); + LogManager.Log($"Checking if updates available..."); - CheckForUpdateRequest request = new CheckForUpdateRequest(); - request.Version = _app_manager.Version.ToString(); - request.FirmwareVersion = _app_manager.FirmwareVersion?.ToString(); + CheckForUpdateRequest request = new CheckForUpdateRequest(); + request.Version = _app_manager.Version.ToString(); + request.FirmwareVersion = _app_manager.FirmwareVersion?.ToString(); - try - { - request.MachineLastUpdated = _machineProvider.Machine.LastUpdated; + try + { + request.MachineLastUpdated = _machineProvider.Machine.LastUpdated; - using (ObservablesContext db = ObservablesContext.CreateDefault()) + using (ObservablesContext db = ObservablesContext.CreateDefault()) + { + request.Rmls = db.Rmls.ToList().Select(x => new UpdatedEntity(x)).ToList(); + request.HardwareVersions = db.HardwareVersions.ToList().Select(x => new UpdatedEntity(x)).ToList(); + request.Catalogs = db.ColorCatalogs.ToList().Select(x => new UpdatedEntity(x)).ToList(); + request.UsedRmlsGuids = db.Jobs.Select(x => x.RmlGuid).Distinct().ToList(); + } + } + catch (Exception ex) { - request.Rmls = db.Rmls.ToList().Select(x => new UpdatedEntity(x)).ToList(); - request.HardwareVersions = db.HardwareVersions.ToList().Select(x => new UpdatedEntity(x)).ToList(); - request.Catalogs = db.ColorCatalogs.ToList().Select(x => new UpdatedEntity(x)).ToList(); - request.UsedRmlsGuids = db.Jobs.Select(x => x.RmlGuid).Distinct().ToList(); + LogManager.Log(ex, "An error occurred while trying to fill the existing database entities before checking for updates."); } - } - catch (Exception ex) - { - LogManager.Log(ex, "An error occurred while trying to fill the existing database entities before checking for updates."); - } - CheckForUpdateResponse update_response = null; + CheckForUpdateResponse update_response = null; - update_response = _client.CheckForUpdates(request).Result; + update_response = _client.CheckForUpdates(request).Result; - LogManager.Log($"Check for update response received: {Environment.NewLine}{update_response.ToJsonString()}"); + LogManager.Log($"Check for update response received: {Environment.NewLine}{update_response.ToJsonString()}"); - _isUpdating = false; + _isUpdating = false; - return update_response; + return update_response; + } + catch (Exception ex) + { + _isUpdating = false; + throw ex; + } }); } @@ -986,7 +995,6 @@ namespace Tango.PPC.Common.MachineUpdate return Task.Factory.StartNew(() => { - _isUpdating = true; UpdateDBResponse update_response = null; var localDataSource = SettingsManager.Default.GetOrCreate<CoreSettings>().DataSource; bool performDatabaseRollback = false; @@ -994,6 +1002,8 @@ namespace Tango.PPC.Common.MachineUpdate try { + _isUpdating = true; + LogManager.Log("Starting database update..."); if (_machineProvider.MachineOperator.IsPrinting) @@ -1098,6 +1108,7 @@ namespace Tango.PPC.Common.MachineUpdate } catch (Exception ex) { + _isUpdating = false; OnFailed(ex, update_response, performDatabaseRollback, dbBackupFile, localDataSource); throw ex; } @@ -1495,6 +1506,7 @@ namespace Tango.PPC.Common.MachineUpdate } catch (Exception ex) { + _isUpdating = false; OnFailed(ex, result, null, performDatabaseRollback, dbBackupFile, backupsFolder, tempDbName, localDataSource, _newPackageTempFolder, publishInfo); } @@ -1579,6 +1591,8 @@ namespace Tango.PPC.Common.MachineUpdate } catch (Exception ex) { + _isUpdating = false; + try { if (stream != null) @@ -1728,7 +1742,7 @@ namespace Tango.PPC.Common.MachineUpdate } catch (Exception ex) { - Debug.WriteLine(ex); + LogManager.Log(ex, "Error occurred while checking for software update."); } _checkForUpdateTimer.Start(); diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest index d72e75011..efc5f8179 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest @@ -16,7 +16,7 @@ Remove this element if your application requires this virtualization for backwards compatibility. --> - <requestedExecutionLevel level="requireAdministrator" uiAccess="false" /> + <!--<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />--> </requestedPrivileges> </security> </trustInfo> diff --git a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs index a4639f874..ab007329f 100644 --- a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs +++ b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs @@ -832,6 +832,8 @@ namespace Tango.Emulations.Emulators nextStopPosition = jobTicket.Segments[seg_index + 1].Length; } + calculatedStopIndexes = new List<int>(); + for (int index = 0; index < segment.BrushStops.Count(); index++) { var stop = segment.BrushStops[index]; @@ -885,10 +887,10 @@ namespace Tango.Emulations.Emulators foreach (var packLevel in MachineStatus.IDSPacksLevels) { - Debug.WriteLine($"packLevel.DispenserLevel = {packLevel.DispenserLevel}"); - Debug.WriteLine($"quantity = {130000000 - packLevel.DispenserLevel}"); - Debug.WriteLine($"packLevel.Index = {packLevel.Index}"); + Debug.WriteLine($"Emulator: Pack Index = {packLevel.Index}"); + Debug.WriteLine($"Emulator: Quantity = {MachineOperator.MAX_DISPENSER_NANOLITER - packLevel.DispenserLevel}"); } + jobTicket = null; if (_cancelJob) diff --git a/Software/Visual_Studio/Tango.Web/TangoWebClient.cs b/Software/Visual_Studio/Tango.Web/TangoWebClient.cs index 7c3c6ad2a..6399c2a09 100644 --- a/Software/Visual_Studio/Tango.Web/TangoWebClient.cs +++ b/Software/Visual_Studio/Tango.Web/TangoWebClient.cs @@ -109,7 +109,7 @@ namespace Tango.Web var response = await _client.PostJson<TRequest, TResponse>(GetActionAddress(action), request); return response; } - catch (TokenExpiredException ex) + catch (TokenExpiredException) { try { |
