68 lines
1.7 KiB
C#
68 lines
1.7 KiB
C#
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; } }
|
|
|
|
/// <summary>
|
|
/// Data to print
|
|
/// </summary>
|
|
BenchControl.BenchId.Component benchId;
|
|
IList<GenericDevices.IWaterMeter> waterMeters;
|
|
IList<Entities.TestResult> results;
|
|
string title;
|
|
|
|
public Printer(PrinterCfg cfg)
|
|
{
|
|
if (cfg == null) throw new ArgumentNullException("cfg");
|
|
this.printerCfg = cfg;
|
|
}
|
|
|
|
/// <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()
|
|
{
|
|
}
|
|
}
|
|
}
|