Fix errori segnalati da Damiano e Ferdinando
This commit is contained in:
Generated
+43
-30
@@ -36,6 +36,7 @@
|
||||
this.btnSetRetVal = new System.Windows.Forms.Button();
|
||||
this.lblTokRet = new System.Windows.Forms.Label();
|
||||
this.txtTokenRet = new System.Windows.Forms.TextBox();
|
||||
this.chkTestMode = new System.Windows.Forms.CheckBox();
|
||||
this.txtConfFile = new System.Windows.Forms.TextBox();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||
@@ -58,7 +59,7 @@
|
||||
this.pictBox = new System.Windows.Forms.PictureBox();
|
||||
this.label6 = new System.Windows.Forms.Label();
|
||||
this.lblConsole = new System.Windows.Forms.Label();
|
||||
this.chkTestMode = new System.Windows.Forms.CheckBox();
|
||||
this.btnGetClientStatus = new System.Windows.Forms.Button();
|
||||
this.statusStrip1.SuspendLayout();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.groupBox2.SuspendLayout();
|
||||
@@ -75,7 +76,7 @@
|
||||
this.lblClock});
|
||||
this.statusStrip1.Location = new System.Drawing.Point(0, 685);
|
||||
this.statusStrip1.Name = "statusStrip1";
|
||||
this.statusStrip1.Size = new System.Drawing.Size(1007, 25);
|
||||
this.statusStrip1.Size = new System.Drawing.Size(1094, 25);
|
||||
this.statusStrip1.TabIndex = 7;
|
||||
this.statusStrip1.Text = "statusStrip1";
|
||||
//
|
||||
@@ -110,7 +111,7 @@
|
||||
this.groupBox1.Controls.Add(this.label3);
|
||||
this.groupBox1.Location = new System.Drawing.Point(13, 12);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Size = new System.Drawing.Size(982, 74);
|
||||
this.groupBox1.Size = new System.Drawing.Size(1069, 74);
|
||||
this.groupBox1.TabIndex = 11;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "Connection Parameters";
|
||||
@@ -142,6 +143,17 @@
|
||||
this.txtTokenRet.TabIndex = 23;
|
||||
this.txtTokenRet.Text = "403";
|
||||
//
|
||||
// chkTestMode
|
||||
//
|
||||
this.chkTestMode.AutoSize = true;
|
||||
this.chkTestMode.Location = new System.Drawing.Point(435, 29);
|
||||
this.chkTestMode.Name = "chkTestMode";
|
||||
this.chkTestMode.Size = new System.Drawing.Size(97, 21);
|
||||
this.chkTestMode.TabIndex = 13;
|
||||
this.chkTestMode.Text = "Test Mode";
|
||||
this.chkTestMode.UseVisualStyleBackColor = true;
|
||||
this.chkTestMode.Click += new System.EventHandler(this.chkTestMode_Click);
|
||||
//
|
||||
// txtConfFile
|
||||
//
|
||||
this.txtConfFile.Location = new System.Drawing.Point(103, 30);
|
||||
@@ -162,6 +174,7 @@
|
||||
//
|
||||
this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.groupBox2.Controls.Add(this.btnGetClientStatus);
|
||||
this.groupBox2.Controls.Add(this.label10);
|
||||
this.groupBox2.Controls.Add(this.txtPwd);
|
||||
this.groupBox2.Controls.Add(this.label9);
|
||||
@@ -174,7 +187,7 @@
|
||||
this.groupBox2.Controls.Add(this.btnResetParam);
|
||||
this.groupBox2.Location = new System.Drawing.Point(13, 88);
|
||||
this.groupBox2.Name = "groupBox2";
|
||||
this.groupBox2.Size = new System.Drawing.Size(982, 100);
|
||||
this.groupBox2.Size = new System.Drawing.Size(1069, 100);
|
||||
this.groupBox2.TabIndex = 14;
|
||||
this.groupBox2.TabStop = false;
|
||||
this.groupBox2.Text = "Metodi";
|
||||
@@ -182,7 +195,7 @@
|
||||
// label10
|
||||
//
|
||||
this.label10.AutoSize = true;
|
||||
this.label10.Location = new System.Drawing.Point(822, 45);
|
||||
this.label10.Location = new System.Drawing.Point(908, 45);
|
||||
this.label10.Name = "label10";
|
||||
this.label10.Size = new System.Drawing.Size(33, 17);
|
||||
this.label10.TabIndex = 23;
|
||||
@@ -190,7 +203,7 @@
|
||||
//
|
||||
// txtPwd
|
||||
//
|
||||
this.txtPwd.Location = new System.Drawing.Point(874, 42);
|
||||
this.txtPwd.Location = new System.Drawing.Point(960, 42);
|
||||
this.txtPwd.Name = "txtPwd";
|
||||
this.txtPwd.Size = new System.Drawing.Size(100, 22);
|
||||
this.txtPwd.TabIndex = 22;
|
||||
@@ -198,7 +211,7 @@
|
||||
// label9
|
||||
//
|
||||
this.label9.AutoSize = true;
|
||||
this.label9.Location = new System.Drawing.Point(822, 16);
|
||||
this.label9.Location = new System.Drawing.Point(908, 16);
|
||||
this.label9.Name = "label9";
|
||||
this.label9.Size = new System.Drawing.Size(36, 17);
|
||||
this.label9.TabIndex = 21;
|
||||
@@ -206,14 +219,14 @@
|
||||
//
|
||||
// txtUser
|
||||
//
|
||||
this.txtUser.Location = new System.Drawing.Point(874, 13);
|
||||
this.txtUser.Location = new System.Drawing.Point(960, 13);
|
||||
this.txtUser.Name = "txtUser";
|
||||
this.txtUser.Size = new System.Drawing.Size(100, 22);
|
||||
this.txtUser.TabIndex = 20;
|
||||
//
|
||||
// btnTryUserLogin
|
||||
//
|
||||
this.btnTryUserLogin.Location = new System.Drawing.Point(825, 70);
|
||||
this.btnTryUserLogin.Location = new System.Drawing.Point(911, 70);
|
||||
this.btnTryUserLogin.Name = "btnTryUserLogin";
|
||||
this.btnTryUserLogin.Size = new System.Drawing.Size(149, 27);
|
||||
this.btnTryUserLogin.TabIndex = 19;
|
||||
@@ -223,7 +236,7 @@
|
||||
//
|
||||
// btnGetUserList
|
||||
//
|
||||
this.btnGetUserList.Location = new System.Drawing.Point(674, 32);
|
||||
this.btnGetUserList.Location = new System.Drawing.Point(760, 32);
|
||||
this.btnGetUserList.Name = "btnGetUserList";
|
||||
this.btnGetUserList.Size = new System.Drawing.Size(118, 49);
|
||||
this.btnGetUserList.TabIndex = 18;
|
||||
@@ -233,7 +246,7 @@
|
||||
//
|
||||
// btnGetOrgCode
|
||||
//
|
||||
this.btnGetOrgCode.Location = new System.Drawing.Point(550, 32);
|
||||
this.btnGetOrgCode.Location = new System.Drawing.Point(636, 32);
|
||||
this.btnGetOrgCode.Name = "btnGetOrgCode";
|
||||
this.btnGetOrgCode.Size = new System.Drawing.Size(118, 49);
|
||||
this.btnGetOrgCode.TabIndex = 17;
|
||||
@@ -294,7 +307,7 @@
|
||||
this.tableLayoutPanel1.RowCount = 2;
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10.90909F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 89.09091F));
|
||||
this.tableLayoutPanel1.Size = new System.Drawing.Size(983, 491);
|
||||
this.tableLayoutPanel1.Size = new System.Drawing.Size(1070, 491);
|
||||
this.tableLayoutPanel1.TabIndex = 15;
|
||||
//
|
||||
// label1
|
||||
@@ -309,7 +322,7 @@
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(199, 0);
|
||||
this.label2.Location = new System.Drawing.Point(217, 0);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(85, 17);
|
||||
this.label2.TabIndex = 1;
|
||||
@@ -318,7 +331,7 @@
|
||||
// label5
|
||||
//
|
||||
this.label5.AutoSize = true;
|
||||
this.label5.Location = new System.Drawing.Point(395, 0);
|
||||
this.label5.Location = new System.Drawing.Point(431, 0);
|
||||
this.label5.Name = "label5";
|
||||
this.label5.Size = new System.Drawing.Size(64, 17);
|
||||
this.label5.TabIndex = 2;
|
||||
@@ -336,7 +349,7 @@
|
||||
// lblRetData
|
||||
//
|
||||
this.lblRetData.AutoSize = true;
|
||||
this.lblRetData.Location = new System.Drawing.Point(199, 53);
|
||||
this.lblRetData.Location = new System.Drawing.Point(217, 53);
|
||||
this.lblRetData.Name = "lblRetData";
|
||||
this.lblRetData.Size = new System.Drawing.Size(20, 17);
|
||||
this.lblRetData.TabIndex = 4;
|
||||
@@ -345,16 +358,16 @@
|
||||
// pictBox
|
||||
//
|
||||
this.pictBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.pictBox.Location = new System.Drawing.Point(395, 56);
|
||||
this.pictBox.Location = new System.Drawing.Point(431, 56);
|
||||
this.pictBox.Name = "pictBox";
|
||||
this.pictBox.Size = new System.Drawing.Size(288, 432);
|
||||
this.pictBox.Size = new System.Drawing.Size(315, 432);
|
||||
this.pictBox.TabIndex = 5;
|
||||
this.pictBox.TabStop = false;
|
||||
//
|
||||
// label6
|
||||
//
|
||||
this.label6.AutoSize = true;
|
||||
this.label6.Location = new System.Drawing.Point(689, 0);
|
||||
this.label6.Location = new System.Drawing.Point(752, 0);
|
||||
this.label6.Name = "label6";
|
||||
this.label6.Size = new System.Drawing.Size(38, 17);
|
||||
this.label6.TabIndex = 6;
|
||||
@@ -366,28 +379,27 @@
|
||||
this.lblConsole.BackColor = System.Drawing.SystemColors.Desktop;
|
||||
this.lblConsole.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.lblConsole.ForeColor = System.Drawing.Color.Lime;
|
||||
this.lblConsole.Location = new System.Drawing.Point(689, 53);
|
||||
this.lblConsole.Location = new System.Drawing.Point(752, 53);
|
||||
this.lblConsole.Name = "lblConsole";
|
||||
this.lblConsole.Size = new System.Drawing.Size(291, 438);
|
||||
this.lblConsole.Size = new System.Drawing.Size(315, 438);
|
||||
this.lblConsole.TabIndex = 7;
|
||||
this.lblConsole.Text = "...";
|
||||
//
|
||||
// chkTestMode
|
||||
// btnGetClientStatus
|
||||
//
|
||||
this.chkTestMode.AutoSize = true;
|
||||
this.chkTestMode.Location = new System.Drawing.Point(435, 29);
|
||||
this.chkTestMode.Name = "chkTestMode";
|
||||
this.chkTestMode.Size = new System.Drawing.Size(97, 21);
|
||||
this.chkTestMode.TabIndex = 13;
|
||||
this.chkTestMode.Text = "Test Mode";
|
||||
this.chkTestMode.UseVisualStyleBackColor = true;
|
||||
this.chkTestMode.Click += new System.EventHandler(this.chkTestMode_Click);
|
||||
this.btnGetClientStatus.Location = new System.Drawing.Point(512, 32);
|
||||
this.btnGetClientStatus.Name = "btnGetClientStatus";
|
||||
this.btnGetClientStatus.Size = new System.Drawing.Size(118, 49);
|
||||
this.btnGetClientStatus.TabIndex = 24;
|
||||
this.btnGetClientStatus.Text = "getClientStatus";
|
||||
this.btnGetClientStatus.UseVisualStyleBackColor = true;
|
||||
this.btnGetClientStatus.Click += new System.EventHandler(this.btnGetClientStatus_Click);
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(1007, 710);
|
||||
this.ClientSize = new System.Drawing.Size(1094, 710);
|
||||
this.Controls.Add(this.tableLayoutPanel1);
|
||||
this.Controls.Add(this.groupBox2);
|
||||
this.Controls.Add(this.groupBox1);
|
||||
@@ -440,6 +452,7 @@
|
||||
private System.Windows.Forms.Label label9;
|
||||
private System.Windows.Forms.TextBox txtUser;
|
||||
private System.Windows.Forms.CheckBox chkTestMode;
|
||||
private System.Windows.Forms.Button btnGetClientStatus;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+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