output.FileWriter.Enhanced copes with WaterMeters.Count==0, etc.

This commit is contained in:
Milan Hanajik
2017-04-24 12:21:12 +02:00
parent eafcf016f3
commit 43fd99cea6
3 changed files with 9 additions and 6 deletions
@@ -294,7 +294,7 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
foreach (var v in commonItems)
{
leftColumn[cnt] = v.Caption;
rightColumn[cnt] = v.Print(batch.WaterMeters[0]);
rightColumn[cnt] = (batch.WaterMeters.Count > 0) ? v.Print(batch.WaterMeters[0]) : string.Empty;
cnt++;
}
@@ -78,7 +78,7 @@ namespace TBF.BenchControl.ResultsPrinters.Basic
HdrTop = TitleY + 60;
BodyTop = HdrTop + 160;
if (batch.WaterMeters[0].Compound())
if (batch.WaterMeters.Count > 0 && batch.WaterMeters[0].Compound())
{
rsltItems = Results.ItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Printer_CombinedWM);
}
@@ -100,12 +100,15 @@ namespace TBF.BenchControl.ResultsPrinters.Basic
}
int testsCount = 0;
foreach (var mtr in batch.WaterMeters[0].MeterTestRslts)
if (batch.WaterMeters.Count > 0)
{
if (mtr.Publish() == Config.Entities.Publish.Always) testsCount++;
foreach (var mtr in batch.WaterMeters[0].MeterTestRslts)
{
if (mtr.Publish() == Config.Entities.Publish.Always) testsCount++;
}
}
if (batch.WaterMeters[0].Compound()) testsCount /= 3;
if (batch.WaterMeters.Count > 0 && batch.WaterMeters[0].Compound()) testsCount /= 3;
int wmSectionHeight = (testsCount + 4) * SpacingOne;
@@ -58,7 +58,7 @@ namespace TBF.BenchControl.ResultsPrinters.LabelPrinter
DefaultPageSettings.Landscape = (pageOrientation == PageOrientation.Landscape);
if (batch.WaterMeters[0].Compound())
if (batch.WaterMeters.Count > 0 && batch.WaterMeters[0].Compound())
{
rsltItems = Results.ItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Printer_CombinedWM);
}