Initialization of 30 components changed, done in Initialize( ).

This commit is contained in:
Milan Hanajik
2021-04-03 00:54:27 +02:00
parent cb1a66381f
commit a58fe1f997
30 changed files with 347 additions and 445 deletions
@@ -22,13 +22,17 @@ namespace TBF.Rig.Output.EventTriggers.Iperl
: base(cfg)
{
triggerCfg = cfg as TriggerCfg;
ApplyConfig();
log.Warn(this.ToString());
}
public override void Initialize()
{
ApplyConfig();
}
void ApplyConfig()
{
/// TODO
}
#region Configuration Change Handling
+4 -12
View File
@@ -29,8 +29,6 @@ namespace TBF.Rig.Output.FileWriters.Basic
Results.Entities.Batch batch;
bool abort;
public Writer() {}
@@ -38,10 +36,13 @@ namespace TBF.Rig.Output.FileWriters.Basic
: base(cfg)
{
writerCfg = cfg as WriterCfg;
ApplyConfig();
log.Warn(this.ToString());
}
public override void Initialize()
{
ApplyConfig();
}
void ApplyConfig()
{
@@ -219,7 +220,6 @@ namespace TBF.Rig.Output.FileWriters.Basic
Thread.CurrentThread.CurrentCulture = new CultureInfo(writerCfg.Culture.ToString());
}
abort = false;
WriteRslts(batch, writerCfg.DestinationPath);
WriteRslts(batch, writerCfg.DestinationPath2);
@@ -296,8 +296,6 @@ namespace TBF.Rig.Output.FileWriters.Basic
/// Write aligned columns
for (int i = 0; i < Math.Min(leftColumn.Length, rightColumn.Length); i++)
{
if (abort) return;
wrtr.Write(leftColumn[i]);
if (!writerCfg.EliminateSpaces)
{
@@ -334,8 +332,6 @@ namespace TBF.Rig.Output.FileWriters.Basic
int totalWidth = 0;
for (int i = 0; i < rsltItems.Count; i++)
{
if (abort) return;
columnWidths[i] = writerCfg.PrintCaption ? ElSpaces(rsltItems[i].Caption).Length : 0;
foreach (var wm in batch.WaterMeters)
{
@@ -365,8 +361,6 @@ namespace TBF.Rig.Output.FileWriters.Basic
/// Write column headers
for (int i = 0; i < rsltItems.Count; i++)
{
if (abort) return;
string caption = ElSpaces(rsltItems[i].Caption);
wr.Write(caption);
@@ -392,8 +386,6 @@ namespace TBF.Rig.Output.FileWriters.Basic
{
if (!writerCfg.SaveGoodOnly || wm.Passed)
{
if (abort) return;
Results.WMeterRsltItemSpec.TableRowNr = ++rowsCount;
for (int i = 0; i < rsltItems.Count; i++)
+4 -6
View File
@@ -28,8 +28,6 @@ namespace TBF.Rig.Output.FileWriters.Elde
Results.Entities.Batch batch;
bool abort;
public Writer() {}
@@ -37,10 +35,13 @@ namespace TBF.Rig.Output.FileWriters.Elde
: base(cfg)
{
writerCfg = cfg as WriterCfg;
ApplyConfig();
log.Warn(this.ToString());
}
public override void Initialize()
{
ApplyConfig();
}
void ApplyConfig()
{
@@ -237,7 +238,6 @@ namespace TBF.Rig.Output.FileWriters.Elde
Thread.CurrentThread.CurrentCulture = new CultureInfo(writerCfg.Culture.ToString());
}
abort = false;
WriteRslts(batch, writerCfg.DestinationPath);
WriteRslts(batch, writerCfg.DestinationPath2);
@@ -327,8 +327,6 @@ namespace TBF.Rig.Output.FileWriters.Elde
/// Write aligned columns
for (int i = 0; i < Math.Min(leftColumn.Length, rightColumn.Length); i++)
{
if (abort) return;
wrtr.Write(leftColumn[i]);
if (!writerCfg.EliminateSpaces)
+4 -13
View File
@@ -28,8 +28,6 @@ namespace TBF.Rig.Output.FileWriters.Enhanced
Results.Entities.Batch batch;
bool abort;
public Writer() {}
@@ -37,10 +35,13 @@ namespace TBF.Rig.Output.FileWriters.Enhanced
: base(cfg)
{
writerCfg = cfg as WriterCfg;
ApplyConfig();
log.Warn(this.ToString());
}
public override void Initialize()
{
ApplyConfig();
}
void ApplyConfig()
{
@@ -227,7 +228,6 @@ namespace TBF.Rig.Output.FileWriters.Enhanced
Thread.CurrentThread.CurrentCulture = new CultureInfo(writerCfg.Culture.ToString());
}
abort = false;
WriteRslts(batch, writerCfg.DestinationPath);
WriteRslts(batch, writerCfg.DestinationPath2);
@@ -301,8 +301,6 @@ namespace TBF.Rig.Output.FileWriters.Enhanced
/// Write aligned columns
for (int i = 0; i < Math.Min(leftColumn.Length, rightColumn.Length); i++)
{
if (abort) return;
wrtr.Write(leftColumn[i]);
if (!writerCfg.EliminateSpaces)
@@ -321,7 +319,6 @@ namespace TBF.Rig.Output.FileWriters.Enhanced
{
if (!writerCfg.SaveGoodOnly || wm.Passed)
{
if (abort) return;
WriteWM(wrtr, wm);
}
}
@@ -354,8 +351,6 @@ namespace TBF.Rig.Output.FileWriters.Enhanced
int totalWidth = 0;
for (int i = 0; i < testItems.Count; i++)
{
if (abort) return;
columnWidths[i] = ElSpaces(testItems[i].Caption).Length;
foreach (var mtr in wm.RegularMeterTestRslts())
{
@@ -386,8 +381,6 @@ namespace TBF.Rig.Output.FileWriters.Enhanced
/// Write column headers
for (int i = 0; i < testItems.Count; i++)
{
if (abort) return;
string caption = ElSpaces(testItems[i].Caption);
wr.Write(caption);
@@ -414,8 +407,6 @@ namespace TBF.Rig.Output.FileWriters.Enhanced
int rowsCount = 0;
foreach (var mtr in wm.RegularMeterTestRslts())
{
if (abort) return;
if (mtr != null && mtr.IsPilotRslt() && mtr.Publish() == Config.Entities.Publish.Always)
{
Results.WMeterRsltItemSpec.TableRowNr = ++rowsCount;
@@ -30,8 +30,6 @@ namespace TBF.Rig.Output.FileWriters.OneFilePerMeter
Results.Entities.Batch batch;
bool abort; /// Set to 'true' by Stop() operation to abort writing to files
public Writer() {}
@@ -39,10 +37,13 @@ namespace TBF.Rig.Output.FileWriters.OneFilePerMeter
: base(cfg)
{
writerCfg = cfg as WriterCfg;
ApplyConfig();
log.Warn(this.ToString());
}
public override void Initialize()
{
ApplyConfig();
}
void ApplyConfig()
{
@@ -291,8 +292,6 @@ namespace TBF.Rig.Output.FileWriters.OneFilePerMeter
/// Write aligned columns
for (int i = 0; i < Math.Min(leftColumn.Length, rightColumn.Length); i++)
{
if (abort) return;
wrtr.Write(leftColumn[i]);
wrtr.Write(new string(' ', maxLen - leftColumn[i].Length + 3));
wrtr.WriteLine(rightColumn[i]);
@@ -304,7 +303,6 @@ namespace TBF.Rig.Output.FileWriters.OneFilePerMeter
foreach (var wm in batch.WaterMeters)
{
WriteWM(wrtr, wm);
if (abort) return;
}
///----------
@@ -352,8 +350,6 @@ namespace TBF.Rig.Output.FileWriters.OneFilePerMeter
int totalWidth = 0;
for (int i = 0; i < testItems.Count; i++)
{
if (abort) return;
columnWidths[i] = ElSpaces(testItems[i].Caption).Length;
foreach (var mtr in wm.RegularMeterTestRslts())
{
@@ -381,8 +377,6 @@ namespace TBF.Rig.Output.FileWriters.OneFilePerMeter
/// Write column headers
for (int i = 0; i < testItems.Count; i++)
{
if (abort) return;
string caption = ElSpaces(testItems[i].Caption);
wr.Write(caption);
@@ -405,8 +399,6 @@ namespace TBF.Rig.Output.FileWriters.OneFilePerMeter
/// Write table data
foreach (var mtr in wm.RegularMeterTestRslts())
{
if (abort) return;
if (mtr != null && mtr.IsPilotRslt() && mtr.Publish() == Config.Entities.Publish.Always)
{
for (int i = 0; i < testItems.Count; i++)
+4 -7
View File
@@ -31,8 +31,6 @@ namespace TBF.Rig.Output.FileWriters.Xml
Results.Entities.Batch batch;
bool abort;
public Writer() {}
@@ -40,10 +38,13 @@ namespace TBF.Rig.Output.FileWriters.Xml
: base(cfg)
{
writerCfg = cfg as WriterCfg;
ApplyConfig();
log.Warn(this.ToString());
}
public override void Initialize()
{
ApplyConfig();
}
void ApplyConfig()
{
@@ -254,8 +255,6 @@ namespace TBF.Rig.Output.FileWriters.Xml
/// Common items 1
foreach (var v in commonItems)
{
if (abort) return;
/// Fetch the item and strip color information
string itemText = v.Print(wm);
string[] texts = itemText.Split(new char[] { '|' });
@@ -267,8 +266,6 @@ namespace TBF.Rig.Output.FileWriters.Xml
/// Test items
foreach (var mtr in wm.RegularMeterTestRslts())
{
if (abort) return;
if ((mtr != null) && (mtr.Publish() == Config.Entities.Publish.Always))
{
wr.WriteLine(string.Format(" <{0}>", testTag));
@@ -33,8 +33,6 @@ namespace TBF.Rig.Output.FileWriters.XmlBatch
Results.Entities.Batch batch;
bool abort;
public Writer() {}
@@ -42,10 +40,13 @@ namespace TBF.Rig.Output.FileWriters.XmlBatch
: base(cfg)
{
writerCfg = cfg as WriterCfg;
ApplyConfig();
log.Warn(this.ToString());
}
public override void Initialize()
{
ApplyConfig();
}
void ApplyConfig()
{
@@ -258,8 +259,6 @@ namespace TBF.Rig.Output.FileWriters.XmlBatch
/// Common items
foreach (var v in commonItems)
{
if (abort) return;
/// Fetch the item and strip color information
string itemText = v.Print(batch.WaterMeters[0]);
string[] texts = itemText.Split(new char[] { '|' });
@@ -275,8 +274,6 @@ namespace TBF.Rig.Output.FileWriters.XmlBatch
/// Meter items
foreach (var v in meterItems)
{
if (abort) return;
/// Fetch the item and strip color information
string itemText = v.Print(wm);
string[] texts = itemText.Split(new char[] { '|' });
@@ -288,8 +285,6 @@ namespace TBF.Rig.Output.FileWriters.XmlBatch
/// Test items
foreach (var mtr in wm.RegularMeterTestRslts())
{
if (abort) return;
if ((mtr != null) && (mtr.Publish() == Config.Entities.Publish.Always))
{
wr.WriteLine(string.Format(" <{0}>", testTag));
+4 -1
View File
@@ -38,10 +38,13 @@ namespace TBF.Rig.Output.Printers.Enhanced
: base(cfg)
{
printerCfg = cfg as PrinterCfg;
ApplyConfig();
log.Warn(this.ToString());
}
public override void Initialize()
{
ApplyConfig();
}
void ApplyConfig()
{
+5 -1
View File
@@ -34,10 +34,14 @@ namespace TBF.Rig.Output.Printers.Label
: base(cfg)
{
printerCfg = cfg as PrinterCfg;
ApplyConfig();
log.Warn(this.ToString());
}
public override void Initialize()
{
ApplyConfig();
}
void ApplyConfig()
{
commonItems = Results.WMeterRsltItemSpec.FromStrArray(printerCfg.ItemsToPrint);
@@ -34,10 +34,14 @@ namespace TBF.Rig.Output.Printers.MultiLabel
: base(cfg)
{
printerCfg = cfg as PrinterCfg;
ApplyConfig();
log.Warn(this.ToString());
}
public override void Initialize()
{
ApplyConfig();
}
void ApplyConfig()
{
commonItems = Results.WMeterRsltItemSpec.FromStrArray(printerCfg.ItemsToPrint);
@@ -38,10 +38,13 @@ namespace TBF.Rig.Output.Printers.OnePerBatch
: base(cfg)
{
printerCfg = cfg as PrinterCfg;
ApplyConfig();
log.Warn(this.ToString());
}
public override void Initialize()
{
ApplyConfig();
}
void ApplyConfig()
{
@@ -38,10 +38,13 @@ namespace TBF.Rig.Output.Printers.OnePerMeter
: base(cfg)
{
printerCfg = cfg as PrinterCfg;
ApplyConfig();
log.Warn(this.ToString());
}
public override void Initialize()
{
ApplyConfig();
}
void ApplyConfig()
{
+4 -1
View File
@@ -37,10 +37,13 @@ namespace TBF.Rig.Output.Printers.Zapiska
: base(cfg)
{
printerCfg = cfg as PrinterCfg;
ApplyConfig();
log.Warn(this.ToString());
}
public override void Initialize()
{
ApplyConfig();
}
void ApplyConfig()
{