Output.Printers.Zapiska : 'Good only' option implemented, ver. 2.17.681

This commit is contained in:
Milan Hanajik 2017-09-29 15:21:40 +02:00
parent 3dc347c66a
commit fd81675168
4 changed files with 41 additions and 26 deletions

View File

@ -134,7 +134,14 @@ namespace Results.Output.Printers.Zapiska
SpacingOneAndHalf4Header = (3 * SpacingOne4Header) / 2;
/// Calculate the table rows count
int tableRowsCount = batch.WaterMeters.Count;
int tableRowsCount = 0;
if (cfg.GoodOnly)
{
foreach (var wm in batch.WaterMeters)
{
if (!cfg.GoodOnly || wm.Passed) tableRowsCount++;
}
}
/// Prepare document outline
titleHeight = System.Windows.Forms.TextRenderer.MeasureText(header, titleFont).Height;
@ -345,14 +352,17 @@ namespace Results.Output.Printers.Zapiska
float columnWidth = e.Graphics.MeasureString(selectedItems[i].Caption, headerFont).Width;
foreach (var wm in wms)
{
string itemText = selectedItems[i].Print(wm);
if (!cfg.GoodOnly || wm.Passed)
{
string itemText = selectedItems[i].Print(wm);
/// Strip color information
string[] texts = itemText.Split(new char[] { '|' });
if (texts.Length == 2) { itemText = texts[0]; }
/// Strip color information
string[] texts = itemText.Split(new char[] { '|' });
if (texts.Length == 2) { itemText = texts[0]; }
float width = e.Graphics.MeasureString(itemText, font).Width;
if (width > columnWidth) columnWidth = width;
float width = e.Graphics.MeasureString(itemText, font).Width;
if (width > columnWidth) columnWidth = width;
}
}
columnPos[i + 1] = columnPos[i] + columnWidth + (float)GapBetweenTableColumns;
}
@ -375,25 +385,28 @@ namespace Results.Output.Printers.Zapiska
int rowsCount = 0;
foreach (var wm in wms)
{
WMeterRsltItemSpec.TableRowNr = ++rowsCount;
if (!cfg.GoodOnly || wm.Passed)
{
WMeterRsltItemSpec.TableRowNr = ++rowsCount;
for (int i = 0; i < selectedItems.Count; i++)
{
WMeterRsltItemSpec.TableColumnNr = i + 1;
for (int i = 0; i < selectedItems.Count; i++)
{
WMeterRsltItemSpec.TableColumnNr = i + 1;
string itemText = selectedItems[i].Print(wm);
string itemText = selectedItems[i].Print(wm);
/// Strip color information
string[] texts = itemText.Split(new char[] { '|' });
if (texts.Length == 2)
{
itemText = texts[0];
Color color = texts[1].Equals("Green") ? Color.Green : (texts[1].Equals("Red") ? Color.Red : Color.White);
/// TODO: How to print colors?
}
/// Strip color information
string[] texts = itemText.Split(new char[] { '|' });
if (texts.Length == 2)
{
itemText = texts[0];
Color color = texts[1].Equals("Green") ? Color.Green : (texts[1].Equals("Red") ? Color.Red : Color.White);
/// TODO: How to print colors?
}
PrintAt(e, (int)columnPos[i], top + 2 * SpacingOne4Header + SpacingOne * rowsCount, itemText);
}
PrintAt(e, (int)columnPos[i], top + 2 * SpacingOne4Header + SpacingOne * rowsCount, itemText);
}
}
}
/// Horizontal line

View File

@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.17.677.0")]
[assembly: AssemblyFileVersion("2.17.677.0")]
[assembly: AssemblyVersion("2.17.681.0")]
[assembly: AssemblyFileVersion("2.17.681.0")]

View File

@ -107,6 +107,8 @@ namespace TBF.BenchControl.Output.Printers.Zapiska
printerCfg.BelowItems3 = newCfg.BelowItems3;
printerCfg.Footer = newCfg.Footer;
printerCfg.GoodOnly = newCfg.GoodOnly;
ApplyConfig();
}
}

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
[assembly: AssemblyVersion("2.17.680.1")]
[assembly: AssemblyFileVersion("2.17.680.1")]
[assembly: AssemblyVersion("2.17.681.1")]
[assembly: AssemblyFileVersion("2.17.681.1")]