using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Printing;
using log4net;
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;
///
/// Data to print
///
public BenchControl.BenchId.Component BenchId;
public IList WaterMeters;
public IList Results;
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(PrinterCfg cfg)
: base(cfg)
{
printerCfg = cfg;
log.Debug(this.ToString());
}
/// Events: ResultsPrinted
/// Results to print
/// Reference to the operation
public IOperation PrintResultsOp(BenchControl.BenchId.Component benchId,
IList waterMeters,
IList results,
string title)
{
this.BenchId = benchId;
this.WaterMeters = waterMeters;
this.Results = results;
this.Title = title;
return this;
}
/// Start this operation
public void Start()
{
if (Results != null && Results.Count >= 1)
{
new MunichPrintDocument(this).Print();
}
}
/// Run this operation
/// Event.ResultsPrinted
public Event Run()
{
return Event.ResultsPrinted;
}
/// Stop this operation
public void Stop()
{
}
}
}