2014-07-28 07:54:35 +00:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
|
using System.Drawing.Printing;
|
2014-12-31 12:46:33 +00:00
|
|
|
|
using log4net;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
using TBF.BenchControl;
|
|
|
|
|
|
|
|
|
|
|
|
namespace TBF.BenchControl.ResultsPrinters.Basic
|
|
|
|
|
|
{
|
2014-12-31 12:46:33 +00:00
|
|
|
|
public class Printer : ComponentBase, IOperation, GenericDevices.IResultsPrinter
|
2014-07-28 07:54:35 +00:00
|
|
|
|
{
|
2014-12-31 12:46:33 +00:00
|
|
|
|
private static readonly ILog log = LogManager.GetLogger(typeof(Printer));
|
|
|
|
|
|
public override string ToString() { return string.Format("ResultsPrinters.Basic({0})", Cfg.ToString(1)); }
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
2014-12-31 12:46:33 +00:00
|
|
|
|
readonly PrinterCfg printerCfg;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Data to print
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
BenchControl.BenchId.Component benchId;
|
|
|
|
|
|
IList<GenericDevices.IWaterMeter> waterMeters;
|
|
|
|
|
|
IList<Entities.TestResult> results;
|
|
|
|
|
|
string title;
|
|
|
|
|
|
|
|
|
|
|
|
public Printer(PrinterCfg cfg)
|
2014-12-31 12:46:33 +00:00
|
|
|
|
: base(cfg)
|
2014-07-28 07:54:35 +00:00
|
|
|
|
{
|
2014-12-31 12:46:33 +00:00
|
|
|
|
printerCfg = cfg;
|
|
|
|
|
|
log.Debug(this.ToString());
|
2014-07-28 07:54:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Prints the test cycle results, Events: Event.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()
|
|
|
|
|
|
{
|
|
|
|
|
|
new BasicPrintDocument(benchId, waterMeters, results, title).Print();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>Run this operation</summary>
|
|
|
|
|
|
/// <returns>Event.ResultsPrinted</returns>
|
|
|
|
|
|
public Event Run()
|
|
|
|
|
|
{
|
|
|
|
|
|
return Event.ResultsPrinted;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>Stop this operation</summary>
|
|
|
|
|
|
public void Stop()
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|