- 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
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 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;
|
|
|
|
/// <summary>
|
|
/// Data to print
|
|
/// </summary>
|
|
BenchControl.BenchId.Component benchId;
|
|
IList<GenericDevices.IWaterMeter> waterMeters;
|
|
IList<Entities.TestResult> results;
|
|
string title;
|
|
|
|
public Printer(PrinterCfg cfg)
|
|
: base(cfg)
|
|
{
|
|
printerCfg = cfg;
|
|
log.Debug(this.ToString());
|
|
}
|
|
|
|
/// <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()
|
|
{
|
|
}
|
|
}
|
|
}
|