ok eliminazione files vecchi + test connesisone camera auto da helper
This commit is contained in:
Generated
+40
-28
@@ -67,7 +67,6 @@
|
||||
this.chkLive = new System.Windows.Forms.CheckBox();
|
||||
this.btnSave = new System.Windows.Forms.Button();
|
||||
this.labelTitle = new System.Windows.Forms.Label();
|
||||
this.lblReadTemp = new System.Windows.Forms.Label();
|
||||
this.lblPoint = new System.Windows.Forms.Label();
|
||||
this.pBoxB = new System.Windows.Forms.PictureBox();
|
||||
this.lblImgA = new System.Windows.Forms.Label();
|
||||
@@ -78,6 +77,8 @@
|
||||
this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.columnHeader3 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.txtMaxDays = new System.Windows.Forms.TextBox();
|
||||
this.btnDeleteOlder = new System.Windows.Forms.Button();
|
||||
this.menuStrip1.SuspendLayout();
|
||||
this.statusStrip1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pBoxA)).BeginInit();
|
||||
@@ -179,6 +180,8 @@
|
||||
this.panelCmd.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.panelCmd.BackColor = System.Drawing.SystemColors.ControlDark;
|
||||
this.panelCmd.Controls.Add(this.btnDeleteOlder);
|
||||
this.panelCmd.Controls.Add(this.txtMaxDays);
|
||||
this.panelCmd.Controls.Add(this.chkSaveAll);
|
||||
this.panelCmd.Controls.Add(this.btnLoad);
|
||||
this.panelCmd.Controls.Add(this.groupBox3);
|
||||
@@ -242,11 +245,11 @@
|
||||
// lblMaxTemp
|
||||
//
|
||||
this.lblMaxTemp.AutoSize = true;
|
||||
this.lblMaxTemp.ForeColor = System.Drawing.SystemColors.ControlLightLight;
|
||||
this.lblMaxTemp.Location = new System.Drawing.Point(89, 42);
|
||||
this.lblMaxTemp.MinimumSize = new System.Drawing.Size(80, 0);
|
||||
this.lblMaxTemp.ForeColor = System.Drawing.SystemColors.ButtonHighlight;
|
||||
this.lblMaxTemp.Location = new System.Drawing.Point(78, 91);
|
||||
this.lblMaxTemp.MinimumSize = new System.Drawing.Size(40, 0);
|
||||
this.lblMaxTemp.Name = "lblMaxTemp";
|
||||
this.lblMaxTemp.Size = new System.Drawing.Size(80, 13);
|
||||
this.lblMaxTemp.Size = new System.Drawing.Size(40, 13);
|
||||
this.lblMaxTemp.TabIndex = 17;
|
||||
this.lblMaxTemp.Text = "? °C";
|
||||
this.lblMaxTemp.TextAlign = System.Drawing.ContentAlignment.TopRight;
|
||||
@@ -254,13 +257,14 @@
|
||||
// lblMinTemp
|
||||
//
|
||||
this.lblMinTemp.AutoSize = true;
|
||||
this.lblMinTemp.ForeColor = System.Drawing.SystemColors.ControlText;
|
||||
this.lblMinTemp.Location = new System.Drawing.Point(7, 42);
|
||||
this.lblMinTemp.MinimumSize = new System.Drawing.Size(80, 0);
|
||||
this.lblMinTemp.ForeColor = System.Drawing.SystemColors.ButtonHighlight;
|
||||
this.lblMinTemp.Location = new System.Drawing.Point(78, 64);
|
||||
this.lblMinTemp.MinimumSize = new System.Drawing.Size(40, 0);
|
||||
this.lblMinTemp.Name = "lblMinTemp";
|
||||
this.lblMinTemp.Size = new System.Drawing.Size(80, 13);
|
||||
this.lblMinTemp.Size = new System.Drawing.Size(40, 13);
|
||||
this.lblMinTemp.TabIndex = 16;
|
||||
this.lblMinTemp.Text = "? °C";
|
||||
this.lblMinTemp.TextAlign = System.Drawing.ContentAlignment.TopRight;
|
||||
//
|
||||
// label6
|
||||
//
|
||||
@@ -273,9 +277,9 @@
|
||||
//
|
||||
// txtMaxScale
|
||||
//
|
||||
this.txtMaxScale.Location = new System.Drawing.Point(92, 88);
|
||||
this.txtMaxScale.Location = new System.Drawing.Point(120, 88);
|
||||
this.txtMaxScale.Name = "txtMaxScale";
|
||||
this.txtMaxScale.Size = new System.Drawing.Size(77, 20);
|
||||
this.txtMaxScale.Size = new System.Drawing.Size(49, 20);
|
||||
this.txtMaxScale.TabIndex = 12;
|
||||
this.txtMaxScale.Text = "60";
|
||||
this.txtMaxScale.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
|
||||
@@ -292,9 +296,9 @@
|
||||
//
|
||||
// txtMinScale
|
||||
//
|
||||
this.txtMinScale.Location = new System.Drawing.Point(92, 61);
|
||||
this.txtMinScale.Location = new System.Drawing.Point(120, 61);
|
||||
this.txtMinScale.Name = "txtMinScale";
|
||||
this.txtMinScale.Size = new System.Drawing.Size(77, 20);
|
||||
this.txtMinScale.Size = new System.Drawing.Size(49, 20);
|
||||
this.txtMinScale.TabIndex = 10;
|
||||
this.txtMinScale.Text = "0";
|
||||
this.txtMinScale.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
|
||||
@@ -470,17 +474,6 @@
|
||||
this.labelTitle.TabIndex = 0;
|
||||
this.labelTitle.Text = "ThermoCam SETUP";
|
||||
//
|
||||
// lblReadTemp
|
||||
//
|
||||
this.lblReadTemp.AutoSize = true;
|
||||
this.lblReadTemp.Location = new System.Drawing.Point(1185, 364);
|
||||
this.lblReadTemp.MinimumSize = new System.Drawing.Size(80, 0);
|
||||
this.lblReadTemp.Name = "lblReadTemp";
|
||||
this.lblReadTemp.Size = new System.Drawing.Size(80, 13);
|
||||
this.lblReadTemp.TabIndex = 8;
|
||||
this.lblReadTemp.Text = "? °C";
|
||||
this.lblReadTemp.TextAlign = System.Drawing.ContentAlignment.TopRight;
|
||||
//
|
||||
// lblPoint
|
||||
//
|
||||
this.lblPoint.AutoSize = true;
|
||||
@@ -544,9 +537,9 @@
|
||||
this.columnHeader2,
|
||||
this.columnHeader3});
|
||||
this.lstView.HideSelection = false;
|
||||
this.lstView.Location = new System.Drawing.Point(954, 380);
|
||||
this.lstView.Location = new System.Drawing.Point(954, 334);
|
||||
this.lstView.Name = "lstView";
|
||||
this.lstView.Size = new System.Drawing.Size(311, 277);
|
||||
this.lstView.Size = new System.Drawing.Size(320, 323);
|
||||
this.lstView.TabIndex = 13;
|
||||
this.lstView.UseCompatibleStateImageBehavior = false;
|
||||
this.lstView.View = System.Windows.Forms.View.Details;
|
||||
@@ -567,6 +560,25 @@
|
||||
this.columnHeader3.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
|
||||
this.columnHeader3.Width = 150;
|
||||
//
|
||||
// txtMaxDays
|
||||
//
|
||||
this.txtMaxDays.Location = new System.Drawing.Point(128, 403);
|
||||
this.txtMaxDays.Name = "txtMaxDays";
|
||||
this.txtMaxDays.Size = new System.Drawing.Size(49, 20);
|
||||
this.txtMaxDays.TabIndex = 14;
|
||||
this.txtMaxDays.Text = "1";
|
||||
this.txtMaxDays.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
|
||||
//
|
||||
// btnDeleteOlder
|
||||
//
|
||||
this.btnDeleteOlder.Location = new System.Drawing.Point(6, 401);
|
||||
this.btnDeleteOlder.Name = "btnDeleteOlder";
|
||||
this.btnDeleteOlder.Size = new System.Drawing.Size(94, 23);
|
||||
this.btnDeleteOlder.TabIndex = 15;
|
||||
this.btnDeleteOlder.Text = "Delete > days";
|
||||
this.btnDeleteOlder.UseVisualStyleBackColor = true;
|
||||
this.btnDeleteOlder.Click += new System.EventHandler(this.btnDeleteOlder_Click);
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
@@ -579,7 +591,6 @@
|
||||
this.Controls.Add(this.pBoxB);
|
||||
this.Controls.Add(this.pBoxA);
|
||||
this.Controls.Add(this.lblPoint);
|
||||
this.Controls.Add(this.lblReadTemp);
|
||||
this.Controls.Add(this.panelCmd);
|
||||
this.Controls.Add(this.statusStrip1);
|
||||
this.Controls.Add(this.menuStrip1);
|
||||
@@ -635,7 +646,6 @@
|
||||
private System.Windows.Forms.TextBox txtAB;
|
||||
private System.Windows.Forms.CheckBox chkPointSetup;
|
||||
private System.Windows.Forms.CheckBox chkReadTemp;
|
||||
private System.Windows.Forms.Label lblReadTemp;
|
||||
private System.Windows.Forms.PictureBox pBoxB;
|
||||
private System.Windows.Forms.Label lblImgA;
|
||||
private System.Windows.Forms.Label lblImgB;
|
||||
@@ -659,6 +669,8 @@
|
||||
private System.Windows.Forms.ColumnHeader columnHeader1;
|
||||
private System.Windows.Forms.ColumnHeader columnHeader2;
|
||||
private System.Windows.Forms.ColumnHeader columnHeader3;
|
||||
private System.Windows.Forms.Button btnDeleteOlder;
|
||||
private System.Windows.Forms.TextBox txtMaxDays;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -189,6 +189,13 @@ namespace Thermo.Cam.Setup
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private void btnDeleteOlder_Click(object sender, EventArgs e)
|
||||
{
|
||||
int maxDays = 90;
|
||||
int.TryParse(txtMaxDays.Text, out maxDays);
|
||||
TCamCtrl.cleanDataDir(maxDays);
|
||||
}
|
||||
|
||||
private void btnLoad_Click(object sender, EventArgs e)
|
||||
{
|
||||
// "" --> carica ultima scattata (altrimenti nome)
|
||||
@@ -238,10 +245,6 @@ namespace Thermo.Cam.Setup
|
||||
{
|
||||
pointSetup = false;
|
||||
}
|
||||
if (!readTemp)
|
||||
{
|
||||
lblReadTemp.Text = "? °C";
|
||||
}
|
||||
}
|
||||
|
||||
private void chkShowOrig_CheckedChanged(object sender, EventArgs e)
|
||||
|
||||
@@ -169,6 +169,31 @@ namespace Thermo.Cam.Utils
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// Elimina dalla dir selezionata i files + vecchi del num giorni indicati
|
||||
/// </summary>
|
||||
/// <param name="currDir"></param>
|
||||
/// <param name="maxDayOld">età massima file</param>
|
||||
private static void cleanSingleDirectory(string currDir, int maxDayOld)
|
||||
{
|
||||
if (Directory.Exists(currDir))
|
||||
{
|
||||
var fileList = Directory.GetFiles(currDir);
|
||||
foreach (var item in fileList)
|
||||
{
|
||||
var fInfo = new FileInfo(item);
|
||||
if (DateTime.Now > fInfo.LastWriteTime.AddDays(maxDayOld))
|
||||
{
|
||||
fInfo.Delete();
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine($"File ok: {item}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Camera_ConnectionStatusChanged(object sender, Flir.Atlas.Live.ConnectionStatusChangedEventArgs e)
|
||||
{
|
||||
if (eh_CameraConnStatusChanged != null)
|
||||
@@ -335,6 +360,17 @@ namespace Thermo.Cam.Utils
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Eliminazione files nelle folder dati quando hannon età > maxDayOld
|
||||
/// </summary>
|
||||
/// <param name="maxDayOld"></param>
|
||||
public void cleanDataDir(int maxDayOld)
|
||||
{
|
||||
cleanSingleDirectory(dirDataTemp, maxDayOld);
|
||||
cleanSingleDirectory(dirImgColor, maxDayOld);
|
||||
cleanSingleDirectory(dirImgOrigi, maxDayOld);
|
||||
}
|
||||
|
||||
public void ConnectCamera(CameraDeviceInfo cameraDeviceInfo)
|
||||
{
|
||||
DisposeCamera();
|
||||
|
||||
Reference in New Issue
Block a user