///
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
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;
Entities.Procedure procedure;
IList unsortedResults;
public Printer(PrinterCfg cfg)
: base(cfg)
{
printerCfg = cfg;
log.Debug(this.ToString());
}
///
/// Prints the test cycle results, Events: Event.ResultsPrinted
///
/// Bench ID
/// This parameter is unused
/// Procedure to print the results of
/// Results to print
/// This parameter is unused
/// Reference to the operation
public IOperation PrintResultsOp(BenchControl.BenchId.Component benchId,
IList waterMeters,
Entities.Procedure procedure,
IList unsortedResults,
string title)
{
if ((procedure == null) || (unsortedResults == null) || (unsortedResults.Count < 1))
{
return null;
}
this.benchId = benchId;
this.procedure = procedure;
this.unsortedResults = unsortedResults;
return this;
}
/// Start this operation
public void Start()
{
new BasicPrintDocument(benchId, procedure, unsortedResults).Print();
}
/// Run this operation
/// Event.ResultsPrinted
public Event Run()
{
return Event.ResultsPrinted;
}
/// Stop this operation
public void Stop()
{
}
}
}