From 63abe74aed9d6a0ce285c4ba05f6f075a14439bd Mon Sep 17 00:00:00 2001 From: Milan Hanajik Date: Mon, 1 Aug 2016 13:17:59 +0200 Subject: [PATCH] Upgrade wizard for Output.FileWriters.Enhanced components. Test items from local settings are used. --- .../FileWriters/Enhanced/HeaderFooterDlg.cs | 4 +- .../FileWriters/Enhanced/WriterCfgCtrl.cs | 64 +++++++++++++++-- .../Enhanced/WriterCfgCtrl.designer.cs | 69 +++++++++++-------- TestBenchFramework/LocalSettings.cs | 2 + .../Resources/Strings.Designer.cs | 18 +++++ TestBenchFramework/Resources/Strings.cs.resx | 6 ++ TestBenchFramework/Resources/Strings.de.resx | 6 ++ TestBenchFramework/Resources/Strings.resx | 6 ++ 8 files changed, 139 insertions(+), 36 deletions(-) diff --git a/TestBenchFramework/BenchControl/Output/FileWriters/Enhanced/HeaderFooterDlg.cs b/TestBenchFramework/BenchControl/Output/FileWriters/Enhanced/HeaderFooterDlg.cs index 350a2a1ae..4dd8f6b4a 100644 --- a/TestBenchFramework/BenchControl/Output/FileWriters/Enhanced/HeaderFooterDlg.cs +++ b/TestBenchFramework/BenchControl/Output/FileWriters/Enhanced/HeaderFooterDlg.cs @@ -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; } } diff --git a/TestBenchFramework/BenchControl/Output/FileWriters/Enhanced/WriterCfgCtrl.cs b/TestBenchFramework/BenchControl/Output/FileWriters/Enhanced/WriterCfgCtrl.cs index 156741000..a6893eba2 100644 --- a/TestBenchFramework/BenchControl/Output/FileWriters/Enhanced/WriterCfgCtrl.cs +++ b/TestBenchFramework/BenchControl/Output/FileWriters/Enhanced/WriterCfgCtrl.cs @@ -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); + } + } } } diff --git a/TestBenchFramework/BenchControl/Output/FileWriters/Enhanced/WriterCfgCtrl.designer.cs b/TestBenchFramework/BenchControl/Output/FileWriters/Enhanced/WriterCfgCtrl.designer.cs index f190d6e13..50e91354e 100644 --- a/TestBenchFramework/BenchControl/Output/FileWriters/Enhanced/WriterCfgCtrl.designer.cs +++ b/TestBenchFramework/BenchControl/Output/FileWriters/Enhanced/WriterCfgCtrl.designer.cs @@ -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; } } diff --git a/TestBenchFramework/LocalSettings.cs b/TestBenchFramework/LocalSettings.cs index 5588975f1..9174a8262 100644 --- a/TestBenchFramework/LocalSettings.cs +++ b/TestBenchFramework/LocalSettings.cs @@ -194,6 +194,8 @@ namespace TBF public string[] RsltItems_Screen_CombinedWM; public string[] RsltItems_Printer_SingleWM; public string[] RsltItems_Printer_CombinedWM; + public string[] RsltItems_Disk_SingleWM; /// Legacy, can optionally be used to initialize file writer settings + public string[] RsltItems_Disk_CombinedWM; /// Legacy, can optionally be used to initialize file writer settings [XmlArrayAttribute("RsltsClmnWidths")] public int[] RsltsClmnWidths; diff --git a/TestBenchFramework/Resources/Strings.Designer.cs b/TestBenchFramework/Resources/Strings.Designer.cs index ebb11b903..122458b5a 100644 --- a/TestBenchFramework/Resources/Strings.Designer.cs +++ b/TestBenchFramework/Resources/Strings.Designer.cs @@ -1374,6 +1374,15 @@ namespace TBF.Resources { } } + /// + /// Looks up a localized string similar to Footer. + /// + internal static string Footer { + get { + return ResourceManager.GetString("Footer", resourceCulture); + } + } + /// /// Looks up a localized string similar to General. /// @@ -1419,6 +1428,15 @@ namespace TBF.Resources { } } + /// + /// Looks up a localized string similar to Header. + /// + internal static string Header { + get { + return ResourceManager.GetString("Header", resourceCulture); + } + } + /// /// Looks up a localized string similar to Heat meter. /// diff --git a/TestBenchFramework/Resources/Strings.cs.resx b/TestBenchFramework/Resources/Strings.cs.resx index f73f15de4..2783ce711 100644 --- a/TestBenchFramework/Resources/Strings.cs.resx +++ b/TestBenchFramework/Resources/Strings.cs.resx @@ -1269,4 +1269,10 @@ Další instance programu Test Bench Framework je spuštěna. Uzavřete jí prosím s použitím 'Správce úloh'. + + Zápatí + + + Hlavička + \ No newline at end of file diff --git a/TestBenchFramework/Resources/Strings.de.resx b/TestBenchFramework/Resources/Strings.de.resx index f37327e3e..7debbd51c 100644 --- a/TestBenchFramework/Resources/Strings.de.resx +++ b/TestBenchFramework/Resources/Strings.de.resx @@ -1344,4 +1344,10 @@ Ein weiteres Test Bench Framework Programm-Instanz ausgeführt wird. Bitte schließen Sie es dem Taskmanager. + + Fußzeile + + + Kopfzeile + \ No newline at end of file diff --git a/TestBenchFramework/Resources/Strings.resx b/TestBenchFramework/Resources/Strings.resx index 5c031a7fc..8bb052d86 100644 --- a/TestBenchFramework/Resources/Strings.resx +++ b/TestBenchFramework/Resources/Strings.resx @@ -1513,4 +1513,10 @@ Another instance of Test Bench Framework program is running. Please, close it using Task Manager. + + Footer + + + Header + \ No newline at end of file