aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2019-12-17 02:08:31 +0200
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2019-12-17 02:08:31 +0200
commitd99c80d6633d2932cf67fc7013100a639882c6dc (patch)
treeadfd15f59a653699e26818e19319ee40e4dce063 /Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs
parentbdf56799cd6c4c42ec7a8dc36f56ddd17a5feeab (diff)
downloadTango-d99c80d6633d2932cf67fc7013100a639882c6dc.tar.gz
Tango-d99c80d6633d2932cf67fc7013100a639882c6dc.zip
Implemented PPC Updates/Synchronization View.
Refactored database updates to be deleted if no differences. Updated MS and PPC with Offline Updates. Refactored Machine Designer Updates View to take only last 100 update entries.
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs')
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs40
1 files changed, 25 insertions, 15 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 666b6813c..d0424254b 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs
@@ -473,7 +473,7 @@ namespace Tango.PPC.Common.MachineUpdate
_isUpdating = false;
}
- private void OnCompleted(UpdateDBResponse response)
+ private void OnCompleted(UpdateDBResponse response, bool completedWithNoDifferences = false)
{
if (response != null)
{
@@ -483,6 +483,7 @@ namespace Tango.PPC.Common.MachineUpdate
{
Token = response.NotifyCompletedToken,
Status = BL.Enumerations.TangoUpdateStatuses.DatabaseCompleted,
+ ReportsAboutDbCheckNoDifferences = completedWithNoDifferences,
}).Result;
}
catch (Exception ex)
@@ -490,23 +491,26 @@ namespace Tango.PPC.Common.MachineUpdate
LogManager.Log(ex, "Error notifying database completed.");
}
- try
+ if (!completedWithNoDifferences)
{
- using (ObservablesContext db = ObservablesContext.CreateDefault())
+ try
{
- TangoUpdate update = new TangoUpdate();
- update.ApplicationVersion = _app_manager.Version.ToString();
- update.FirmwareVersion = _app_manager.FirmwareVersion.ToString();
- update.MachineGuid = _machineProvider.Machine.Guid;
- update.UpdateStatus = BL.Enumerations.TangoUpdateStatuses.DatabaseCompleted;
- update.StartDate = _updateStartDate;
- update.EndDate = DateTime.UtcNow;
- db.SaveChanges();
+ using (ObservablesContext db = ObservablesContext.CreateDefault())
+ {
+ TangoUpdate update = new TangoUpdate();
+ update.ApplicationVersion = _app_manager.Version.ToString();
+ update.FirmwareVersion = _app_manager.FirmwareVersion.ToString();
+ update.MachineGuid = _machineProvider.Machine.Guid;
+ update.UpdateStatus = BL.Enumerations.TangoUpdateStatuses.DatabaseCompleted;
+ update.StartDate = _updateStartDate;
+ update.EndDate = DateTime.UtcNow;
+ db.SaveChanges();
+ }
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex, "Error saving database update information to database.");
}
- }
- catch (Exception ex)
- {
- LogManager.Log(ex, "Error saving database update information to database.");
}
}
@@ -1091,12 +1095,18 @@ namespace Tango.PPC.Common.MachineUpdate
}
catch (Exception ex)
{
+ OnFailed(ex, update_response, false, null, null);
throw LogManager.Log(ex, "Update manager error while trying to compare the database.");
}
}
LogManager.Log("Comparison completed successfully.");
+ if (!has_differences)
+ {
+ OnCompleted(update_response, true);
+ }
+
return new DbCompareResult()
{
RequiresUpdate = has_differences,