tbf/TestBenchFramework/BenchControl/ResultsPrinters/Munich/Printer.cs
Milan Hanajik 94de991bf6 Everything works OK after serious changes:
- all components, componentCfg-s and parameter providers use base classes
 - less boilerplate code, simpler access to test/procedure parameters from code
 - CreateTestParams(test), CreateProcedureParams(procedure) methods added
 - TestBenchSim class is made static, it is not inheritted by any device anymore
2015-01-02 12:51:27 +01:00

74 lines
2.0 KiB
C#

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="results">Results to print</param>
/// <returns>Reference to the operation</returns>
public IOperation PrintResultsOp(BenchControl.BenchId.Component benchId,
IList<GenericDevices.IWaterMeter> waterMeters,
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()
{
}
}
}