diff --git a/TestBenchFramework/BenchControl/BenchInfo/Polska/Component.cs b/TestBenchFramework/BenchControl/BenchInfo/Polska/Component.cs
index 15026736f..ebc170f4c 100644
--- a/TestBenchFramework/BenchControl/BenchInfo/Polska/Component.cs
+++ b/TestBenchFramework/BenchControl/BenchInfo/Polska/Component.cs
@@ -1,5 +1,5 @@
///
-/// Copyright (c) 2013-2015 Sensus Metering Systems
+/// Copyright (c) 2013-2016 Sensus Metering Systems
/// Author: Milan Hanajík
///
using System;
@@ -18,7 +18,7 @@ namespace TBF.BenchControl.BenchInfo.Polska
public class Component : ComponentBase, GenericDevices.IBenchInfo
{
private static readonly ILog log = LogManager.GetLogger(typeof(Component));
- public override string ToString() { return string.Format("BenchInfoPL({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("BenchInfoEx({0})", Cfg.ToString(1)); }
readonly ComponentCfg benchInfoCfg;
diff --git a/TestBenchFramework/BenchControl/BenchInfo/Polska/ComponentCfg.cs b/TestBenchFramework/BenchControl/BenchInfo/Polska/ComponentCfg.cs
index aa0f87601..f93e86008 100644
--- a/TestBenchFramework/BenchControl/BenchInfo/Polska/ComponentCfg.cs
+++ b/TestBenchFramework/BenchControl/BenchInfo/Polska/ComponentCfg.cs
@@ -34,7 +34,7 @@ namespace TBF.BenchControl.BenchInfo.Polska
/// Private parameterless constructor invoked by all other (public) constructors
ComponentCfg()
{
- Name = "BenchInfo";
+ Name = "BenchInfoEx";
ParentName = string.Empty;
TestBenchName = "1";
TestBenchId = 1;
diff --git a/TestBenchFramework/BenchControl/BenchInfo/Polska/ComponentCfgCtrl.cs b/TestBenchFramework/BenchControl/BenchInfo/Polska/ComponentCfgCtrl.cs
index cbfc07ce0..ef92b14f8 100644
--- a/TestBenchFramework/BenchControl/BenchInfo/Polska/ComponentCfgCtrl.cs
+++ b/TestBenchFramework/BenchControl/BenchInfo/Polska/ComponentCfgCtrl.cs
@@ -1,5 +1,5 @@
///
-/// Copyright (c) 2015 Sensus Metering Systems
+/// Copyright (c) 2015-2016 Sensus Metering Systems
/// Author: Milan Hanajík
///
using System;
diff --git a/TestBenchFramework/BenchControl/BenchInfo/Polska/ComponentFactory.cs b/TestBenchFramework/BenchControl/BenchInfo/Polska/ComponentFactory.cs
index c0c3b3896..116ea1640 100644
--- a/TestBenchFramework/BenchControl/BenchInfo/Polska/ComponentFactory.cs
+++ b/TestBenchFramework/BenchControl/BenchInfo/Polska/ComponentFactory.cs
@@ -8,7 +8,7 @@ namespace TBF.BenchControl.BenchInfo.Polska
{
public class ComponentFactory : IComponentFactory
{
- public string ClassName { get { return "BenchInfoPL"; } }
+ public string ClassName { get { return "BenchInfoEx"; } }
public void ResetStaticProperties() { Component.ResetStaticProperties(); }
diff --git a/TestBenchFramework/BenchControl/ResultsPrinters/Cevak/PrintDocumentCevak.cs b/TestBenchFramework/BenchControl/ResultsPrinters/Cevak/PrintDocumentCevak.cs
new file mode 100644
index 000000000..4b5f38580
--- /dev/null
+++ b/TestBenchFramework/BenchControl/ResultsPrinters/Cevak/PrintDocumentCevak.cs
@@ -0,0 +1,368 @@
+///
+/// Copyright (c) 2013-2015 Sensus Metering Systems
+///
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Drawing.Printing;
+using System.IO;
+using Config.Entities;
+using TBF.Resources;
+
+namespace TBF.BenchControl.ResultsPrinters.Cevak
+{
+ public class PrintDocumentCevak : PrintDocument
+ {
+ const string FontFamilyName = "Arial"; //"Times New Roman";
+
+ const int SpacingOne = 18;
+ const int SpacingOneAndHalf = (3 * SpacingOne) / 2;
+ const int TitleX = 100;
+ readonly int TitleY; /// Depends on the size of the header
+ readonly int HdrTop; /// = TitleY + 60
+ readonly int BodyTop; /// = HdrTop + 160
+
+ ///
+ /// Property variable for the Font the user wishes to use
+ ///
+ Font font;
+ Font boldFont;
+ Font titleFont;
+
+ ///
+ /// Data to print
+ ///
+ Results.Entities.Batch batch;
+
+ ///
+ /// Items to print
+ ///
+ readonly IList rsltItems;
+
+ ///
+ /// Layout and status
+ ///
+ int nrWMsOnFirstPage;
+ int nrWMsOnNextPage;
+ int nextWMNr; /// nr. of watermeter to be printed as the first one on the next page
+ int nrPages;
+ int pageNr; /// Page number to be printed at the bottom of the page
+
+
+ ///
+ /// Constructor
+ ///
+ /// Text to be printed
+ public PrintDocumentCevak(Results.Entities.Batch batch,
+ PageOrientation pageOrientation,
+ int topMrgn)
+ {
+ this.batch = batch;
+
+ DefaultPageSettings.Landscape = (pageOrientation == PageOrientation.Landscape);
+
+ TitleY = topMrgn; /// Depends on the size of the header
+ HdrTop = TitleY + 60;
+ BodyTop = HdrTop + 160;
+
+ if (batch.WaterMeters[0].Compound())
+ {
+ rsltItems = Results.ItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Printer_CombinedWM);
+ }
+ else
+ {
+ rsltItems = Results.ItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Printer_SingleWM);
+ }
+
+ /// Set print area size and margins (in dots using 80 dpi)
+ int printHeight = base.DefaultPageSettings.PaperSize.Height - base.DefaultPageSettings.Margins.Top - base.DefaultPageSettings.Margins.Bottom;
+ int printWidth = base.DefaultPageSettings.PaperSize.Width - base.DefaultPageSettings.Margins.Left - base.DefaultPageSettings.Margins.Right;
+ int leftMargin = base.DefaultPageSettings.Margins.Left; /// X
+ int topMargin = base.DefaultPageSettings.Margins.Top; /// Y
+
+ /// Check if the user selected to print in Landscape mode
+ /// if they did then we need to swap height/width parameters
+ if (DefaultPageSettings.Landscape)
+ {
+ int tmp = printHeight;
+ printHeight = printWidth;
+ printWidth = tmp;
+ }
+
+ int testsCount = batch.WaterMeters[0].MeterTestRslts.Count;
+ if (batch.WaterMeters[0].Compound()) testsCount /= 3;
+
+ int wmSectionHeight = (testsCount + 4) * SpacingOne;
+
+ nrWMsOnFirstPage = (printHeight - BodyTop + TitleY - 2 * SpacingOne) / wmSectionHeight;
+ nrWMsOnNextPage = (printHeight - 2 * SpacingOne) / wmSectionHeight;
+
+ nrPages = 1 + batch.WaterMeters.Count / nrWMsOnNextPage;
+
+ pageNr = 1;
+ nextWMNr = 0;
+ }
+
+ ///
+ /// Override the default onbeginPrint method of the PrintDocument Object
+ ///
+ ///
+ ///
+ protected override void OnBeginPrint(System.Drawing.Printing.PrintEventArgs e)
+ {
+ base.OnBeginPrint(e);
+
+ if (font == null) { font = new Font(FontFamilyName, 10, FontStyle.Regular); }
+ if (boldFont == null) { boldFont = new Font(FontFamilyName, 10, FontStyle.Bold); }
+ if (titleFont == null) { titleFont = new Font(FontFamilyName, 18, FontStyle.Bold); }
+ }
+
+ ///
+ /// Override the default OnPrintPage method of the PrintDocument.
+ ///
+ ///
+ /// This provides the print logic for our document
+ protected override void OnPrintPage(System.Drawing.Printing.PrintPageEventArgs e)
+ {
+ /// Run base code
+ base.OnPrintPage(e);
+
+ if (File.Exists("C:\\TBF\\header.png"))
+ {
+ Image img = Image.FromFile("C:\\TBF\\header.png");
+ e.Graphics.DrawImage(new Bitmap(img), new Rectangle(0, 0, 827, 1169));
+ }
+
+ /// Set print area size and margins (in dots using 80 dpi)
+ int printHeight = base.DefaultPageSettings.PaperSize.Height - base.DefaultPageSettings.Margins.Top - base.DefaultPageSettings.Margins.Bottom;
+ int printWidth = base.DefaultPageSettings.PaperSize.Width - base.DefaultPageSettings.Margins.Left - base.DefaultPageSettings.Margins.Right;
+ int leftMargin = base.DefaultPageSettings.Margins.Left; /// X
+ int topMargin = base.DefaultPageSettings.Margins.Top; /// Y
+
+ /// Check if the user selected to print in Landscape mode
+ /// if they did then we need to swap height/width parameters
+ if (base.DefaultPageSettings.Landscape)
+ {
+ int tmp = printHeight;
+ printHeight = printWidth;
+ printWidth = tmp;
+ }
+
+ int x = leftMargin;
+ int y = topMargin;
+
+ /// Use the StringFormat class for the text layout of our document
+ StringFormat format = new StringFormat(StringFormatFlags.LineLimit);
+
+ if (pageNr == 1)
+ {
+ ///----------
+ /// Header
+ ///----------
+ RectangleF printArea = new RectangleF(TitleX, TitleY, 667, 40);
+ e.Graphics.DrawString(batch.ProtocolTitle, titleFont, Brushes.Black, printArea);
+
+ string[] leftColumn = new string[]
+ {
+ "Batch number: ",
+ "Date and time: ",
+ "Procedure:",
+ Strings.User_,
+ "Ambient temperature: ",
+ "Ambient pressure: ",
+ "Ambient humidity: ",
+ };
+
+ string[] rightColumn = new string[]
+ {
+ batch.BatchNr.ToString(),
+ //batch.EndTime.ToShortDateString() + " " + batch.EndTime.ToShortTimeString(),
+ string.Format("{0}.{1}.{2} {3}:{4}", batch.EndTime.Year.ToString("D4"),
+ batch.EndTime.Month.ToString("D2"),
+ batch.EndTime.Day.ToString("D2"),
+ batch.EndTime.Hour.ToString("D2"),
+ batch.EndTime.Minute.ToString("D2")),
+ batch.ProcedureName,
+ User.CurrentUser.Name,
+ batch.AmbientTempAve().ToString("F1") + " °C",
+ batch.AmbientPressAve().ToString("F0") + " mbar",
+ batch.AmbientHumiAve().ToString("F0") + " %",
+ };
+
+ /// Determine max. left column width in characters
+ int maxLen = 0;
+ foreach (var s in leftColumn) if (s.Length > maxLen) maxLen = s.Length;
+
+ /// Write aligned columns
+ for (int i = 0; i < Math.Min(leftColumn.Length, rightColumn.Length); i++)
+ {
+ PrintAt(e, 100, HdrTop + SpacingOne * i, leftColumn[i]);
+ PrintAt(e, 300, HdrTop + SpacingOne * i, rightColumn[i]);
+ }
+ }
+
+ ///--------
+ /// Body
+ ///--------
+
+ /// This variable represents the top coordinate of the area where WM results are printed
+ /// and it is updated (increased by) the value returned by PrintXyzWM() - the section size.
+ int nextWmTop = (pageNr == 1) ? BodyTop : TitleY;
+
+ int nrWMsOnPage = (pageNr == 1) ? nrWMsOnFirstPage : nrWMsOnNextPage;
+
+ for (int wmNr = nextWMNr; wmNr < Math.Min(nextWMNr + nrWMsOnPage, batch.WaterMeters.Count); wmNr++) /// wmNr is 0-based
+ {
+ nextWmTop += PrintWM(e, batch.WaterMeters[wmNr], wmNr + 1, nextWmTop);
+ }
+
+ nextWMNr += nrWMsOnPage;
+ e.HasMorePages = (nextWMNr < batch.WaterMeters.Count);
+
+ ///----------
+ /// Footer
+ ///----------
+ PrintAt(e, leftMargin, topMargin + printHeight - SpacingOne, string.Format("{0} {1}/{2}", Strings.Page, pageNr++, nrPages));
+ }
+
+
+ ///
+ /// Print one water meter results
+ ///
+ /// Water meter
+ /// Number of the water meter printed
+ /// Top coordinate of watermeter data
+ /// The height of the printed section
+ int PrintWM(System.Drawing.Printing.PrintPageEventArgs e,
+ Results.Entities.WaterMeter wm, int printedWMNr, int top)
+ {
+ /// Determin column widths
+ float[] columnPos = new float[rsltItems.Count + 1];
+ columnPos[0] = 100.0f;
+
+ for (int i = 0; i < rsltItems.Count; i++)
+ {
+ float columnWidth = e.Graphics.MeasureString(rsltItems[i].ClmnHeaderText, font).Width;
+ foreach (var mtr in wm.MeterTestRslts)
+ {
+ string itemText;
+
+ if (!wm.Compound())
+ {
+ itemText = rsltItems[i].Print(mtr);
+ }
+ else if (mtr.CompoundMeterId == (byte)CompoundMeterId.Compound)
+ {
+ Results.Entities.MeterTestRslt mainMtr = wm.GetMeterTestRslt(mtr.Name(), CompoundMeterId.CompoundMain);
+ Results.Entities.MeterTestRslt auxMtr = wm.GetMeterTestRslt(mtr.Name(), CompoundMeterId.CompoundAux);
+ itemText = rsltItems[i].PrintCombined(mainMtr, auxMtr, mtr);
+ }
+ else
+ {
+ continue;
+ }
+
+ /// Strip color information
+ string[] texts = itemText.Split(new char[] { '|' });
+ if (texts.Length == 2) { itemText = texts[0]; }
+
+ float width = e.Graphics.MeasureString(itemText, font).Width;
+ if (width > columnWidth) columnWidth = width;
+ }
+ columnPos[i + 1] = columnPos[i] + columnWidth + 20.0f;
+ }
+ int tableLeftX = (int)columnPos[0];
+ int tableRightX = (int)columnPos[rsltItems.Count] - 20;
+
+ string wmText = string.Format("Water meter {0}", printedWMNr);
+ PrintAt(e, 100, top, wmText);
+ if (!string.IsNullOrEmpty(wm.SerialNr))
+ {
+ PrintAt(e, 100 + (int)e.Graphics.MeasureString(wmText, font).Width, top,
+ string.Format(" s/n = {0}", wm.SerialNr));
+ }
+
+ /// Horizontal line
+ int horY = top + 25;
+ e.Graphics.DrawLine(new Pen(Color.Black, 2), new Point(tableLeftX, horY), new Point(tableRightX, horY));
+
+ for (int i = 0; i < rsltItems.Count; i++)
+ {
+ PrintAt(e, (int)columnPos[i], top + 27, rsltItems[i].ClmnHeaderText);
+ }
+
+ /// Horizontal line
+ horY = top + 27 + SpacingOne;
+ e.Graphics.DrawLine(new Pen(Color.Black, 2), new Point(tableLeftX, horY), new Point(tableRightX, horY));
+
+ int testsCount = 0;
+ foreach (var mtr in wm.MeterTestRslts)
+ {
+ for (int i = 0; i < rsltItems.Count; i++)
+ {
+ string itemText;
+
+ if (!wm.Compound())
+ {
+ /// Single water meter
+ itemText = rsltItems[i].Print(mtr);
+ }
+ else if (mtr.CompoundMeterId == (byte)CompoundMeterId.Compound)
+ {
+ Results.Entities.MeterTestRslt mainMtr = wm.GetMeterTestRslt(mtr.Name(), CompoundMeterId.CompoundMain);
+ Results.Entities.MeterTestRslt auxMtr = wm.GetMeterTestRslt(mtr.Name(), CompoundMeterId.CompoundMain);
+ itemText = rsltItems[i].PrintCombined(mainMtr, auxMtr, mtr);
+ }
+ else
+ {
+ continue;
+ }
+
+ /// Strip color information
+ string[] texts = itemText.Split(new char[] { '|' });
+ if (texts.Length == 2)
+ {
+ itemText = texts[0];
+ Color color = texts[1].Equals("Green") ? Color.Green : (texts[1].Equals("Red") ? Color.Red : Color.White);
+ /// TODO: How to print colors?
+ }
+
+ testsCount++;
+ PrintAt(e, (int)columnPos[i], top + 30 + SpacingOne * testsCount, itemText);
+ }
+ }
+
+ /// Horizontal line
+ horY = top + 30 + SpacingOne * (testsCount + 1);
+ e.Graphics.DrawLine(new Pen(Color.Black, 2), new Point(tableLeftX, horY), new Point(tableRightX, horY));
+
+ return (testsCount + 4) * SpacingOne;
+ }
+
+
+ void PrintAt(System.Drawing.Printing.PrintPageEventArgs e, Point p, string text)
+ {
+ PrintAt(e, p.X, p.Y, text);
+ }
+
+
+ void PrintAt(System.Drawing.Printing.PrintPageEventArgs e, int x, int y, string text)
+ {
+ RectangleF printArea = new RectangleF(x, y, 667, SpacingOne);
+ e.Graphics.DrawString(text, this.font, Brushes.Black, printArea);
+ }
+
+
+ void PrintBoldAt(System.Drawing.Printing.PrintPageEventArgs e, Point p, string text)
+ {
+ PrintBoldAt(e, p.X, p.Y, text);
+ }
+
+
+ void PrintBoldAt(System.Drawing.Printing.PrintPageEventArgs e, int x, int y, string text)
+ {
+ RectangleF printArea = new RectangleF(x, y, 667, SpacingOne);
+ e.Graphics.DrawString(text, this.boldFont, Brushes.Black, printArea);
+ }
+ }
+}
diff --git a/TestBenchFramework/BenchControl/ResultsPrinters/Cevak/Printer.cs b/TestBenchFramework/BenchControl/ResultsPrinters/Cevak/Printer.cs
new file mode 100644
index 000000000..d4b324024
--- /dev/null
+++ b/TestBenchFramework/BenchControl/ResultsPrinters/Cevak/Printer.cs
@@ -0,0 +1,67 @@
+///
+/// Copyright (c) 2013-2016 Sensus Metering Systems
+///
+using log4net;
+
+namespace TBF.BenchControl.ResultsPrinters.Cevak
+{
+ public class Printer : ComponentBase, IOperation, GenericDevices.IResultsPrinter
+ {
+ private static readonly ILog log = LogManager.GetLogger(typeof(Printer));
+ public override string ToString() { return string.Format("ResultsPrinters.Cevak({0})", Cfg.ToString(1)); }
+
+ readonly PrinterCfg printerCfg;
+
+ public bool SupressPrinting { get { return printerCfg.SupressPrinting; } }
+
+
+ /// Data to print
+ Results.Entities.Batch batch;
+
+
+ public Printer() { }
+
+
+ public Printer(PrinterCfg cfg)
+ : base(cfg)
+ {
+ printerCfg = cfg;
+ log.Debug(this.ToString());
+ }
+
+ ///
+ /// Prints the test cycle results, Events: Event.ResultsPrinted
+ ///
+ /// Batch results to print
+ /// This parameter is unused
+ /// Reference to the operation
+ public IOperation PrintResultsOp(Results.Entities.Batch batch, string title)
+ {
+ this.batch = batch;
+ return this;
+ }
+
+ /// Start this operation
+ public void Start()
+ {
+ if (batch.WaterMeters.Count > 0)
+ {
+ new PrintDocumentCevak(batch,
+ printerCfg.PageOrientation,
+ printerCfg.TopMargin).Print();
+ }
+ }
+
+ /// Run this operation
+ /// Event.ResultsPrinted
+ public Event Run()
+ {
+ return Event.ResultsPrinted;
+ }
+
+ /// Stop this operation
+ public void Stop()
+ {
+ }
+ }
+}
diff --git a/TestBenchFramework/BenchControl/ResultsPrinters/Cevak/PrinterCfg.cs b/TestBenchFramework/BenchControl/ResultsPrinters/Cevak/PrinterCfg.cs
new file mode 100644
index 000000000..da9a3a17a
--- /dev/null
+++ b/TestBenchFramework/BenchControl/ResultsPrinters/Cevak/PrinterCfg.cs
@@ -0,0 +1,51 @@
+///
+/// Copyright (c) 2013-2016 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.Cevak
+{
+ public class PrinterCfg : ComponentCfgBase, Generic.IComponentCfg
+ {
+ public IComponent GetComponent(IList components) { return new Printer(this); }
+ public IComponentCfgCtrl GetControl() { return new PrinterCfgCtrl(); }
+
+ ///
+ /// Serialized parameters
+ ///
+ public PageOrientation PageOrientation;
+ public int TopMargin;
+ public bool SupressPrinting; /// Bypass printing when true
+
+ /// Private parameterless constructor invoked by all other (public) constructors
+ PrinterCfg()
+ {
+ Name = "ResultsPrinterCevak";
+ ParentName = string.Empty;
+ PageOrientation = PageOrientation.Portrait;
+ TopMargin = 100;
+ SupressPrinting = false;
+ }
+
+ public PrinterCfg(IComponentFactory factory)
+ : this()
+ {
+ this.Factory = factory;
+ }
+
+ public string ToString(int i)
+ {
+ return string.Format("Name={0}, Orientation={1}, TopMargin={2}, SupressPrinting={3}",
+ Name,
+ PageOrientation,
+ TopMargin,
+ SupressPrinting ? "yes" : "no"
+ );
+ }
+ }
+}
diff --git a/TestBenchFramework/BenchControl/ResultsPrinters/Cevak/PrinterCfgCtrl.Designer.cs b/TestBenchFramework/BenchControl/ResultsPrinters/Cevak/PrinterCfgCtrl.Designer.cs
new file mode 100644
index 000000000..598f2c3b0
--- /dev/null
+++ b/TestBenchFramework/BenchControl/ResultsPrinters/Cevak/PrinterCfgCtrl.Designer.cs
@@ -0,0 +1,147 @@
+///
+/// Copyright (c) 2013-2015 Sensus Metering Systems
+///
+namespace TBF.BenchControl.ResultsPrinters.Cevak
+{
+ partial class PrinterCfgCtrl
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Component Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.nameTextBox = new System.Windows.Forms.TextBox();
+ this.nameLabel = new System.Windows.Forms.Label();
+ this.classNameLabel = new System.Windows.Forms.Label();
+ this.supressPrintingCheckBox = new System.Windows.Forms.CheckBox();
+ this.orientationLabel = new System.Windows.Forms.Label();
+ this.orientationComboBox = new System.Windows.Forms.ComboBox();
+ this.topMarginTextBox = new System.Windows.Forms.TextBox();
+ this.topMarginLabel = new System.Windows.Forms.Label();
+ this.SuspendLayout();
+ //
+ // nameTextBox
+ //
+ this.nameTextBox.Enabled = false;
+ this.nameTextBox.Location = new System.Drawing.Point(142, 57);
+ this.nameTextBox.Name = "nameTextBox";
+ this.nameTextBox.Size = new System.Drawing.Size(130, 20);
+ this.nameTextBox.TabIndex = 2;
+ //
+ // nameLabel
+ //
+ this.nameLabel.AutoSize = true;
+ this.nameLabel.Location = new System.Drawing.Point(24, 60);
+ this.nameLabel.Name = "nameLabel";
+ this.nameLabel.Size = new System.Drawing.Size(35, 13);
+ this.nameLabel.TabIndex = 1;
+ this.nameLabel.Text = "Name";
+ //
+ // classNameLabel
+ //
+ this.classNameLabel.AutoSize = true;
+ this.classNameLabel.Location = new System.Drawing.Point(139, 33);
+ this.classNameLabel.Name = "classNameLabel";
+ this.classNameLabel.Size = new System.Drawing.Size(83, 13);
+ this.classNameLabel.TabIndex = 0;
+ this.classNameLabel.Text = "ComonentName";
+ //
+ // supressPrintingCheckBox
+ //
+ this.supressPrintingCheckBox.AutoSize = true;
+ this.supressPrintingCheckBox.Enabled = false;
+ this.supressPrintingCheckBox.Location = new System.Drawing.Point(142, 144);
+ this.supressPrintingCheckBox.Name = "supressPrintingCheckBox";
+ this.supressPrintingCheckBox.Size = new System.Drawing.Size(101, 17);
+ this.supressPrintingCheckBox.TabIndex = 7;
+ this.supressPrintingCheckBox.Text = "Supress printing";
+ this.supressPrintingCheckBox.UseVisualStyleBackColor = true;
+ //
+ // orientationLabel
+ //
+ this.orientationLabel.AutoSize = true;
+ this.orientationLabel.Location = new System.Drawing.Point(24, 86);
+ this.orientationLabel.Name = "orientationLabel";
+ this.orientationLabel.Size = new System.Drawing.Size(84, 13);
+ this.orientationLabel.TabIndex = 3;
+ this.orientationLabel.Text = "Page orientation";
+ //
+ // orientationComboBox
+ //
+ this.orientationComboBox.Enabled = false;
+ this.orientationComboBox.FormattingEnabled = true;
+ this.orientationComboBox.Location = new System.Drawing.Point(142, 83);
+ this.orientationComboBox.Name = "orientationComboBox";
+ this.orientationComboBox.Size = new System.Drawing.Size(130, 21);
+ this.orientationComboBox.TabIndex = 4;
+ //
+ // topMarginTextBox
+ //
+ this.topMarginTextBox.Enabled = false;
+ this.topMarginTextBox.Location = new System.Drawing.Point(142, 110);
+ this.topMarginTextBox.Name = "topMarginTextBox";
+ this.topMarginTextBox.Size = new System.Drawing.Size(130, 20);
+ this.topMarginTextBox.TabIndex = 6;
+ //
+ // topMarginLabel
+ //
+ this.topMarginLabel.AutoSize = true;
+ this.topMarginLabel.Location = new System.Drawing.Point(24, 113);
+ this.topMarginLabel.Name = "topMarginLabel";
+ this.topMarginLabel.Size = new System.Drawing.Size(109, 13);
+ this.topMarginLabel.TabIndex = 5;
+ this.topMarginLabel.Text = "Top margin [1/100 in]";
+ //
+ // PrinterCfgCtrl
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.topMarginTextBox);
+ this.Controls.Add(this.topMarginLabel);
+ this.Controls.Add(this.orientationComboBox);
+ this.Controls.Add(this.orientationLabel);
+ this.Controls.Add(this.supressPrintingCheckBox);
+ this.Controls.Add(this.nameTextBox);
+ this.Controls.Add(this.nameLabel);
+ this.Controls.Add(this.classNameLabel);
+ this.Name = "PrinterCfgCtrl";
+ this.Size = new System.Drawing.Size(300, 200);
+ this.Load += new System.EventHandler(this.PrinterCfgCtrl_Load);
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.TextBox nameTextBox;
+ private System.Windows.Forms.Label nameLabel;
+ private System.Windows.Forms.Label classNameLabel;
+ private System.Windows.Forms.CheckBox supressPrintingCheckBox;
+ private System.Windows.Forms.Label orientationLabel;
+ private System.Windows.Forms.ComboBox orientationComboBox;
+ private System.Windows.Forms.TextBox topMarginTextBox;
+ private System.Windows.Forms.Label topMarginLabel;
+ }
+}
diff --git a/TestBenchFramework/BenchControl/ResultsPrinters/Cevak/PrinterCfgCtrl.cs b/TestBenchFramework/BenchControl/ResultsPrinters/Cevak/PrinterCfgCtrl.cs
new file mode 100644
index 000000000..158a663fd
--- /dev/null
+++ b/TestBenchFramework/BenchControl/ResultsPrinters/Cevak/PrinterCfgCtrl.cs
@@ -0,0 +1,105 @@
+///
+/// Copyright (c) 2013-2015 Sensus Metering Systems
+///
+using System;
+using System.Windows.Forms;
+using log4net;
+using Config.Entities;
+using TBF.BenchControl.Generic;
+
+namespace TBF.BenchControl.ResultsPrinters.Cevak
+{
+ public partial class PrinterCfgCtrl : UserControl, IComponentCfgCtrl
+ {
+ static readonly ILog log = LogManager.GetLogger(typeof(PrinterCfgCtrl));
+
+ public bool ShowMore { get { return false; } }
+
+ PrinterCfg config;
+ public IComponentCfg Config
+ {
+ get { return config as IComponentCfg; }
+ set
+ {
+ config = value as PrinterCfg;
+ Redraw();
+ }
+ }
+
+ public PrinterCfgCtrl()
+ {
+ InitializeComponent();
+
+ orientationComboBox.Items.Add(PageOrientation.Portrait.ToString());
+ orientationComboBox.Items.Add(PageOrientation.Landscape.ToString());
+ }
+
+ private void PrinterCfgCtrl_Load(object sender, EventArgs e)
+ {
+ Redraw();
+ }
+
+ public void Closing()
+ {
+ }
+
+ PageOrientation GetOrientation(string str)
+ {
+ if (str.Equals(PageOrientation.Landscape.ToString())) return PageOrientation.Landscape;
+ if (str.Equals(PageOrientation.Portrait.ToString())) return PageOrientation.Portrait;
+ return (PageOrientation)(-1);
+ }
+
+ void Redraw()
+ {
+ if (config == null) return; /// Control was not loaded, settings were not changed
+ classNameLabel.Text = config.Factory.ClassName;
+ nameTextBox.Text = config.Name;
+ orientationComboBox.Text = config.PageOrientation.ToString();
+ topMarginTextBox.Text = config.TopMargin.ToString();
+ supressPrintingCheckBox.Checked = config.SupressPrinting;
+ }
+
+ public void Unlock()
+ {
+ nameTextBox.Enabled = true;
+ orientationComboBox.Enabled = true;
+ topMarginTextBox.Enabled = true;
+ supressPrintingCheckBox.Enabled = true;
+ }
+
+ public CfgUpdateFlags VerifyCfg(ref string message)
+ {
+ CfgUpdateFlags flags = CfgUpdateFlags.None;
+
+ if ((int)GetOrientation(orientationComboBox.Text) < 0)
+ {
+ message += Environment.NewLine + "Invalid 'Page orientation'";
+ flags |= CfgUpdateFlags.Error;
+ }
+
+ int dummy;
+ if (!int.TryParse(topMarginTextBox.Text, out dummy) || dummy < 0 || dummy > 500)
+ {
+ message += Environment.NewLine + "'Top margin' should be between 0 and 500";
+ flags |= CfgUpdateFlags.Error;
+ }
+
+ return flags;
+ }
+
+ public CfgUpdateFlags UpdateCfg()
+ {
+ CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd;
+
+ if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
+
+ config.Name = nameTextBox.Text;
+ config.PageOrientation = GetOrientation(orientationComboBox.Text);
+ config.TopMargin = int.Parse(topMarginTextBox.Text);
+ config.SupressPrinting = supressPrintingCheckBox.Checked;
+
+ return flags;
+ }
+ }
+}
diff --git a/TestBenchFramework/BenchControl/ResultsPrinters/Cevak/PrinterCfgCtrl.resx b/TestBenchFramework/BenchControl/ResultsPrinters/Cevak/PrinterCfgCtrl.resx
new file mode 100644
index 000000000..1af7de150
--- /dev/null
+++ b/TestBenchFramework/BenchControl/ResultsPrinters/Cevak/PrinterCfgCtrl.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/TestBenchFramework/BenchControl/ResultsPrinters/Cevak/PrinterFactory.cs b/TestBenchFramework/BenchControl/ResultsPrinters/Cevak/PrinterFactory.cs
new file mode 100644
index 000000000..26347cb46
--- /dev/null
+++ b/TestBenchFramework/BenchControl/ResultsPrinters/Cevak/PrinterFactory.cs
@@ -0,0 +1,23 @@
+///
+/// Copyright (c) 2013-2016 Sensus Metering Systems
+///
+using TBF.BenchControl.Generic;
+
+namespace TBF.BenchControl.ResultsPrinters.Cevak
+{
+ public class PrinterFactory : IComponentFactory
+ {
+ public string ClassName { get { return "ResultsPrinterCevak"; } }
+
+ public void ResetStaticProperties() { Printer.ResetStaticProperties(); }
+
+ public IComponent DummyComponent() { return new Printer(); }
+
+ public IComponentCfg DefaultConfig() { return new PrinterCfg(this); }
+
+ public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
+ {
+ return ComponentCfgBase.CreateFromDbEntity(typeof(PrinterCfg), component, this);
+ }
+ }
+}
diff --git a/TestBenchFramework/BenchControl/TbfComponents.cs b/TestBenchFramework/BenchControl/TbfComponents.cs
index fc23e689e..28dbfd455 100644
--- a/TestBenchFramework/BenchControl/TbfComponents.cs
+++ b/TestBenchFramework/BenchControl/TbfComponents.cs
@@ -65,6 +65,7 @@ namespace TBF.BenchControl
Factories.Add(new Elde.RegisterReader.RegisterReaderFactory());
Factories.Add(new Elde.RegulValve.RegulValveFactory());
Factories.Add(new Elde.RegulValveTandem.RegulValveTandemFactory());
+ Factories.Add(new ResultsPrinters.Cevak.PrinterFactory());
Factories.Add(new ResultsPrinters.Munich.PrinterFactory());
Factories.Add(new TestMethods.CameraRoiDetection.RoiDetectionFactory());
Factories.Add(new DB.SensusOracle.DatabaseFactory());
diff --git a/TestBenchFramework/Properties/AssemblyInfo.cs b/TestBenchFramework/Properties/AssemblyInfo.cs
index cf35ffca1..17d01727a 100644
--- a/TestBenchFramework/Properties/AssemblyInfo.cs
+++ b/TestBenchFramework/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
-[assembly: AssemblyVersion("2.2.220.1")]
-[assembly: AssemblyFileVersion("2.2.220.1")]
+[assembly: AssemblyVersion("2.2.221.1")]
+[assembly: AssemblyFileVersion("2.2.221.1")]
diff --git a/TestBenchFramework/TBF.csproj b/TestBenchFramework/TBF.csproj
index a5671cac8..61732e740 100644
--- a/TestBenchFramework/TBF.csproj
+++ b/TestBenchFramework/TBF.csproj
@@ -389,6 +389,18 @@
+
+ Component
+
+
+
+
+ UserControl
+
+
+ PrinterCfgCtrl.cs
+
+
Component
@@ -1585,6 +1597,9 @@
PrinterCfgCtrl.cs
+
+ PrinterCfgCtrl.cs
+
PrinterCfgCtrl.cs