aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2019-02-18 16:58:37 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2019-02-18 16:58:37 +0200
commit473d878e3ae795201223b160fcbc1147e901b038 (patch)
treefaedd2a3fa181deb297ec2232a171289161738f7 /Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs
parentccc6add5ea66565453283d7df0f6fbf2324b9264 (diff)
downloadTango-473d878e3ae795201223b160fcbc1147e901b038.tar.gz
Tango-473d878e3ae795201223b160fcbc1147e901b038.zip
Working on PPC versioning services...
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.cs31
1 files changed, 28 insertions, 3 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 488206590..b5140e336 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs
@@ -22,6 +22,7 @@ using Tango.PPC.Common.Connection;
using Tango.PPC.Common.OS;
using Tango.PPC.Common.RemoteAssistance;
using Tango.PPC.Common.UWF;
+using Tango.PPC.Common.Web;
using Tango.Settings;
using Tango.SharedUI.Helpers;
using Tango.SQLExaminer;
@@ -39,6 +40,7 @@ namespace Tango.PPC.Common.MachineSetup
private IRemoteAssistanceProvider _remoteAssistance;
private IUnifiedWriteFilterManager _uwf;
private IOperationSystemManager _windows_manager;
+ private String _accessToken;
#region Events
@@ -80,6 +82,27 @@ namespace Tango.PPC.Common.MachineSetup
#endregion
+ #region Private Methods
+
+ private Task Login(String serialNumber)
+ {
+ return Task.Factory.StartNew(() =>
+ {
+ using (var client = new PPCWebService())
+ {
+ var response = client.Login(new LoginRequest()
+ {
+ Mode = LoginMode.Machine,
+ SerialNumber = serialNumber,
+ }).Result;
+
+ _accessToken = response.AccessToken;
+ }
+ });
+ }
+
+ #endregion
+
#region Public Methods
/// <summary>
@@ -105,16 +128,18 @@ namespace Tango.PPC.Common.MachineSetup
LogManager.Log($"Connecting to machine service on {machineServiceAddress}...");
+ await Login(serialNumber);
+
MachineSetupRequest request = new MachineSetupRequest();
- request.SerialNumber = serialNumber;
+ request.AccessToken = _accessToken;
MachineSetupResponse setup_response = null;
try
{
- using (var http = new WebTransportClient())
+ using (var client = new PPCWebService())
{
- setup_response = await http.PostJson<MachineSetupRequest, MachineSetupResponse>(machineServiceAddress + "/api/PPC/MachineSetup", request);
+ setup_response = await client.MachineSetup(request);
}
}
catch (Exception ex)