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
+2 -2
View File
@@ -8,5 +8,5 @@ using System.Runtime.InteropServices;
[assembly: AssemblyCopyright("Copyright © Steamware 2019")]
[assembly: AssemblyTrademark("_")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("1.1.1904.61")]
[assembly: AssemblyFileVersion("1.1.1904.61")]
[assembly: AssemblyVersion("1.1.1904.63")]
[assembly: AssemblyFileVersion("1.1.1904.63")]
+26 -3
View File
@@ -33,6 +33,7 @@
this.toolStripProgressBar1 = new System.Windows.Forms.ToolStripProgressBar();
this.lblClock = new System.Windows.Forms.ToolStripStatusLabel();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.txtUploadFile = new System.Windows.Forms.TextBox();
this.btnUploadFile = new System.Windows.Forms.Button();
this.lblUserCode = new System.Windows.Forms.Label();
this.txtConfFile = new System.Windows.Forms.TextBox();
@@ -64,6 +65,7 @@
this.pictBox = new System.Windows.Forms.PictureBox();
this.label6 = new System.Windows.Forms.Label();
this.lblConsole = new System.Windows.Forms.Label();
this.btnFakeQR = new System.Windows.Forms.Button();
this.statusStrip1.SuspendLayout();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
@@ -107,6 +109,8 @@
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox1.AutoSize = true;
this.groupBox1.Controls.Add(this.btnFakeQR);
this.groupBox1.Controls.Add(this.txtUploadFile);
this.groupBox1.Controls.Add(this.btnUploadFile);
this.groupBox1.Controls.Add(this.lblUserCode);
this.groupBox1.Controls.Add(this.txtConfFile);
@@ -118,13 +122,20 @@
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Connection Parameters";
//
// txtUploadFile
//
this.txtUploadFile.Location = new System.Drawing.Point(454, 28);
this.txtUploadFile.Name = "txtUploadFile";
this.txtUploadFile.Size = new System.Drawing.Size(197, 22);
this.txtUploadFile.TabIndex = 32;
//
// btnUploadFile
//
this.btnUploadFile.Location = new System.Drawing.Point(426, 25);
this.btnUploadFile.Location = new System.Drawing.Point(337, 25);
this.btnUploadFile.Name = "btnUploadFile";
this.btnUploadFile.Size = new System.Drawing.Size(111, 32);
this.btnUploadFile.TabIndex = 31;
this.btnUploadFile.Text = "<-- Upload test";
this.btnUploadFile.Text = "Upload test -->";
this.btnUploadFile.UseVisualStyleBackColor = true;
this.btnUploadFile.Click += new System.EventHandler(this.btnUploadFile_Click);
//
@@ -144,7 +155,7 @@
//
this.txtConfFile.Location = new System.Drawing.Point(103, 30);
this.txtConfFile.Name = "txtConfFile";
this.txtConfFile.Size = new System.Drawing.Size(313, 22);
this.txtConfFile.Size = new System.Drawing.Size(228, 22);
this.txtConfFile.TabIndex = 12;
//
// label3
@@ -448,6 +459,16 @@
this.lblConsole.TabIndex = 7;
this.lblConsole.Text = "...";
//
// btnFakeQR
//
this.btnFakeQR.Location = new System.Drawing.Point(932, 23);
this.btnFakeQR.Name = "btnFakeQR";
this.btnFakeQR.Size = new System.Drawing.Size(111, 32);
this.btnFakeQR.TabIndex = 33;
this.btnFakeQR.Text = "fake QR";
this.btnFakeQR.UseVisualStyleBackColor = true;
this.btnFakeQR.Click += new System.EventHandler(this.btnFakeQR_Click);
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
@@ -510,6 +531,8 @@
private System.Windows.Forms.Label lblUserCode;
private System.Windows.Forms.Button btnTryEnroll;
private System.Windows.Forms.Button btnUploadFile;
private System.Windows.Forms.TextBox txtUploadFile;
private System.Windows.Forms.Button btnFakeQR;
}
}
+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;
}
}
}
+7 -4
View File
@@ -52,14 +52,20 @@
<HintPath>..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.4.6.1\lib\net45\NLog.dll</HintPath>
<HintPath>..\packages\NLog.4.6.2\lib\net45\NLog.dll</HintPath>
</Reference>
<Reference Include="NLog.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.Windows.Forms.4.2.3\lib\net35\NLog.Windows.Forms.dll</HintPath>
</Reference>
<Reference Include="QRCoder, Version=1.3.5.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\QRCoder.1.3.5\lib\net40\QRCoder.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing.Common, Version=4.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Drawing.Common.4.5.1\lib\net461\System.Drawing.Common.dll</HintPath>
</Reference>
<Reference Include="System.IO.Compression" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.ServiceModel" />
@@ -73,9 +79,6 @@
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="Zen.Barcode.Core, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b5ae55aa76d2d9de, processorArchitecture=MSIL">
<HintPath>..\packages\Zen.Barcode.Rendering.Framework.3.1.10729.1\lib\Zen.Barcode.Core.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="..\SharedAssemblyInfo.cs">
+3 -2
View File
@@ -1,8 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="12.0.1" targetFramework="net462" />
<package id="NLog" version="4.6.1" targetFramework="net462" />
<package id="NLog" version="4.6.2" targetFramework="net462" />
<package id="NLog.Windows.Forms" version="4.2.3" targetFramework="net462" />
<package id="PrettyBin" version="1.1.0" targetFramework="net462" />
<package id="Zen.Barcode.Rendering.Framework" version="3.1.10729.1" targetFramework="net462" />
<package id="QRCoder" version="1.3.5" targetFramework="net462" />
<package id="System.Drawing.Common" version="4.5.1" targetFramework="net462" />
</packages>