66 lines
1.6 KiB
C#
66 lines
1.6 KiB
C#
///
|
|
/// Copyright (c) 2013-2016 Sensus Metering Systems
|
|
///
|
|
using log4net;
|
|
|
|
namespace TBF.BenchControl.ResultsPrinters.Basic
|
|
{
|
|
public class Printer : ComponentBase, IOperation, GenericDevices.IResultsPrinter
|
|
{
|
|
private static readonly ILog log = LogManager.GetLogger(typeof(Printer));
|
|
public override string ToString() { return string.Format("ResultsPrinters.Basic({0})", Cfg.ToString(1)); }
|
|
|
|
readonly PrinterCfg printerCfg;
|
|
|
|
public bool SupressPrinting { get { return printerCfg.SupressPrinting; } }
|
|
|
|
|
|
/// <summary> Data to print </summary>
|
|
Results.Entities.Batch batch;
|
|
|
|
|
|
public Printer() { }
|
|
|
|
|
|
public Printer(PrinterCfg cfg)
|
|
: base(cfg)
|
|
{
|
|
printerCfg = cfg;
|
|
log.Debug(this.ToString());
|
|
}
|
|
|
|
/// <summary>
|
|
/// Prints the test cycle results, Events: Event.ResultsPrinted
|
|
/// </summary>
|
|
/// <param name="batch">Batch results to print</param>
|
|
/// <param name="title">This parameter is unused</param>
|
|
/// <returns>Reference to the operation</returns>
|
|
public IOperation PrintResultsOp(Results.Entities.Batch batch, string title)
|
|
{
|
|
this.batch = batch;
|
|
return this;
|
|
}
|
|
|
|
/// <summary>Start this operation</summary>
|
|
public void Start()
|
|
{
|
|
if (batch.WaterMeters.Count > 0)
|
|
{
|
|
new BasicPrintDocument(batch, printerCfg.PageOrientation, printerCfg.TopMargin, printerCfg.BottomMargin, printerCfg.LeftMargin).Print();
|
|
}
|
|
}
|
|
|
|
/// <summary>Run this operation</summary>
|
|
/// <returns>Event.ResultsPrinted</returns>
|
|
public Event Run()
|
|
{
|
|
return Event.ResultsPrinted;
|
|
}
|
|
|
|
/// <summary>Stop this operation</summary>
|
|
public void Stop()
|
|
{
|
|
}
|
|
}
|
|
}
|