Fix errori segnalati da Damiano e Ferdinando
This commit is contained in:
+58
-8
@@ -119,11 +119,13 @@ namespace TestClient
|
||||
sb.AppendLine("-------------------------");
|
||||
if (reqStatus != null)
|
||||
{
|
||||
sb.AppendLine("isAuth: " + reqStatus.isAuth);
|
||||
sb.AppendLine("isHmiEnrolled: " + reqStatus.isHmiEnrolled);
|
||||
sb.AppendLine("isAuth: " + reqStatus.IsAuth);
|
||||
sb.AppendLine("isHmiEnrolled: " + reqStatus.IsHmiEnrolled);
|
||||
sb.AppendLine("cloudConnection: " + reqStatus.CloudStatusOk);
|
||||
sb.AppendLine("localConnection: " + reqStatus.LocalStatusOk);
|
||||
sb.AppendLine("callSuccess: " + reqStatus.CallResultOk);
|
||||
sb.AppendLine("");
|
||||
sb.AppendLine(string.Format("{0:HH.mm.ss.fff}", DateTime.Now));
|
||||
sb.AppendLine("-------------------------");
|
||||
}
|
||||
lblReqStatus.Text = sb.ToString();
|
||||
@@ -135,7 +137,7 @@ namespace TestClient
|
||||
if (reqStatus != null)
|
||||
{
|
||||
// se NON enrolled --> abilita tryAuth...
|
||||
btnTryAuth.Enabled = !reqStatus.isHmiEnrolled;
|
||||
btnTryAuth.Enabled = !reqStatus.IsHmiEnrolled;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,11 +150,11 @@ namespace TestClient
|
||||
// aggiorno console...
|
||||
lblConsole.Text = authData.Message;
|
||||
// verifico se sia AUTH (altrimenti NON mostro codice e QR...)
|
||||
if (authData.HasAuth || reqStatus.isAuth)
|
||||
if (authData.HasAuth || reqStatus.IsAuth)
|
||||
{
|
||||
var currColor = Color.Orange;
|
||||
// se fosse ANCHE enrolled cambio colore...
|
||||
if (authData.IsEnrolled || reqStatus.isHmiEnrolled)
|
||||
if (authData.IsEnrolled || reqStatus.IsHmiEnrolled)
|
||||
{
|
||||
currColor = Color.Green;
|
||||
}
|
||||
@@ -168,7 +170,7 @@ namespace TestClient
|
||||
pictBox.Image = bitmap;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.AppendLine("AUTH DONE!");
|
||||
if (authData.IsEnrolled || reqStatus.isHmiEnrolled)
|
||||
if (authData.IsEnrolled || reqStatus.IsHmiEnrolled)
|
||||
{
|
||||
sb.AppendLine("------");
|
||||
sb.AppendLine("ENROLLED!");
|
||||
@@ -225,10 +227,10 @@ namespace TestClient
|
||||
await Task.Run(() =>
|
||||
{
|
||||
// NUOVA istanza da file di conf...
|
||||
MCC = new MConnectClient(confFilePath);
|
||||
MCC = new MConnectClient();
|
||||
|
||||
// init async...
|
||||
var taskResult = MCC.initSDKAsync(CancellationToken.None);
|
||||
var taskResult = MCC.InitSDKAsync(confFilePath, CancellationToken.None);
|
||||
// ora leggo lo status...
|
||||
taskResult = MCC.GetClientStatusAsync();
|
||||
|
||||
@@ -267,6 +269,24 @@ namespace TestClient
|
||||
});
|
||||
}
|
||||
/// <summary>
|
||||
/// Recupero client status
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private async Task getClientStatus()
|
||||
{
|
||||
await Task.Run(() =>
|
||||
{
|
||||
var taskResult = MCC.GetClientStatusAsync();
|
||||
// salvo il risultato restituito...
|
||||
reqStatus = taskResult.Result;
|
||||
|
||||
synchronizationContext.Post(new SendOrPostCallback(o =>
|
||||
{
|
||||
refreshRequestStatus();
|
||||
}), "");
|
||||
});
|
||||
}
|
||||
/// <summary>
|
||||
/// Recupero UserList
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
@@ -362,6 +382,9 @@ namespace TestClient
|
||||
chkTestMode.Checked = true;
|
||||
txtConfFile.Text = "mconnect.conf.yaml";
|
||||
txtTokenRet.Text = "403";
|
||||
reqStatus = new Result();
|
||||
lblReqStatus.Text = "";
|
||||
lblConsole.Text = "";
|
||||
fixDisplay();
|
||||
}
|
||||
/// <summary>
|
||||
@@ -428,6 +451,9 @@ namespace TestClient
|
||||
// gestione progress...
|
||||
var progressHandler = new Progress<Result>(value =>
|
||||
{
|
||||
// aggiorno richeista live...
|
||||
reqStatus = value;
|
||||
refreshRequestStatus();
|
||||
// mostro i dati SPECIFICI x AUTH...
|
||||
updateAuthData((ActivationPayload)value.Payload);
|
||||
});
|
||||
@@ -441,6 +467,15 @@ namespace TestClient
|
||||
var initObj = MCC.TryActivationAsync(token, progress);
|
||||
// ora processo attivazione
|
||||
initObj = MCC.EnrollMachineAsync(token, progress);
|
||||
// recupero dati e aggiorno display...
|
||||
var taskResult = MCC.GetClientStatusAsync();
|
||||
// salvo il risultato restituito...
|
||||
reqStatus = taskResult.Result;
|
||||
// aggiorno display
|
||||
synchronizationContext.Post(new SendOrPostCallback(o =>
|
||||
{
|
||||
refreshRequestStatus();
|
||||
}), "");
|
||||
});
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
@@ -525,5 +560,20 @@ namespace TestClient
|
||||
|
||||
#endregion
|
||||
|
||||
private async void btnGetClientStatus_Click(object sender, EventArgs e)
|
||||
{
|
||||
// init in modalità Task based...
|
||||
await Task.Run(() =>
|
||||
{
|
||||
var retObj = getClientStatus();
|
||||
});
|
||||
|
||||
// aggiorno log console
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.AppendLine("--------------------------------------------------");
|
||||
sb.AppendLine(string.Format("{0:HH.mm.ss.fff} | ClientStatus requested", DateTime.Now));
|
||||
sb.AppendLine("");
|
||||
lblConsole.Text = sb.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user