aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2018-12-20 15:07:43 +0200
committerShlomo Hecht <shlomo@twine-s.com>2018-12-20 15:07:43 +0200
commit64367a944ebddc998b06eb2673928ef95ffc3627 (patch)
treeb30eff3671d388d23c10a91a82cc25a6d42d548f /Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs
parent4554080793bd46fcb8f55578d2f67917584dc332 (diff)
parentd204e56c57dcf52f31c9e64222f32a678150e721 (diff)
downloadTango-64367a944ebddc998b06eb2673928ef95ffc3627.tar.gz
Tango-64367a944ebddc998b06eb2673928ef95ffc3627.zip
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs')
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs68
1 files changed, 43 insertions, 25 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs
index ead508488..1f86e0953 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs
@@ -19,7 +19,9 @@ using Tango.Integration.Operation;
using Tango.PMR.Synchronization;
using Tango.PPC.Common.Application;
using Tango.PPC.Common.Connection;
+using Tango.PPC.Common.OS;
using Tango.PPC.Common.RemoteAssistance;
+using Tango.PPC.Common.UWF;
using Tango.Settings;
using Tango.SharedUI.Helpers;
using Tango.SQLExaminer;
@@ -35,6 +37,8 @@ namespace Tango.PPC.Common.MachineSetup
public class MachineSetupManager : ExtendedObject, IMachineSetupManager
{
private IRemoteAssistanceProvider _remoteAssistance;
+ private IUnifiedWriteFilterManager _uwf;
+ private IWindowsActivationManager _windows_activation_manager;
#region Events
@@ -67,9 +71,11 @@ namespace Tango.PPC.Common.MachineSetup
/// Initializes a new instance of the <see cref="MachineSetupManager"/> class.
/// </summary>
/// <param name="remoteAssistance">The remote assistance.</param>
- public MachineSetupManager(IRemoteAssistanceProvider remoteAssistance)
+ public MachineSetupManager(IRemoteAssistanceProvider remoteAssistance, IUnifiedWriteFilterManager unifiedWriterFilterManager, IWindowsActivationManager windowsActivationManager)
{
_remoteAssistance = remoteAssistance;
+ _uwf = unifiedWriterFilterManager;
+ _windows_activation_manager = windowsActivationManager;
}
#endregion
@@ -92,23 +98,7 @@ namespace Tango.PPC.Common.MachineSetup
IMachineOperator op = null;
- var demoMode = SettingsManager.Default.GetOrCreate<PPCSettings>().DemoMode;
-
- if (!demoMode)
- {
- //Connecting to machine...
- LogManager.Log("Initiating machine connection...");
-
- UpdateProgress("Connecting to machine", "Connecting...");
- op = await DefaultMachineProvider.CreateMinimalMachineOperator((msg) =>
- {
- UpdateProgress("Connecting to machine", msg);
- });
- }
- else
- {
- LogManager.Log("Application in demo mode. Skipping machine connection...");
- }
+ var settings = SettingsManager.Default.GetOrCreate<PPCSettings>();
//Connect to machine service and get matching packages for this machine.
UpdateProgress("Validating serial number", "Connecting to machine service...");
@@ -122,9 +112,9 @@ namespace Tango.PPC.Common.MachineSetup
try
{
- using (var http = new ProtoWebClient())
+ using (var http = new WebTransportClient())
{
- setup_response = await http.Post<MachineSetupRequest, MachineSetupResponse>(machineServiceAddress + "/api/Synchronization/MachineSetup", request);
+ setup_response = await http.PostJson<MachineSetupRequest, MachineSetupResponse>(machineServiceAddress + "/api/PPC/MachineSetup", request);
}
}
catch (Exception ex)
@@ -134,9 +124,38 @@ namespace Tango.PPC.Common.MachineSetup
LogManager.Log($"Machine setup response received: {Environment.NewLine}{setup_response.ToJsonString()}");
- LogManager.Log("Installing remote assistance...");
- UpdateProgress("Installing remote assistance", "Installing...");
- await _remoteAssistance.InstallRemoteAssistance();
+ if (setup_response.SetupFirmware)
+ {
+ //Connecting to machine...
+ LogManager.Log("Initiating machine connection...");
+
+ UpdateProgress("Connecting to machine", "Connecting...");
+ op = await DefaultMachineProvider.CreateMinimalMachineOperator((msg) =>
+ {
+ UpdateProgress("Connecting to machine", msg);
+ });
+ }
+
+ if (setup_response.SetupActivation)
+ {
+ LogManager.Log("Activating windows license...");
+ UpdateProgress("Activating operation system license", "Activating...");
+ await _windows_activation_manager.Activate(setup_response.OSKey);
+ }
+
+ if (setup_response.SetupRemoteAssistance)
+ {
+ LogManager.Log("Installing remote assistance...");
+ UpdateProgress("Installing remote assistance", "Installing...");
+ await _remoteAssistance.InstallRemoteAssistance(serialNumber);
+ }
+
+ if (setup_response.SetupUWF)
+ {
+ LogManager.Log("Activating unified write filter...");
+ UpdateProgress("Activating disk protection", "Activating...");
+ await _uwf.Setup();
+ }
//Create temporary folders for packages.
var _newPackageTempFolder = TemporaryManager.CreateFolder();
@@ -269,7 +288,7 @@ namespace Tango.PPC.Common.MachineSetup
throw LogManager.Log(ex, "Setup manager error while trying to synchronize database.");
}
- if (!demoMode)
+ if (setup_response.SetupFirmware)
{
//Updating firmware
UpdateProgress("Updating Firmware", "Connecting to firmware device...");
@@ -307,7 +326,6 @@ namespace Tango.PPC.Common.MachineSetup
}
else
{
- LogManager.Log("Application in demo mode. Skipping firmware upgrade...");
result.SetResult(new MachineSetupResult()
{
UpdatePackagePath = _newPackageTempFolder,