tbf/TestBenchFramework/BenchControl/ResultsPrinters/Cevak/Printer.cs
2016-02-23 21:12:17 +01:00

68 lines
1.8 KiB
C#

///
/// Copyright (c) 2013-2016 Sensus Metering Systems
///
using log4net;
namespace TBF.BenchControl.ResultsPrinters.Cevak
{
public class Printer : ComponentBase, IOperation, GenericDevices.IResultsPrinter
{
private static readonly ILog log = LogManager.GetLogger(typeof(Printer));
public override string ToString() { return string.Format("ResultsPrinters.Cevak({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)
{
TBF.BenchControl.BenchInfo.Polska.Component benchInfo =
BenchControl.Sequences.ProcessData.BenchInfo as TBF.BenchControl.BenchInfo.Polska.Component;
new PrintDocumentCevak(batch, printerCfg.PageOrientation, printerCfg.TopMargin, printerCfg.BottomMargin, printerCfg.LeftMargin, benchInfo).Print();
}
}
/// <summary>Run this operation</summary>
/// <returns>Event.ResultsPrinted</returns>
public Event Run()
{
return Event.ResultsPrinted;
}
/// <summary>Stop this operation</summary>
public void Stop()
{
}
}
}