Import of temperature coefficients, ver. 2.12.415

This commit is contained in:
Milan Hanajik
2016-12-10 17:33:14 +01:00
parent c8c411aebc
commit da4b5a50a7
3 changed files with 79 additions and 21 deletions
@@ -50,6 +50,7 @@ namespace TBF.BenchControl.Elde.TempMeter
this.parentNameComboBox = new System.Windows.Forms.ComboBox(); this.parentNameComboBox = new System.Windows.Forms.ComboBox();
this.defaultTempTextBox = new System.Windows.Forms.TextBox(); this.defaultTempTextBox = new System.Windows.Forms.TextBox();
this.label6 = new System.Windows.Forms.Label(); this.label6 = new System.Windows.Forms.Label();
this.importButton = new System.Windows.Forms.Button();
this.SuspendLayout(); this.SuspendLayout();
// //
// positionTextBox // positionTextBox
@@ -83,7 +84,7 @@ namespace TBF.BenchControl.Elde.TempMeter
this.nameTextBox.Enabled = false; this.nameTextBox.Enabled = false;
this.nameTextBox.Location = new System.Drawing.Point(130, 34); this.nameTextBox.Location = new System.Drawing.Point(130, 34);
this.nameTextBox.Name = "nameTextBox"; this.nameTextBox.Name = "nameTextBox";
this.nameTextBox.Size = new System.Drawing.Size(130, 20); this.nameTextBox.Size = new System.Drawing.Size(160, 20);
this.nameTextBox.TabIndex = 2; this.nameTextBox.TabIndex = 2;
// //
// nameLabel // nameLabel
@@ -109,8 +110,8 @@ namespace TBF.BenchControl.Elde.TempMeter
this.a1TextBox.Enabled = false; this.a1TextBox.Enabled = false;
this.a1TextBox.Location = new System.Drawing.Point(130, 107); this.a1TextBox.Location = new System.Drawing.Point(130, 107);
this.a1TextBox.Name = "a1TextBox"; this.a1TextBox.Name = "a1TextBox";
this.a1TextBox.Size = new System.Drawing.Size(130, 20); this.a1TextBox.Size = new System.Drawing.Size(160, 20);
this.a1TextBox.TabIndex = 8; this.a1TextBox.TabIndex = 9;
// //
// label1 // label1
// //
@@ -118,7 +119,7 @@ namespace TBF.BenchControl.Elde.TempMeter
this.label1.Location = new System.Drawing.Point(20, 110); this.label1.Location = new System.Drawing.Point(20, 110);
this.label1.Name = "label1"; this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(20, 13); this.label1.Size = new System.Drawing.Size(20, 13);
this.label1.TabIndex = 7; this.label1.TabIndex = 8;
this.label1.Text = "A1"; this.label1.Text = "A1";
// //
// a2TextBox // a2TextBox
@@ -126,8 +127,8 @@ namespace TBF.BenchControl.Elde.TempMeter
this.a2TextBox.Enabled = false; this.a2TextBox.Enabled = false;
this.a2TextBox.Location = new System.Drawing.Point(130, 128); this.a2TextBox.Location = new System.Drawing.Point(130, 128);
this.a2TextBox.Name = "a2TextBox"; this.a2TextBox.Name = "a2TextBox";
this.a2TextBox.Size = new System.Drawing.Size(130, 20); this.a2TextBox.Size = new System.Drawing.Size(160, 20);
this.a2TextBox.TabIndex = 10; this.a2TextBox.TabIndex = 11;
// //
// label2 // label2
// //
@@ -135,7 +136,7 @@ namespace TBF.BenchControl.Elde.TempMeter
this.label2.Location = new System.Drawing.Point(20, 131); this.label2.Location = new System.Drawing.Point(20, 131);
this.label2.Name = "label2"; this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(20, 13); this.label2.Size = new System.Drawing.Size(20, 13);
this.label2.TabIndex = 9; this.label2.TabIndex = 10;
this.label2.Text = "A2"; this.label2.Text = "A2";
// //
// a3TextBox // a3TextBox
@@ -143,8 +144,8 @@ namespace TBF.BenchControl.Elde.TempMeter
this.a3TextBox.Enabled = false; this.a3TextBox.Enabled = false;
this.a3TextBox.Location = new System.Drawing.Point(130, 149); this.a3TextBox.Location = new System.Drawing.Point(130, 149);
this.a3TextBox.Name = "a3TextBox"; this.a3TextBox.Name = "a3TextBox";
this.a3TextBox.Size = new System.Drawing.Size(130, 20); this.a3TextBox.Size = new System.Drawing.Size(160, 20);
this.a3TextBox.TabIndex = 12; this.a3TextBox.TabIndex = 13;
// //
// label3 // label3
// //
@@ -152,7 +153,7 @@ namespace TBF.BenchControl.Elde.TempMeter
this.label3.Location = new System.Drawing.Point(20, 152); this.label3.Location = new System.Drawing.Point(20, 152);
this.label3.Name = "label3"; this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(20, 13); this.label3.Size = new System.Drawing.Size(20, 13);
this.label3.TabIndex = 11; this.label3.TabIndex = 12;
this.label3.Text = "A3"; this.label3.Text = "A3";
// //
// a5TextBox // a5TextBox
@@ -160,8 +161,8 @@ namespace TBF.BenchControl.Elde.TempMeter
this.a5TextBox.Enabled = false; this.a5TextBox.Enabled = false;
this.a5TextBox.Location = new System.Drawing.Point(130, 191); this.a5TextBox.Location = new System.Drawing.Point(130, 191);
this.a5TextBox.Name = "a5TextBox"; this.a5TextBox.Name = "a5TextBox";
this.a5TextBox.Size = new System.Drawing.Size(130, 20); this.a5TextBox.Size = new System.Drawing.Size(160, 20);
this.a5TextBox.TabIndex = 16; this.a5TextBox.TabIndex = 17;
// //
// label5 // label5
// //
@@ -169,7 +170,7 @@ namespace TBF.BenchControl.Elde.TempMeter
this.label5.Location = new System.Drawing.Point(20, 194); this.label5.Location = new System.Drawing.Point(20, 194);
this.label5.Name = "label5"; this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(20, 13); this.label5.Size = new System.Drawing.Size(20, 13);
this.label5.TabIndex = 15; this.label5.TabIndex = 16;
this.label5.Text = "A5"; this.label5.Text = "A5";
// //
// a4TextBox // a4TextBox
@@ -177,8 +178,8 @@ namespace TBF.BenchControl.Elde.TempMeter
this.a4TextBox.Enabled = false; this.a4TextBox.Enabled = false;
this.a4TextBox.Location = new System.Drawing.Point(130, 170); this.a4TextBox.Location = new System.Drawing.Point(130, 170);
this.a4TextBox.Name = "a4TextBox"; this.a4TextBox.Name = "a4TextBox";
this.a4TextBox.Size = new System.Drawing.Size(130, 20); this.a4TextBox.Size = new System.Drawing.Size(160, 20);
this.a4TextBox.TabIndex = 14; this.a4TextBox.TabIndex = 15;
// //
// label4 // label4
// //
@@ -186,7 +187,7 @@ namespace TBF.BenchControl.Elde.TempMeter
this.label4.Location = new System.Drawing.Point(20, 173); this.label4.Location = new System.Drawing.Point(20, 173);
this.label4.Name = "label4"; this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(20, 13); this.label4.Size = new System.Drawing.Size(20, 13);
this.label4.TabIndex = 13; this.label4.TabIndex = 14;
this.label4.Text = "A4"; this.label4.Text = "A4";
// //
// parentNameComboBox // parentNameComboBox
@@ -195,7 +196,7 @@ namespace TBF.BenchControl.Elde.TempMeter
this.parentNameComboBox.FormattingEnabled = true; this.parentNameComboBox.FormattingEnabled = true;
this.parentNameComboBox.Location = new System.Drawing.Point(130, 58); this.parentNameComboBox.Location = new System.Drawing.Point(130, 58);
this.parentNameComboBox.Name = "parentNameComboBox"; this.parentNameComboBox.Name = "parentNameComboBox";
this.parentNameComboBox.Size = new System.Drawing.Size(130, 21); this.parentNameComboBox.Size = new System.Drawing.Size(160, 21);
this.parentNameComboBox.TabIndex = 4; this.parentNameComboBox.TabIndex = 4;
// //
// defaultTempTextBox // defaultTempTextBox
@@ -204,7 +205,7 @@ namespace TBF.BenchControl.Elde.TempMeter
this.defaultTempTextBox.Location = new System.Drawing.Point(130, 217); this.defaultTempTextBox.Location = new System.Drawing.Point(130, 217);
this.defaultTempTextBox.Name = "defaultTempTextBox"; this.defaultTempTextBox.Name = "defaultTempTextBox";
this.defaultTempTextBox.Size = new System.Drawing.Size(46, 20); this.defaultTempTextBox.Size = new System.Drawing.Size(46, 20);
this.defaultTempTextBox.TabIndex = 17; this.defaultTempTextBox.TabIndex = 19;
// //
// label6 // label6
// //
@@ -215,10 +216,22 @@ namespace TBF.BenchControl.Elde.TempMeter
this.label6.TabIndex = 18; this.label6.TabIndex = 18;
this.label6.Text = "Default temperature"; this.label6.Text = "Default temperature";
// //
// importButton
//
this.importButton.Enabled = false;
this.importButton.Location = new System.Drawing.Point(182, 81);
this.importButton.Name = "importButton";
this.importButton.Size = new System.Drawing.Size(108, 23);
this.importButton.TabIndex = 7;
this.importButton.Text = "Import A1 ... A5";
this.importButton.UseVisualStyleBackColor = true;
this.importButton.Click += new System.EventHandler(this.importButton_Click);
//
// TempMeterCfgCtrl // TempMeterCfgCtrl
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.importButton);
this.Controls.Add(this.label6); this.Controls.Add(this.label6);
this.Controls.Add(this.defaultTempTextBox); this.Controls.Add(this.defaultTempTextBox);
this.Controls.Add(this.parentNameComboBox); this.Controls.Add(this.parentNameComboBox);
@@ -239,7 +252,7 @@ namespace TBF.BenchControl.Elde.TempMeter
this.Controls.Add(this.nameLabel); this.Controls.Add(this.nameLabel);
this.Controls.Add(this.classNameLabel); this.Controls.Add(this.classNameLabel);
this.Name = "TempMeterCfgCtrl"; this.Name = "TempMeterCfgCtrl";
this.Size = new System.Drawing.Size(300, 240); this.Size = new System.Drawing.Size(350, 240);
this.Load += new System.EventHandler(this.TempMeterCfgCtrl_Load); this.Load += new System.EventHandler(this.TempMeterCfgCtrl_Load);
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
@@ -267,5 +280,6 @@ namespace TBF.BenchControl.Elde.TempMeter
private System.Windows.Forms.ComboBox parentNameComboBox; private System.Windows.Forms.ComboBox parentNameComboBox;
private System.Windows.Forms.TextBox defaultTempTextBox; private System.Windows.Forms.TextBox defaultTempTextBox;
private System.Windows.Forms.Label label6; private System.Windows.Forms.Label label6;
private System.Windows.Forms.Button importButton;
} }
} }
@@ -3,6 +3,8 @@
/// ///
using System; using System;
using System.Globalization; using System.Globalization;
using System.IO;
using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using log4net; using log4net;
using TBF.BenchControl.Generic; using TBF.BenchControl.Generic;
@@ -13,6 +15,8 @@ namespace TBF.BenchControl.Elde.TempMeter
{ {
static readonly ILog log = LogManager.GetLogger(typeof(TempMeterCfgCtrl)); static readonly ILog log = LogManager.GetLogger(typeof(TempMeterCfgCtrl));
static string lastImportFileName;
ComponentParametersDlg parent; ComponentParametersDlg parent;
public bool ShowMore { get { return false; } } public bool ShowMore { get { return false; } }
@@ -77,6 +81,7 @@ namespace TBF.BenchControl.Elde.TempMeter
nameTextBox.Enabled = true; nameTextBox.Enabled = true;
parentNameComboBox.Enabled = true; parentNameComboBox.Enabled = true;
positionTextBox.Enabled = true; positionTextBox.Enabled = true;
importButton.Enabled = true;
a1TextBox.Enabled = true; a1TextBox.Enabled = true;
a2TextBox.Enabled = true; a2TextBox.Enabled = true;
a3TextBox.Enabled = true; a3TextBox.Enabled = true;
@@ -159,5 +164,44 @@ namespace TBF.BenchControl.Elde.TempMeter
return flags; return flags;
} }
private void importButton_Click(object sender, EventArgs e)
{
OpenFileDialog dlg = new OpenFileDialog();
if (!string.IsNullOrEmpty(lastImportFileName)) dlg.FileName = lastImportFileName;
if (dlg.ShowDialog() == DialogResult.OK)
{
try
{
using (TextReader reader = new StreamReader(dlg.FileName))
{
double tmp;
string lineID = string.Format("Calch{0} =", positionTextBox.Text);
do
{
string line = reader.ReadLine();
if (line != null && line.IndexOf(lineID) == 0)
{
string[] factors = line.Substring(lineID.Length).Split(new char[] { ',' });
int count = factors.Length;
if (count >= 1 && Utils.TryParseEDouble(factors[count - 1].Trim(), out tmp)) a1TextBox.Text = factors[count - 1].Trim();
if (count >= 2 && Utils.TryParseEDouble(factors[count - 2].Trim(), out tmp)) a2TextBox.Text = factors[count - 2].Trim();
if (count >= 3 && Utils.TryParseEDouble(factors[count - 3].Trim(), out tmp)) a3TextBox.Text = factors[count - 3].Trim();
if (count >= 4 && Utils.TryParseEDouble(factors[count - 4].Trim(), out tmp)) a4TextBox.Text = factors[count - 4].Trim();
if (count >= 5 && Utils.TryParseEDouble(factors[count - 5].Trim(), out tmp)) a5TextBox.Text = factors[count - 5].Trim();
lastImportFileName = dlg.FileName;
break;
}
}
while (lineID != null);
}
}
catch
{
MessageBox.Show("Import failed", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
}
} }
} }
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("2.12.414.1")] [assembly: AssemblyVersion("2.12.415.1")]
[assembly: AssemblyFileVersion("2.12.414.1")] [assembly: AssemblyFileVersion("2.12.415.1")]