Aggiunto test PDF MERGE

This commit is contained in:
Samuele E. Locatelli
2019-11-30 08:46:52 +01:00
parent a1a5c6a722
commit 533862273e
3 changed files with 103 additions and 15 deletions
+60 -14
View File
@@ -38,8 +38,12 @@
this.txtSourceDir = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.lblHwSwData = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.lblRedis = new System.Windows.Forms.Label();
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.txtMergedName = new System.Windows.Forms.TextBox();
this.button1 = new System.Windows.Forms.Button();
this.lblNumMerged = new System.Windows.Forms.Label();
this.button2 = new System.Windows.Forms.Button();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
@@ -150,33 +154,71 @@
this.lblHwSwData.TabIndex = 3;
this.lblHwSwData.Text = "...";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(22, 108);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(58, 13);
this.label4.TabIndex = 4;
this.label4.Text = "Redis Test";
//
// lblRedis
//
this.lblRedis.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lblRedis.AutoEllipsis = true;
this.lblRedis.Location = new System.Drawing.Point(109, 108);
this.lblRedis.Location = new System.Drawing.Point(109, 129);
this.lblRedis.Name = "lblRedis";
this.lblRedis.Size = new System.Drawing.Size(482, 52);
this.lblRedis.Size = new System.Drawing.Size(482, 43);
this.lblRedis.TabIndex = 5;
this.lblRedis.Text = "---";
//
// openFileDialog1
//
this.openFileDialog1.DefaultExt = "pdf";
this.openFileDialog1.FileName = "openFileDialog1";
this.openFileDialog1.Multiselect = true;
this.openFileDialog1.FileOk += new System.ComponentModel.CancelEventHandler(this.openFileDialog1_FileOk);
//
// txtMergedName
//
this.txtMergedName.Location = new System.Drawing.Point(112, 94);
this.txtMergedName.Name = "txtMergedName";
this.txtMergedName.Size = new System.Drawing.Size(153, 20);
this.txtMergedName.TabIndex = 6;
this.txtMergedName.Text = "MergedPdfFile.pdf";
//
// button1
//
this.button1.Location = new System.Drawing.Point(25, 91);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 7;
this.button1.Text = "Select PDF";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// lblNumMerged
//
this.lblNumMerged.AutoSize = true;
this.lblNumMerged.Location = new System.Drawing.Point(320, 100);
this.lblNumMerged.Name = "lblNumMerged";
this.lblNumMerged.Size = new System.Drawing.Size(10, 13);
this.lblNumMerged.TabIndex = 8;
this.lblNumMerged.Text = "-";
//
// button2
//
this.button2.Location = new System.Drawing.Point(25, 124);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(75, 23);
this.button2.TabIndex = 9;
this.button2.Text = "RedisInfo";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(600, 366);
this.Controls.Add(this.button2);
this.Controls.Add(this.lblNumMerged);
this.Controls.Add(this.button1);
this.Controls.Add(this.txtMergedName);
this.Controls.Add(this.lblRedis);
this.Controls.Add(this.label4);
this.Controls.Add(this.lblHwSwData);
this.Controls.Add(this.label3);
this.Controls.Add(this.groupBox1);
@@ -202,8 +244,12 @@
private System.Windows.Forms.Label lblOutMessage;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label lblHwSwData;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label lblRedis;
private System.Windows.Forms.OpenFileDialog openFileDialog1;
private System.Windows.Forms.TextBox txtMergedName;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Label lblNumMerged;
private System.Windows.Forms.Button button2;
}
}
+40 -1
View File
@@ -1,5 +1,7 @@
using SteamWare;
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Windows.Forms;
@@ -21,7 +23,6 @@ namespace TestBench
lblHwSwData.Text = SteamWare.HwSwInfo.man(Assembly.GetExecutingAssembly()).librariesVers;
lblRedis.Text = memLayer.ML.getRSV("MoonPro:SQL2016DEV:MoonPro:CurrentParameters:SIMUL_01");
}
private void BtnCopyAll_Click(object sender, EventArgs e)
@@ -37,5 +38,43 @@ namespace TestBench
lblOutMessage.Text = "Copia completata!";
}
}
private void button1_Click(object sender, EventArgs e)
{
// apro selettore file...
openFileDialog1.ShowDialog();
}
private void openFileDialog1_FileOk(object sender, System.ComponentModel.CancelEventArgs e)
{
// prendo i files selezionati --> merge in pdf e indico quanti...
List<string> elencoFiles = new List<string>();
foreach (var item in openFileDialog1.FileNames)
{
elencoFiles.Add(item);
}
int numFiles = 0;
string outPath = $"{Directory.GetCurrentDirectory()}\\{txtMergedName.Text}";
try
{
numFiles = pdfUtils.mergePdfFiles(txtMergedName.Text, elencoFiles);
}
catch
{ }
lblNumMerged.Text = $"Effettuato merge di {numFiles} files!";
}
private void button2_Click(object sender, EventArgs e)
{
string answ = "";
try
{
answ = memLayer.ML.getRSV("MoonPro:SQL2016DEV:MoonPro:CurrentParameters:SIMUL_01");
}
catch
{ }
lblRedis.Text = answ;
}
}
}
+3
View File
@@ -117,4 +117,7 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="openFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>