Output.FileWriters.Basic : PrintCaption parameter added, no empty line when there are no common items, ver. 2.17.752

This commit is contained in:
Milan Hanajik
2017-12-01 10:53:11 +01:00
parent 871b95891d
commit 76bef24456
5 changed files with 64 additions and 36 deletions
@@ -89,8 +89,9 @@ namespace TBF.BenchControl.Output.FileWriters.Basic
writerCfg.FileNameFormat = newCfg.FileNameFormat;
writerCfg.Culture = newCfg.Culture;
writerCfg.Separator = newCfg.Separator;
writerCfg.EliminateSpaces = newCfg.EliminateSpaces;
writerCfg.SaveGoodOnly = newCfg.SaveGoodOnly;
writerCfg.EliminateSpaces = newCfg.EliminateSpaces;
writerCfg.PrintCaption = newCfg.PrintCaption;
writerCfg.Header = newCfg.Header;
writerCfg.CommonItems = newCfg.CommonItems;
writerCfg.SelectedItems = newCfg.SelectedItems;
@@ -304,7 +305,7 @@ namespace TBF.BenchControl.Output.FileWriters.Basic
wrtr.WriteLine(rightColumn[i]);
}
wrtr.WriteLine();
if (commonItems.Count > 0) wrtr.WriteLine(); /// Write an empty line in case there is at least one common item
///--------
/// Body
@@ -333,7 +334,7 @@ namespace TBF.BenchControl.Output.FileWriters.Basic
{
if (abort) return;
columnWidths[i] = ElSpaces(rsltItems[i].Caption).Length;
columnWidths[i] = writerCfg.PrintCaption ? ElSpaces(rsltItems[i].Caption).Length : 0;
foreach (var wm in batch.WaterMeters)
{
if (!writerCfg.SaveGoodOnly || wm.Passed)
@@ -355,27 +356,30 @@ namespace TBF.BenchControl.Output.FileWriters.Basic
string horizontalLine = new String('-', totalWidth);
//wr.WriteLine(horizontalLine); /// Horizontal line above the header
/// Write column headers
for (int i = 0; i < rsltItems.Count; i++)
if (writerCfg.PrintCaption)
{
if (abort) return;
//wr.WriteLine(horizontalLine); /// Horizontal line above the header
string caption = ElSpaces(rsltItems[i].Caption);
wr.Write(caption);
if (i < rsltItems.Count - 1)
/// Write column headers
for (int i = 0; i < rsltItems.Count; i++)
{
if (!writerCfg.EliminateSpaces)
if (abort) return;
string caption = ElSpaces(rsltItems[i].Caption);
wr.Write(caption);
if (i < rsltItems.Count - 1)
{
wr.Write(new string(' ', columnWidths[i] - rsltItems[i].Caption.Length + 3));
if (!writerCfg.EliminateSpaces)
{
wr.Write(new string(' ', columnWidths[i] - rsltItems[i].Caption.Length + 3));
}
wr.Write(separatorStr);
}
else
{
wr.WriteLine();
}
wr.Write(separatorStr);
}
else
{
wr.WriteLine();
}
}
@@ -22,6 +22,7 @@ namespace TBF.BenchControl.Output.FileWriters.Basic
public Culture Culture;
public Separator Separator;
public bool EliminateSpaces;
public bool PrintCaption;
public bool SaveGoodOnly;
public string Header;
public string[] CommonItems;
@@ -52,6 +53,7 @@ namespace TBF.BenchControl.Output.FileWriters.Basic
FileNameFormat = "{0:yyMMdd-HHmm}.csv";
Separator = Separator.None;
EliminateSpaces = false;
PrintCaption = false;
SaveGoodOnly = false;
Header = string.Empty;
Footer = string.Empty;
@@ -66,8 +66,9 @@ namespace TBF.BenchControl.Output.FileWriters.Basic
fileNameFmtLabel.Text = "File name format";
cultureLabel.Text = "Culture";
separatorLabel.Text = "Separator";
eliminateSpacesCheckBox.Text = "No spaces";
goodOnlyCheckBox.Text = "Good only";
eliminateSpacesCheckBox.Text = "No spaces";
printCaptionCheckBox.Text = "Print caption";
headerButton.Text = Strings.Header;
commonItemsButton.Text = "Common items";
selectItemsButton.Text = "Selected items";
@@ -91,8 +92,9 @@ namespace TBF.BenchControl.Output.FileWriters.Basic
fileNameFmtTextBox.Text = config.FileNameFormat;
cultureComboBox.Text = config.Culture.ToString();
separatorComboBox.Text = config.Separator.ToString();
eliminateSpacesCheckBox.Checked = config.EliminateSpaces;
goodOnlyCheckBox.Checked = config.SaveGoodOnly;
eliminateSpacesCheckBox.Checked = config.EliminateSpaces;
printCaptionCheckBox.Checked = config.PrintCaption;
}
public void Unlock()
@@ -108,8 +110,9 @@ namespace TBF.BenchControl.Output.FileWriters.Basic
fileNameFmtTextBox.Enabled = true;
cultureComboBox.Enabled = true;
separatorComboBox.Enabled = true;
eliminateSpacesCheckBox.Enabled = true;
goodOnlyCheckBox.Enabled = true;
eliminateSpacesCheckBox.Enabled = true;
printCaptionCheckBox.Enabled = true;
headerButton.Enabled = true;
commonItemsButton.Enabled = true;
selectItemsButton.Enabled = true;
@@ -234,15 +237,21 @@ namespace TBF.BenchControl.Output.FileWriters.Basic
}
}
if (config.SaveGoodOnly != goodOnlyCheckBox.Checked)
{
config.SaveGoodOnly = goodOnlyCheckBox.Checked;
flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
}
if (config.EliminateSpaces != eliminateSpacesCheckBox.Checked)
{
config.EliminateSpaces = eliminateSpacesCheckBox.Checked;
flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
}
if (config.SaveGoodOnly != goodOnlyCheckBox.Checked)
if (config.PrintCaption != printCaptionCheckBox.Checked)
{
config.SaveGoodOnly = goodOnlyCheckBox.Checked;
config.PrintCaption = printCaptionCheckBox.Checked;
flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
}
@@ -58,6 +58,7 @@ namespace TBF.BenchControl.Output.FileWriters.Basic
this.commonItemsButton = new System.Windows.Forms.Button();
this.headerButton = new System.Windows.Forms.Button();
this.footerButton = new System.Windows.Forms.Button();
this.printCaptionCheckBox = new System.Windows.Forms.CheckBox();
this.SuspendLayout();
//
// nameTextBox
@@ -109,7 +110,7 @@ namespace TBF.BenchControl.Output.FileWriters.Basic
this.destinationButton.Location = new System.Drawing.Point(259, 56);
this.destinationButton.Name = "destinationButton";
this.destinationButton.Size = new System.Drawing.Size(30, 20);
this.destinationButton.TabIndex = 25;
this.destinationButton.TabIndex = 26;
this.destinationButton.Text = "...";
this.destinationButton.UseVisualStyleBackColor = true;
this.destinationButton.Click += new System.EventHandler(this.destinationButton_Click);
@@ -138,7 +139,7 @@ namespace TBF.BenchControl.Output.FileWriters.Basic
this.selectItemsButton.Location = new System.Drawing.Point(108, 277);
this.selectItemsButton.Name = "selectItemsButton";
this.selectItemsButton.Size = new System.Drawing.Size(146, 23);
this.selectItemsButton.TabIndex = 23;
this.selectItemsButton.TabIndex = 24;
this.selectItemsButton.Text = "Selected items";
this.selectItemsButton.UseVisualStyleBackColor = true;
this.selectItemsButton.Click += new System.EventHandler(this.selectItemsButton_Click);
@@ -203,7 +204,7 @@ namespace TBF.BenchControl.Output.FileWriters.Basic
this.destination2Button.Location = new System.Drawing.Point(259, 79);
this.destination2Button.Name = "destination2Button";
this.destination2Button.Size = new System.Drawing.Size(30, 20);
this.destination2Button.TabIndex = 26;
this.destination2Button.TabIndex = 27;
this.destination2Button.Text = "...";
this.destination2Button.UseVisualStyleBackColor = true;
//
@@ -244,10 +245,10 @@ namespace TBF.BenchControl.Output.FileWriters.Basic
// goodOnlyCheckBox
//
this.goodOnlyCheckBox.AutoSize = true;
this.goodOnlyCheckBox.Location = new System.Drawing.Point(20, 268);
this.goodOnlyCheckBox.Location = new System.Drawing.Point(20, 235);
this.goodOnlyCheckBox.Name = "goodOnlyCheckBox";
this.goodOnlyCheckBox.Size = new System.Drawing.Size(74, 17);
this.goodOnlyCheckBox.TabIndex = 20;
this.goodOnlyCheckBox.TabIndex = 19;
this.goodOnlyCheckBox.Text = "Good only";
this.goodOnlyCheckBox.UseVisualStyleBackColor = true;
//
@@ -272,10 +273,10 @@ namespace TBF.BenchControl.Output.FileWriters.Basic
// eliminateSpacesCheckBox
//
this.eliminateSpacesCheckBox.AutoSize = true;
this.eliminateSpacesCheckBox.Location = new System.Drawing.Point(20, 245);
this.eliminateSpacesCheckBox.Location = new System.Drawing.Point(20, 256);
this.eliminateSpacesCheckBox.Name = "eliminateSpacesCheckBox";
this.eliminateSpacesCheckBox.Size = new System.Drawing.Size(77, 17);
this.eliminateSpacesCheckBox.TabIndex = 19;
this.eliminateSpacesCheckBox.TabIndex = 20;
this.eliminateSpacesCheckBox.Text = "No spaces";
this.eliminateSpacesCheckBox.UseVisualStyleBackColor = true;
//
@@ -285,7 +286,7 @@ namespace TBF.BenchControl.Output.FileWriters.Basic
this.commonItemsButton.Location = new System.Drawing.Point(108, 252);
this.commonItemsButton.Name = "commonItemsButton";
this.commonItemsButton.Size = new System.Drawing.Size(146, 23);
this.commonItemsButton.TabIndex = 22;
this.commonItemsButton.TabIndex = 23;
this.commonItemsButton.Text = "Common items";
this.commonItemsButton.UseVisualStyleBackColor = true;
this.commonItemsButton.Click += new System.EventHandler(this.commonItemsButton_Click);
@@ -296,7 +297,7 @@ namespace TBF.BenchControl.Output.FileWriters.Basic
this.headerButton.Location = new System.Drawing.Point(108, 227);
this.headerButton.Name = "headerButton";
this.headerButton.Size = new System.Drawing.Size(146, 23);
this.headerButton.TabIndex = 21;
this.headerButton.TabIndex = 22;
this.headerButton.Text = "Header";
this.headerButton.UseVisualStyleBackColor = true;
this.headerButton.Click += new System.EventHandler(this.headerButton_Click);
@@ -307,15 +308,26 @@ namespace TBF.BenchControl.Output.FileWriters.Basic
this.footerButton.Location = new System.Drawing.Point(108, 302);
this.footerButton.Name = "footerButton";
this.footerButton.Size = new System.Drawing.Size(146, 23);
this.footerButton.TabIndex = 24;
this.footerButton.TabIndex = 25;
this.footerButton.Text = "Footer";
this.footerButton.UseVisualStyleBackColor = true;
this.footerButton.Click += new System.EventHandler(this.footerButton_Click);
//
// printCaptionCheckBox
//
this.printCaptionCheckBox.AutoSize = true;
this.printCaptionCheckBox.Location = new System.Drawing.Point(20, 277);
this.printCaptionCheckBox.Name = "printCaptionCheckBox";
this.printCaptionCheckBox.Size = new System.Drawing.Size(85, 17);
this.printCaptionCheckBox.TabIndex = 21;
this.printCaptionCheckBox.Text = "Print caption";
this.printCaptionCheckBox.UseVisualStyleBackColor = true;
//
// WriterCfgCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.printCaptionCheckBox);
this.Controls.Add(this.footerButton);
this.Controls.Add(this.commonItemsButton);
this.Controls.Add(this.headerButton);
@@ -380,5 +392,6 @@ namespace TBF.BenchControl.Output.FileWriters.Basic
private System.Windows.Forms.Button commonItemsButton;
private System.Windows.Forms.Button headerButton;
private System.Windows.Forms.Button footerButton;
private System.Windows.Forms.CheckBox printCaptionCheckBox;
}
}
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
[assembly: AssemblyVersion("2.17.751.0")]
[assembly: AssemblyFileVersion("2.17.751.0")]
[assembly: AssemblyVersion("2.17.752.0")]
[assembly: AssemblyFileVersion("2.17.752.0")]