tbf/TestBenchFramework/BenchControl/ResultsPrinters/LabelPrinter/PrinterCfg.cs
2015-12-08 23:44:52 +01:00

58 lines
1.7 KiB
C#

///
/// Copyright (c) 2015 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
using System.IO;
using System.Xml.Serialization;
using Config.Entities;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.ResultsPrinters.LabelPrinter
{
public class PrinterCfg : ComponentCfgBase, Generic.IComponentCfg
{
public IComponent GetComponent(IList<IComponent> components) { return new Printer(this); }
public IComponentCfgCtrl GetControl() { return new PrinterCfgCtrl(); }
///
/// Serialized parameters
///
public PageOrientation PageOrientation;
public int PaperWidth; /// In 0,254 mm = 1/100 in = 100dpi pixels count
public int PaperHeight; /// In 0,254 mm = 1/100 in = 100dpi pixels count
public string TemplateFile; /// Full path to a 'png' file
public bool SupressPrinting; /// true = Bypass printing
/// Private parameterless constructor invoked by all other (public) constructors
PrinterCfg()
{
Name = "LabelPrinter";
ParentName = string.Empty;
PageOrientation = PageOrientation.Portrait;
PaperWidth = 827; /// A4 width
PaperHeight = 1169; /// A4 height
TemplateFile = "C:\\TBF\\Templates\\Label.png";
SupressPrinting = false;
}
public PrinterCfg(IComponentFactory factory)
: this()
{
this.Factory = factory;
}
public string ToString(int i)
{
return string.Format("Name={0}, Orientation={1}, PaperWidth={2}, PaperHeight={3}, TemplateFile={4}, SupressPrinting={5}",
Name,
PageOrientation,
PaperWidth,
PaperHeight,
TemplateFile,
SupressPrinting ? "yes" : "no"
);
}
}
}