Upgrade wizard for Output.FileWriters.Enhanced components. Test items from local settings are used.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System.Windows.Forms;
|
||||
using TBF.Resources;
|
||||
|
||||
namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
{
|
||||
@@ -15,9 +16,10 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public HeaderFooterDlg(string text)
|
||||
public HeaderFooterDlg(bool isHeader, string text)
|
||||
: this()
|
||||
{
|
||||
Text = isHeader ? Strings.Header : Strings.Footer;
|
||||
textBox.Text = text;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
using log4net;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.Resources;
|
||||
|
||||
namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
{
|
||||
@@ -36,7 +37,8 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
public WriterCfgCtrl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
Localize();
|
||||
}
|
||||
|
||||
private void WriterCfgCtrl_Load(object sender, EventArgs e)
|
||||
{
|
||||
@@ -58,6 +60,24 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
Redraw();
|
||||
}
|
||||
|
||||
void Localize()
|
||||
{
|
||||
nameLabel.Text = Strings.Name;
|
||||
destinationLabel.Text = "Destination";
|
||||
destination2Label.Text = "Destination" + " 2";
|
||||
yearFoldersLabel.Text = "Year folders";
|
||||
monthFoldersLabel.Text = "Month folders";
|
||||
dayFoldersLabel.Text = "Day folders";
|
||||
fileNameFmtLabel.Text = "File name format";
|
||||
separatorLabel.Text = "Separator";
|
||||
eliminateSpacesCheckBox.Text = "No spaces";
|
||||
headerButton.Text = Strings.Header;
|
||||
commonItemsButton.Text = "Common items";
|
||||
testItemsButton.Text = "Test items";
|
||||
footerButton.Text = Strings.Footer;
|
||||
upgradeWizardButton.Text = "Upgrade wizard";
|
||||
}
|
||||
|
||||
public void Closing()
|
||||
{
|
||||
}
|
||||
@@ -74,7 +94,7 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
dayFoldersComboBox.Text = config.DayFolders.ToString();
|
||||
fileNameFmtTextBox.Text = config.FileNameFormat;
|
||||
separatorComboBox.Text = config.Separator.ToString();
|
||||
goodOnlyCheckBox.Checked = config.EliminateSpaces;
|
||||
eliminateSpacesCheckBox.Checked = config.EliminateSpaces;
|
||||
}
|
||||
|
||||
public void Unlock()
|
||||
@@ -89,7 +109,7 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
dayFoldersComboBox.Enabled = true;
|
||||
fileNameFmtTextBox.Enabled = true;
|
||||
separatorComboBox.Enabled = true;
|
||||
goodOnlyCheckBox.Enabled = true;
|
||||
eliminateSpacesCheckBox.Enabled = true;
|
||||
headerButton.Enabled = true;
|
||||
commonItemsButton.Enabled = true;
|
||||
testItemsButton.Enabled = true;
|
||||
@@ -194,9 +214,9 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
}
|
||||
}
|
||||
|
||||
if (config.EliminateSpaces != goodOnlyCheckBox.Checked)
|
||||
if (config.EliminateSpaces != eliminateSpacesCheckBox.Checked)
|
||||
{
|
||||
config.EliminateSpaces = goodOnlyCheckBox.Checked;
|
||||
config.EliminateSpaces = eliminateSpacesCheckBox.Checked;
|
||||
flags = CfgUpdateFlags.RestartRqrd;
|
||||
}
|
||||
|
||||
@@ -234,7 +254,7 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
|
||||
private void headerButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
HeaderFooterDlg dlg = new HeaderFooterDlg(header.Replace("~", "\r\n"));
|
||||
HeaderFooterDlg dlg = new HeaderFooterDlg(true, header.Replace("~", "\r\n"));
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
header = dlg.EditedText.Replace("\r\n", "~");
|
||||
@@ -271,11 +291,41 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
|
||||
private void footerButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
HeaderFooterDlg dlg = new HeaderFooterDlg(footer.Replace("~", "\r\n"));
|
||||
HeaderFooterDlg dlg = new HeaderFooterDlg(false, footer.Replace("~", "\r\n"));
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
footer = dlg.EditedText.Replace("\r\n", "~");
|
||||
}
|
||||
}
|
||||
|
||||
private void upgradeWizardButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (MessageBox.Show("This wizzard will overwrite curent settings." + Environment.NewLine +
|
||||
"Do you want to continue?",
|
||||
"Confirmation",
|
||||
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
{
|
||||
///
|
||||
/// Use legacy common items (English)
|
||||
///
|
||||
commonItems = new string[] {
|
||||
"3~Batch number:~~None~~~0~",
|
||||
"72~Date and time:~~None~{0:yyyy.MM.dd HH:mm}~~0~",
|
||||
"2~Procedure:~~None~~~0~",
|
||||
"66~User:~~None~~~0~",
|
||||
"26~Ambient temperature:~~C~{0} °C~F1~0~",
|
||||
"27~Ambient pressure:~~mBar~{0} mbar~F0~0~",
|
||||
"28~Ambient humidity:~~Pct~{0} %~F0~0~",
|
||||
};
|
||||
commonItemsButton_Click(this, null);
|
||||
|
||||
///
|
||||
/// Use legacy test inems from local settings
|
||||
///
|
||||
testItems = config.Factory.ClassName.Contains("Compound") ? Program.LocalSettings.RsltItems_Disk_CombinedWM
|
||||
: Program.LocalSettings.RsltItems_Disk_SingleWM;
|
||||
testItemsButton_Click(this, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+41
-28
@@ -51,10 +51,11 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
this.destination2Label = new System.Windows.Forms.Label();
|
||||
this.fileNameFmtTextBox = new System.Windows.Forms.TextBox();
|
||||
this.fileNameFmtLabel = new System.Windows.Forms.Label();
|
||||
this.goodOnlyCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.eliminateSpacesCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.headerButton = new System.Windows.Forms.Button();
|
||||
this.footerButton = new System.Windows.Forms.Button();
|
||||
this.commonItemsButton = new System.Windows.Forms.Button();
|
||||
this.upgradeWizardButton = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// nameTextBox
|
||||
@@ -103,7 +104,7 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
// destinationButton
|
||||
//
|
||||
this.destinationButton.Enabled = false;
|
||||
this.destinationButton.Location = new System.Drawing.Point(259, 56);
|
||||
this.destinationButton.Location = new System.Drawing.Point(269, 52);
|
||||
this.destinationButton.Name = "destinationButton";
|
||||
this.destinationButton.Size = new System.Drawing.Size(30, 20);
|
||||
this.destinationButton.TabIndex = 5;
|
||||
@@ -129,14 +130,14 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
this.separatorComboBox.Size = new System.Drawing.Size(146, 21);
|
||||
this.separatorComboBox.TabIndex = 18;
|
||||
//
|
||||
// selectItemsButton
|
||||
// testItemsButton
|
||||
//
|
||||
this.testItemsButton.Enabled = false;
|
||||
this.testItemsButton.Location = new System.Drawing.Point(200, 204);
|
||||
this.testItemsButton.Name = "selectItemsButton";
|
||||
this.testItemsButton.Size = new System.Drawing.Size(40, 23);
|
||||
this.testItemsButton.Location = new System.Drawing.Point(108, 278);
|
||||
this.testItemsButton.Name = "testItemsButton";
|
||||
this.testItemsButton.Size = new System.Drawing.Size(146, 23);
|
||||
this.testItemsButton.TabIndex = 22;
|
||||
this.testItemsButton.Text = "Items";
|
||||
this.testItemsButton.Text = "Test items";
|
||||
this.testItemsButton.UseVisualStyleBackColor = true;
|
||||
this.testItemsButton.Click += new System.EventHandler(this.testItemsButton_Click);
|
||||
//
|
||||
@@ -197,7 +198,7 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
// destination2Button
|
||||
//
|
||||
this.destination2Button.Enabled = false;
|
||||
this.destination2Button.Location = new System.Drawing.Point(259, 79);
|
||||
this.destination2Button.Location = new System.Drawing.Point(269, 73);
|
||||
this.destination2Button.Name = "destination2Button";
|
||||
this.destination2Button.Size = new System.Drawing.Size(30, 20);
|
||||
this.destination2Button.TabIndex = 8;
|
||||
@@ -238,22 +239,22 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
this.fileNameFmtLabel.TabIndex = 15;
|
||||
this.fileNameFmtLabel.Text = "File name format";
|
||||
//
|
||||
// goodOnlyCheckBox
|
||||
// eliminateSpacesCheckBox
|
||||
//
|
||||
this.goodOnlyCheckBox.AutoSize = true;
|
||||
this.goodOnlyCheckBox.Location = new System.Drawing.Point(6, 208);
|
||||
this.goodOnlyCheckBox.Name = "goodOnlyCheckBox";
|
||||
this.goodOnlyCheckBox.Size = new System.Drawing.Size(77, 17);
|
||||
this.goodOnlyCheckBox.TabIndex = 19;
|
||||
this.goodOnlyCheckBox.Text = "No spaces";
|
||||
this.goodOnlyCheckBox.UseVisualStyleBackColor = true;
|
||||
this.eliminateSpacesCheckBox.AutoSize = true;
|
||||
this.eliminateSpacesCheckBox.Location = new System.Drawing.Point(108, 208);
|
||||
this.eliminateSpacesCheckBox.Name = "eliminateSpacesCheckBox";
|
||||
this.eliminateSpacesCheckBox.Size = new System.Drawing.Size(77, 17);
|
||||
this.eliminateSpacesCheckBox.TabIndex = 19;
|
||||
this.eliminateSpacesCheckBox.Text = "No spaces";
|
||||
this.eliminateSpacesCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// headerButton
|
||||
//
|
||||
this.headerButton.Enabled = false;
|
||||
this.headerButton.Location = new System.Drawing.Point(90, 204);
|
||||
this.headerButton.Location = new System.Drawing.Point(108, 228);
|
||||
this.headerButton.Name = "headerButton";
|
||||
this.headerButton.Size = new System.Drawing.Size(51, 23);
|
||||
this.headerButton.Size = new System.Drawing.Size(146, 23);
|
||||
this.headerButton.TabIndex = 20;
|
||||
this.headerButton.Text = "Header";
|
||||
this.headerButton.UseVisualStyleBackColor = true;
|
||||
@@ -262,33 +263,44 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
// footerButton
|
||||
//
|
||||
this.footerButton.Enabled = false;
|
||||
this.footerButton.Location = new System.Drawing.Point(241, 204);
|
||||
this.footerButton.Location = new System.Drawing.Point(108, 303);
|
||||
this.footerButton.Name = "footerButton";
|
||||
this.footerButton.Size = new System.Drawing.Size(51, 23);
|
||||
this.footerButton.Size = new System.Drawing.Size(146, 23);
|
||||
this.footerButton.TabIndex = 23;
|
||||
this.footerButton.Text = "Footer";
|
||||
this.footerButton.UseVisualStyleBackColor = true;
|
||||
this.footerButton.Click += new System.EventHandler(this.footerButton_Click);
|
||||
//
|
||||
// commonButton
|
||||
// commonItemsButton
|
||||
//
|
||||
this.commonItemsButton.Enabled = false;
|
||||
this.commonItemsButton.Location = new System.Drawing.Point(142, 204);
|
||||
this.commonItemsButton.Name = "commonButton";
|
||||
this.commonItemsButton.Size = new System.Drawing.Size(57, 23);
|
||||
this.commonItemsButton.Location = new System.Drawing.Point(108, 253);
|
||||
this.commonItemsButton.Name = "commonItemsButton";
|
||||
this.commonItemsButton.Size = new System.Drawing.Size(146, 23);
|
||||
this.commonItemsButton.TabIndex = 21;
|
||||
this.commonItemsButton.Text = "Common";
|
||||
this.commonItemsButton.Text = "Common items";
|
||||
this.commonItemsButton.UseVisualStyleBackColor = true;
|
||||
this.commonItemsButton.Click += new System.EventHandler(this.commonItemsButton_Click);
|
||||
//
|
||||
// upgradeWizardButton
|
||||
//
|
||||
this.upgradeWizardButton.Location = new System.Drawing.Point(269, 253);
|
||||
this.upgradeWizardButton.Name = "upgradeWizardButton";
|
||||
this.upgradeWizardButton.Size = new System.Drawing.Size(80, 48);
|
||||
this.upgradeWizardButton.TabIndex = 24;
|
||||
this.upgradeWizardButton.Text = "Upgrade wizard";
|
||||
this.upgradeWizardButton.UseVisualStyleBackColor = true;
|
||||
this.upgradeWizardButton.Click += new System.EventHandler(this.upgradeWizardButton_Click);
|
||||
//
|
||||
// WriterCfgCtrl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.upgradeWizardButton);
|
||||
this.Controls.Add(this.commonItemsButton);
|
||||
this.Controls.Add(this.footerButton);
|
||||
this.Controls.Add(this.headerButton);
|
||||
this.Controls.Add(this.goodOnlyCheckBox);
|
||||
this.Controls.Add(this.eliminateSpacesCheckBox);
|
||||
this.Controls.Add(this.fileNameFmtTextBox);
|
||||
this.Controls.Add(this.fileNameFmtLabel);
|
||||
this.Controls.Add(this.destination2Button);
|
||||
@@ -310,7 +322,7 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
this.Controls.Add(this.nameLabel);
|
||||
this.Controls.Add(this.classNameLabel);
|
||||
this.Name = "WriterCfgCtrl";
|
||||
this.Size = new System.Drawing.Size(300, 230);
|
||||
this.Size = new System.Drawing.Size(400, 350);
|
||||
this.Load += new System.EventHandler(this.WriterCfgCtrl_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
@@ -339,9 +351,10 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
private System.Windows.Forms.Label destination2Label;
|
||||
private System.Windows.Forms.TextBox fileNameFmtTextBox;
|
||||
private System.Windows.Forms.Label fileNameFmtLabel;
|
||||
private System.Windows.Forms.CheckBox goodOnlyCheckBox;
|
||||
private System.Windows.Forms.CheckBox eliminateSpacesCheckBox;
|
||||
private System.Windows.Forms.Button headerButton;
|
||||
private System.Windows.Forms.Button footerButton;
|
||||
private System.Windows.Forms.Button commonItemsButton;
|
||||
private System.Windows.Forms.Button upgradeWizardButton;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user