aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2019-04-23 22:25:54 +0300
committerShlomo Hecht <shlomo@twine-s.com>2019-04-23 22:25:54 +0300
commitebcb9ce27131e4bbd14c96b5f897a67bc752aaeb (patch)
tree293aee8b1751ce7fce542645722c0f1a96b73097 /Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate
parent52967e858bd52621208f6360e84f4c47ec435816 (diff)
parent636ad730569dfef1a4ee04c8d716d510bcc47ee1 (diff)
downloadTango-ebcb9ce27131e4bbd14c96b5f897a67bc752aaeb.tar.gz
Tango-ebcb9ce27131e4bbd14c96b5f897a67bc752aaeb.zip
merge alarm handling from remote
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate')
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs18
1 files changed, 11 insertions, 7 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 952944cf9..b64b624fe 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs
@@ -75,13 +75,10 @@ namespace Tango.PPC.Common.MachineUpdate
private Task Login(String serialNumber)
{
- return Task.Factory.StartNew(() =>
+ return _client.Login(new LoginRequest()
{
- return _client.Login(new LoginRequest()
- {
- Mode = LoginMode.Machine,
- SerialNumber = serialNumber,
- }).Result;
+ Mode = LoginMode.Machine,
+ SerialNumber = serialNumber,
});
}
@@ -310,7 +307,7 @@ namespace Tango.PPC.Common.MachineUpdate
LogManager.Log($"Connecting to machine service on {machineServiceAddress}...");
- Login(serialNumber).Wait();
+ Login(serialNumber).GetAwaiter().GetResult();
LogManager.Log($"Checking if updates available...");
@@ -340,6 +337,8 @@ namespace Tango.PPC.Common.MachineUpdate
{
LogManager.Log("Starting database update...");
+ UpdateProgress("Updating Database", "Initializing...");
+
LogManager.Log("Looking for update scripts configuration on application path...");
String config_file = Path.Combine(PathHelper.GetStartupPath(), "Update Scripts", "config.xml");
@@ -355,6 +354,8 @@ namespace Tango.PPC.Common.MachineUpdate
LogManager.Log($"Updating database '{update_response.DataSource.ToString()}' => '{localDataSource.ToString()}'...");
+ UpdateProgress("Updating Database", "Initializing update sequence...");
+
ExaminerSequenceConfiguration config_sequence = ExaminerSequenceConfiguration.FromFile(config_file);
foreach (var item in config_sequence.Items.Where(x => x.Type == ExaminerSequenceItemType.Data).OrderBy(x => x.Index))
@@ -382,6 +383,8 @@ namespace Tango.PPC.Common.MachineUpdate
try
{
+ UpdateProgress("Updating Database", item.Name + "...");
+
var result = process.Execute().Result;
if (result.ExitCode != ExaminerProcessExitCode.Success)
@@ -397,6 +400,7 @@ namespace Tango.PPC.Common.MachineUpdate
}
}
+ UpdateProgress("Updating Database", "Database synchronization completed successfully.");
LogManager.Log("Update completed successfully.");
});
}