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