Update con nuova libs x generare QRCode....

This commit is contained in:
Samuele E. Locatelli
2019-04-03 16:13:00 +02:00
parent eeea58e700
commit fab1cedef4
5 changed files with 68 additions and 13 deletions
+30 -2
View File
@@ -1,4 +1,5 @@
using MConnectSDK;
using QRCoder;
using System;
using System.Collections.Generic;
using System.Drawing;
@@ -214,8 +215,18 @@ namespace TestClient
sb.AppendLine(authData.UserCode.ToString());
sb.AppendLine("");
lblRetData.Text = sb.ToString();
// genero QRCode
QRCodeGenerator qrGenerator = new QRCodeGenerator();
QRCodeData qrCodeData = qrGenerator.CreateQrCode(authData.QrCode, QRCodeGenerator.ECCLevel.Q);
QRCode qrCode = new QRCode(qrCodeData);
Bitmap qrCodeImage = qrCode.GetGraphic(5);
pictBox.Image = qrCodeImage;
#if false
Zen.Barcode.CodeQrBarcodeDraw qrcode = Zen.Barcode.BarcodeDrawFactory.CodeQr;
pictBox.Image = qrcode.Draw(authData.QrCode, 50);
pictBox.Image = qrcode.Draw(authData.QrCode, 50);
#endif
}
}
}
@@ -483,6 +494,7 @@ namespace TestClient
private void btnResetParam_Click(object sender, EventArgs e)
{
txtConfFile.Text = "mconnect.conf.yaml";
txtUploadFile.Text = "file2upload.zip";
reqStatus = new Result();
lblReqStatus.Text = "";
lblConsole.Text = "";
@@ -836,7 +848,7 @@ namespace TestClient
await Task.Run(() =>
{
var taskResult = MCC.TryUpLoadFile(token, progress, txtConfFile.Text.Trim());
var taskResult = MCC.TryUpLoadFile(token, progress, txtUploadFile.Text.Trim());
// salvo il risultato restituito...
reqStatus = taskResult.Result;
@@ -846,5 +858,21 @@ namespace TestClient
}), "");
});
}
private void btnFakeQR_Click(object sender, EventArgs e)
{
// testing di generazione QRCODE....
string usr_cod = "GJU17-2DCH";
string mach_id = "cjtfprjdv00i40xm76xmgu0ba";
string fullString = string.Format("https://stg.maestroconnect.scmgroup.com/scm/settings/machine-settings/?nav=activation&user_code={0}&machineID=", usr_cod, mach_id);
QRCodeGenerator qrGenerator = new QRCodeGenerator();
QRCodeData qrCodeData = qrGenerator.CreateQrCode(fullString, QRCodeGenerator.ECCLevel.Q);
QRCode qrCode = new QRCode(qrCodeData);
Bitmap qrCodeImage = qrCode.GetGraphic(5);
pictBox.Image = qrCodeImage;
}
}
}