using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Printing;
using TBF.BenchControl;
namespace TBF.BenchControl.ResultsPrinters.Basic
{
public class Printer : Generic.IComponent, IOperation, GenericDevices.IResultsPrinter
{
readonly PrinterCfg printerCfg;
public Generic.IComponentCfg Cfg { get { return printerCfg; } }
public static void ResetStaticProperties() { }
public string Name { get { return printerCfg.Name; } }
///
/// Data to print
///
BenchControl.BenchId.Component benchId;
IList waterMeters;
IList results;
string title;
public Printer(PrinterCfg cfg)
{
if (cfg == null) throw new ArgumentNullException("cfg");
this.printerCfg = cfg;
}
///
/// 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()
{
}
}
}