tbf/TBF/BenchControl/Output/Printers/Label/PrinterCfg.cs

80 lines
2.3 KiB
C#

///
/// Copyright (c) 2015-2020 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.IO;
using System.Xml.Serialization;
using Config.Entities;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Output.Printers.Label
{
public class PrinterCfg : ComponentCfgBase, Generic.IComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(PrinterCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl(IList<Config.Entities.Component> cmpntEntities) { return new PrinterCfgCtrl(); }
///
/// Serialized parameters
///
public string Template; /// Full path to a 'png' file
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[] ItemsToPrint;
public string FontFamily;
public int FontSize;
public int FontStyle;
public Culture Culture;
public int NrOfCopies;
public bool GoodOnly;
public Results.Output.Printers.BarcodeType BarcodeType;
public int BarcodeLeft;
public int BarcodeTop;
public int BarcodeWidth;
public int BarcodeHeight;
/// Private parameterless constructor invoked by all other (public) constructors
PrinterCfg()
{
}
public PrinterCfg(string name, IComponentFactory factory)
: this()
{
this.Name = name;
this.Factory = factory;
ParentName = string.Empty;
Template = string.Empty;
PageOrientation = PageOrientation.Portrait;
PaperWidth = 827; /// A4 width
PaperHeight = 1169; /// A4 height
FontFamily = "Arial";
FontSize = 10;
FontStyle = 0;
NrOfCopies = 1;
GoodOnly = false;
BarcodeType = Results.Output.Printers.BarcodeType.None;
}
public string ToString(int i)
{
return string.Format("Name={0}, Orientation={1}, PaperWidth={2}, PaperHeight={3}, TemplateFile={4}, GoodOnly={5}, Barcode={6}",
Name,
PageOrientation,
PaperWidth,
PaperHeight,
Template,
GoodOnly ? "yes" : "no",
BarcodeType.ToString()
);
}
}
}