/// /// Copyright (c) 2013-2015 Sensus Metering Systems /// using System; using System.Collections.Generic; using System.Drawing; using System.Drawing.Printing; using log4net; using Config.Entities; using TBF.BenchControl; namespace TBF.BenchControl.ResultsPrinters.Munich { public class Printer : ComponentBase, IOperation, GenericDevices.IResultsPrinter { private static readonly ILog log = LogManager.GetLogger(typeof(Printer)); public override string ToString() { return string.Format("ResultsPrinters.Munich({0})", Cfg.ToString(1)); } readonly PrinterCfg printerCfg; public bool SupressPrinting { get { return false; } } /// Data to print Results.Entities.Batch batch; public string Title; public string Version { get { return printerCfg.ProcParams.Version; } } public string Zaehlertyp { get { return printerCfg.ProcParams.Zaehlertyp; } } public string Pruefvorlage { get { return printerCfg.ProcParams.Pruefvorlage; } } public string Eichjahr { get { return printerCfg.ProcParams.Eichjahr; } } public Printer() { } public Printer(PrinterCfg cfg) : base(cfg) { printerCfg = cfg; log.Debug(this.ToString()); } /// Events: ResultsPrinted /// Procedure to print the results of /// Results to print /// Reference to the operation public IOperation PrintResultsOp(Results.Entities.Batch batch, string title) { this.batch = batch; this.Title = title; return this; } /// Start this operation public void Start() { foreach (var wm in batch.WaterMeters) { new MunichPrintDocument(this, wm, printerCfg.PageOrientation).Print(); } } /// Run this operation /// Event.ResultsPrinted public Event Run() { return Event.ResultsPrinted; } /// Stop this operation public void Stop() { } } }