/// /// Copyright (c) 2015-2016 Sensus Metering Systems /// using log4net; namespace TBF.BenchControl.ResultsPrinters.LabelPrinter { public class Printer : ComponentBase, IOperation, GenericDevices.IResultsPrinter { private static readonly ILog log = LogManager.GetLogger(typeof(Printer)); public override string ToString() { return string.Format("LabelPrinter({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 PrintLabelDocument(batch, printerCfg.PageOrientation, printerCfg.PaperWidth, printerCfg.PaperHeight, printerCfg.TemplateFile).Print(); } } /// Run this operation /// Event.ResultsPrinted public Event Run() { return Event.ResultsPrinted; } /// Stop this operation public void Stop() { } } }