tbf/TestBenchFramework/BenchControl/ResultsPrinters/Munich/Printer.cs
2015-04-15 20:32:56 +02:00

79 lines
2.2 KiB
C#

///
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
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;
/// <summary>
/// Data to print
/// </summary>
public BenchControl.BenchId.Component BenchId;
public IList<GenericDevices.IWaterMeter> WaterMeters;
public IList<Entities.TestResult> 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());
}
/// <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(BenchControl.BenchId.Component benchId,
IList<GenericDevices.IWaterMeter> waterMeters,
Entities.Procedure procedure,
IList<Entities.TestResult> results,
string title)
{
this.BenchId = benchId;
this.WaterMeters = waterMeters;
this.Results = results;
this.Title = title;
return this;
}
/// <summary>Start this operation</summary>
public void Start()
{
if (Results != null && Results.Count >= 1)
{
new MunichPrintDocument(this).Print();
}
}
/// <summary>Run this operation</summary>
/// <returns>Event.ResultsPrinted</returns>
public Event Run()
{
return Event.ResultsPrinted;
}
/// <summary>Stop this operation</summary>
public void Stop()
{
}
}
}