Output.FileWriters.Enhanced with formatted WM subtitles

This commit is contained in:
Milan Hanajik
2021-01-14 09:51:24 +01:00
parent 9416b79b38
commit bc3fb0f8a0
4 changed files with 100 additions and 34 deletions
@@ -88,6 +88,7 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
writerCfg.DayFolders = newCfg.DayFolders;
writerCfg.FileNameFormat = newCfg.FileNameFormat;
writerCfg.Culture = newCfg.Culture;
writerCfg.SubtitleFormat = newCfg.SubtitleFormat;
writerCfg.Separator = newCfg.Separator;
writerCfg.EliminateSpaces = newCfg.EliminateSpaces;
writerCfg.Header = newCfg.Header;
@@ -332,31 +333,14 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
wr.WriteLine();
/// Write water meter number and s/n
#if BADGER_MALA_TRAT || BADGER_STREDNA_TRAT || BADGER_VELKA_TRAT
wr.Write(string.Format("Water meter {0} s/n: {1}", wm.WMPosition, wm.SerialNr));
#if ORACLE_DB
wr.WriteLine(writerCfg.SubtitleFormat, wm.WMPosition, wm.SerialNr, wm.SerialNrAux, wm.CompleteSerialNr,
Strings.Water_Meter, Strings.SerialNr, Strings.Main_WM_SerialNr, Strings.Aux_WM_SerialNr);
#else
wr.Write(string.Format("{0} {1}", Strings.Water_Meter, wm.WMPosition));
if (!wm.Compound())
{
if (!string.IsNullOrEmpty(wm.SerialNr))
{
wr.Write(string.Format(", {0} {1}", Strings.SerialNr, wm.SerialNr));
}
}
else
{
if (!string.IsNullOrEmpty(wm.SerialNr))
{
wr.Write(string.Format(", {0} {1}", Strings.Main_WM_SerialNr, wm.SerialNr));
}
if (!string.IsNullOrEmpty(wm.SerialNrAux))
{
wr.Write(string.Format(", {0} {1}", Strings.Aux_WM_SerialNr, wm.SerialNrAux));
}
}
wr.WriteLine(writerCfg.SubtitleFormat, wm.WMPosition, wm.SerialNr, wm.SerialNrAux, string.Empty,
Strings.Water_Meter, Strings.SerialNr, Strings.Main_WM_SerialNr, Strings.Aux_WM_SerialNr);
#endif
wr.WriteLine();
/// Determine column widths
int[] columnWidths = new int[testItems.Count];
int totalWidth = 0;
@@ -19,6 +19,7 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
public MonthFolders MonthFolders;
public DayFolders DayFolders;
public string FileNameFormat;
public string SubtitleFormat;
public Culture Culture;
public Separator Separator;
public bool EliminateSpaces;
@@ -50,6 +51,7 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
MonthFolders = MonthFolders.Digit;
DayFolders = DayFolders.Digit;
FileNameFormat = "{0:yyMMdd-HHmm}.txt";
SubtitleFormat = "{4} {0}, {5} {1}";
Separator = Separator.None;
EliminateSpaces = false;
SaveGoodOnly = false;
@@ -62,8 +62,9 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
yearFoldersLabel.Text = "Year folders";
monthFoldersLabel.Text = "Month folders";
dayFoldersLabel.Text = "Day folders";
fileNameFmtLabel.Text = "File name format";
cultureLabel.Text = "Culture";
fileNameFmtLabel.Text = "File name format";
subtitleFmtLabel.Text = "Subtitle format";
separatorLabel.Text = "Separator";
eliminateSpacesCheckBox.Text = "No spaces";
goodOnlyCheckBox.Text = "Good only";
@@ -89,6 +90,7 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
monthFoldersComboBox.Text = config.MonthFolders.ToString();
dayFoldersComboBox.Text = config.DayFolders.ToString();
fileNameFmtTextBox.Text = config.FileNameFormat;
subtitleFmtTextBox.Text = config.SubtitleFormat;
cultureComboBox.Text = config.Culture.ToString();
separatorComboBox.Text = config.Separator.ToString();
eliminateSpacesCheckBox.Checked = config.EliminateSpaces;
@@ -106,6 +108,7 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
monthFoldersComboBox.Enabled = true;
dayFoldersComboBox.Enabled = true;
fileNameFmtTextBox.Enabled = true;
subtitleFmtTextBox.Enabled = true;
cultureComboBox.Enabled = true;
separatorComboBox.Enabled = true;
eliminateSpacesCheckBox.Enabled = true;
@@ -214,6 +217,12 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
}
if (config.SubtitleFormat != subtitleFmtTextBox.Text)
{
config.SubtitleFormat = subtitleFmtTextBox.Text;
flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
}
for (Culture i = 0; i < Culture.Count; i++)
{
if (i.ToString().Equals(cultureComboBox.Text) && (config.Culture != i))
@@ -59,6 +59,12 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
this.cultureComboBox = new System.Windows.Forms.ComboBox();
this.cultureLabel = new System.Windows.Forms.Label();
this.goodOnlyCheckBox = new System.Windows.Forms.CheckBox();
this.subtitleFmtTextBox = new System.Windows.Forms.TextBox();
this.subtitleFmtLabel = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// nameTextBox
@@ -118,7 +124,7 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
// separatorLabel
//
this.separatorLabel.AutoSize = true;
this.separatorLabel.Location = new System.Drawing.Point(17, 203);
this.separatorLabel.Location = new System.Drawing.Point(17, 224);
this.separatorLabel.Name = "separatorLabel";
this.separatorLabel.Size = new System.Drawing.Size(53, 13);
this.separatorLabel.TabIndex = 19;
@@ -128,7 +134,7 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
//
this.separatorComboBox.Enabled = false;
this.separatorComboBox.FormattingEnabled = true;
this.separatorComboBox.Location = new System.Drawing.Point(108, 200);
this.separatorComboBox.Location = new System.Drawing.Point(108, 221);
this.separatorComboBox.Name = "separatorComboBox";
this.separatorComboBox.Size = new System.Drawing.Size(146, 21);
this.separatorComboBox.TabIndex = 20;
@@ -136,7 +142,7 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
// testItemsButton
//
this.testItemsButton.Enabled = false;
this.testItemsButton.Location = new System.Drawing.Point(108, 275);
this.testItemsButton.Location = new System.Drawing.Point(108, 296);
this.testItemsButton.Name = "testItemsButton";
this.testItemsButton.Size = new System.Drawing.Size(146, 23);
this.testItemsButton.TabIndex = 25;
@@ -245,7 +251,7 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
// eliminateSpacesCheckBox
//
this.eliminateSpacesCheckBox.AutoSize = true;
this.eliminateSpacesCheckBox.Location = new System.Drawing.Point(20, 241);
this.eliminateSpacesCheckBox.Location = new System.Drawing.Point(20, 262);
this.eliminateSpacesCheckBox.Name = "eliminateSpacesCheckBox";
this.eliminateSpacesCheckBox.Size = new System.Drawing.Size(77, 17);
this.eliminateSpacesCheckBox.TabIndex = 21;
@@ -255,7 +261,7 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
// headerButton
//
this.headerButton.Enabled = false;
this.headerButton.Location = new System.Drawing.Point(108, 225);
this.headerButton.Location = new System.Drawing.Point(108, 246);
this.headerButton.Name = "headerButton";
this.headerButton.Size = new System.Drawing.Size(146, 23);
this.headerButton.TabIndex = 23;
@@ -266,7 +272,7 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
// footerButton
//
this.footerButton.Enabled = false;
this.footerButton.Location = new System.Drawing.Point(108, 300);
this.footerButton.Location = new System.Drawing.Point(108, 321);
this.footerButton.Name = "footerButton";
this.footerButton.Size = new System.Drawing.Size(146, 23);
this.footerButton.TabIndex = 26;
@@ -277,7 +283,7 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
// commonItemsButton
//
this.commonItemsButton.Enabled = false;
this.commonItemsButton.Location = new System.Drawing.Point(108, 250);
this.commonItemsButton.Location = new System.Drawing.Point(108, 271);
this.commonItemsButton.Name = "commonItemsButton";
this.commonItemsButton.Size = new System.Drawing.Size(146, 23);
this.commonItemsButton.TabIndex = 24;
@@ -287,7 +293,7 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
//
// upgradeWizardButton
//
this.upgradeWizardButton.Location = new System.Drawing.Point(269, 250);
this.upgradeWizardButton.Location = new System.Drawing.Point(269, 271);
this.upgradeWizardButton.Name = "upgradeWizardButton";
this.upgradeWizardButton.Size = new System.Drawing.Size(80, 48);
this.upgradeWizardButton.TabIndex = 27;
@@ -316,17 +322,76 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
// goodOnlyCheckBox
//
this.goodOnlyCheckBox.AutoSize = true;
this.goodOnlyCheckBox.Location = new System.Drawing.Point(20, 264);
this.goodOnlyCheckBox.Location = new System.Drawing.Point(20, 285);
this.goodOnlyCheckBox.Name = "goodOnlyCheckBox";
this.goodOnlyCheckBox.Size = new System.Drawing.Size(74, 17);
this.goodOnlyCheckBox.TabIndex = 22;
this.goodOnlyCheckBox.Text = "Good only";
this.goodOnlyCheckBox.UseVisualStyleBackColor = true;
//
// subtitleFmtTextBox
//
this.subtitleFmtTextBox.Enabled = false;
this.subtitleFmtTextBox.Location = new System.Drawing.Point(108, 200);
this.subtitleFmtTextBox.Name = "subtitleFmtTextBox";
this.subtitleFmtTextBox.Size = new System.Drawing.Size(146, 20);
this.subtitleFmtTextBox.TabIndex = 29;
//
// subtitleFmtLabel
//
this.subtitleFmtLabel.AutoSize = true;
this.subtitleFmtLabel.Location = new System.Drawing.Point(17, 203);
this.subtitleFmtLabel.Name = "subtitleFmtLabel";
this.subtitleFmtLabel.Size = new System.Drawing.Size(74, 13);
this.subtitleFmtLabel.TabIndex = 28;
this.subtitleFmtLabel.Text = "Subtitle format";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(257, 211);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(174, 13);
this.label1.TabIndex = 30;
this.label1.Text = "4:wmStr 5:s/n 6:main s/n 7:aux.s/n";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(257, 198);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(168, 13);
this.label2.TabIndex = 31;
this.label2.Text = "0:pos 1:s/n 2:aux.s/n 3:compl.s/n";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(257, 155);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(138, 13);
this.label3.TabIndex = 32;
this.label3.Text = "0:end t. 1:start t. 2:batch nr.";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(257, 168);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(128, 13);
this.label4.TabIndex = 33;
this.label4.Text = "3:bench name 4:bench id";
//
// WriterCfgCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.subtitleFmtTextBox);
this.Controls.Add(this.subtitleFmtLabel);
this.Controls.Add(this.goodOnlyCheckBox);
this.Controls.Add(this.cultureComboBox);
this.Controls.Add(this.cultureLabel);
@@ -356,7 +421,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(400, 350);
this.Size = new System.Drawing.Size(440, 350);
this.Load += new System.EventHandler(this.WriterCfgCtrl_Load);
this.ResumeLayout(false);
this.PerformLayout();
@@ -393,5 +458,11 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
private System.Windows.Forms.ComboBox cultureComboBox;
private System.Windows.Forms.Label cultureLabel;
private System.Windows.Forms.CheckBox goodOnlyCheckBox;
private System.Windows.Forms.TextBox subtitleFmtTextBox;
private System.Windows.Forms.Label subtitleFmtLabel;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
}
}