/// /// 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; } } /// Data to print Results.Entities.Batch batch; public Printer() { } public Printer(PrinterCfg cfg) : base(cfg) { printerCfg = cfg; log.Debug(this.ToString()); } /// /// Prints the test cycle results, Events: Event.ResultsPrinted /// /// Batch results to print /// This parameter is unused /// Reference to the operation public IOperation PrintResultsOp(Results.Entities.Batch batch, string title) { this.batch = batch; return this; } /// Start this operation public void Start() { if (batch.WaterMeters.Count > 0) { new BasicPrintDocument(batch, printerCfg.PageOrientation, printerCfg.TopMargin, printerCfg.BottomMargin, printerCfg.LeftMargin).Print(); } } /// Run this operation /// Event.ResultsPrinted public Event Run() { return Event.ResultsPrinted; } /// Stop this operation public void Stop() { } } }