Files
tbf/TBF/BenchControl/Output/Printers/Munich/Printer.cs
T

74 lines
1.7 KiB
C#

///
/// Copyright (c) 2013-2017 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Printing;
using log4net;
using Config.Entities;
using TBF.BenchControl;
namespace TBF.BenchControl.Output.Printers.Munich
{
public class Printer : ComponentBase, IOperation, GenericDevices.IResultsPrinter
{
private static readonly ILog log = LogManager.GetLogger(typeof(Printer));
public override string ToString() { return string.Format("Output.Printers.Munich({0})", Cfg.ToString(1)); }
readonly PrinterCfg printerCfg;
public bool SupressPrinting { get { return false; } }
/// <summary> Data to print </summary>
Results.Entities.Batch batch;
public string Version { get { return printerCfg.Version; } }
public Printer()
{
}
public Printer(Generic.IComponentCfg cfg)
: base(cfg)
{
printerCfg = cfg as PrinterCfg;
log.Debug(this.ToString());
}
/// <summary>Events: ResultsPrinted</summary>
/// <param name="benchId">Procedure to print the results of</param>
/// <param name="results">Results to print</param>
/// <returns>Reference to the operation</returns>
public IOperation PrintResultsOp(Results.Entities.Batch batch)
{
this.batch = batch;
return this;
}
/// <summary>Start this operation</summary>
public void Start()
{
foreach (var wm in batch.WaterMeters)
{
new Results.Output.Printers.Munich.MunichPrintDocument(printerCfg.Version, wm, printerCfg.PageOrientation).Print();
}
}
/// <summary>Run this operation</summary>
/// <returns>Event.ResultsPrinted</returns>
public Event Run()
{
return Event.ResultsPrinted;
}
/// <summary>Stop this operation</summary>
public void Stop()
{
}
}
}