78 lines
2.0 KiB
C#
78 lines
2.0 KiB
C#
///
|
|
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
|
///
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Drawing;
|
|
using System.Drawing.Printing;
|
|
using log4net;
|
|
using Config.Entities;
|
|
using TBF.BenchControl;
|
|
|
|
namespace TBF.BenchControl.ResultsPrinters.Munich
|
|
{
|
|
public class Printer : ComponentBase, IOperation, GenericDevices.IResultsPrinter
|
|
{
|
|
private static readonly ILog log = LogManager.GetLogger(typeof(Printer));
|
|
public override string ToString() { return string.Format("ResultsPrinters.Munich({0})", Cfg.ToString(1)); }
|
|
|
|
readonly PrinterCfg printerCfg;
|
|
|
|
public bool SupressPrinting { get { return false; } }
|
|
|
|
|
|
/// <summary> Data to print </summary>
|
|
Results.Entities.Batch batch;
|
|
|
|
public string Title;
|
|
public string Version { get { return printerCfg.ProcParams.Version; } }
|
|
public string Zaehlertyp { get { return printerCfg.ProcParams.Zaehlertyp; } }
|
|
public string Pruefvorlage { get { return printerCfg.ProcParams.Pruefvorlage; } }
|
|
public string Eichjahr { get { return printerCfg.ProcParams.Eichjahr; } }
|
|
|
|
|
|
public Printer() { }
|
|
|
|
|
|
public Printer(PrinterCfg cfg)
|
|
: base(cfg)
|
|
{
|
|
printerCfg = cfg;
|
|
log.Debug(this.ToString());
|
|
}
|
|
|
|
|
|
/// <summary>Events: ResultsPrinted</summary>
|
|
/// <param name="benchId">Procedure to print the results of</param>
|
|
/// <param name="results">Results to print</param>
|
|
/// <returns>Reference to the operation</returns>
|
|
public IOperation PrintResultsOp(Results.Entities.Batch batch, string title)
|
|
{
|
|
this.batch = batch;
|
|
this.Title = title;
|
|
return this;
|
|
}
|
|
|
|
/// <summary>Start this operation</summary>
|
|
public void Start()
|
|
{
|
|
foreach (var wm in batch.WaterMeters)
|
|
{
|
|
new MunichPrintDocument(this, wm, printerCfg.PageOrientation).Print();
|
|
}
|
|
}
|
|
|
|
/// <summary>Run this operation</summary>
|
|
/// <returns>Event.ResultsPrinted</returns>
|
|
public Event Run()
|
|
{
|
|
return Event.ResultsPrinted;
|
|
}
|
|
|
|
/// <summary>Stop this operation</summary>
|
|
public void Stop()
|
|
{
|
|
}
|
|
}
|
|
}
|