diff --git a/Results/Output/Printers/Zapiska/ZapiskaPrintDocument.cs b/Results/Output/Printers/Zapiska/ZapiskaPrintDocument.cs
new file mode 100644
index 000000000..94dc4ea3d
--- /dev/null
+++ b/Results/Output/Printers/Zapiska/ZapiskaPrintDocument.cs
@@ -0,0 +1,380 @@
+///
+/// Copyright (c) 2017 Sensus Metering Systems
+///
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Drawing.Printing;
+using System.IO;
+using Config.Entities;
+using Results.Resources;
+
+namespace Results.Output.Printers.Zapiska
+{
+ public class ZapiskaPrintDocument : PrintDocument
+ {
+ /// Size of the printed area without margins, after taking into account 'pageOrientation'
+ readonly int printHeight;
+ readonly int printWidth;
+
+ readonly int topMargin;
+ readonly int bottomMargin;
+ readonly int leftMargin;
+ readonly int leftMargin2;
+ readonly int leftMargin3;
+ readonly int TitleX;
+ readonly int TitleY; /// Depends on the size of the header
+
+ readonly int SpacingOne;
+ readonly int SpacingOneAndHalf;
+ readonly int SpacingOne4Header;
+ readonly int SpacingOneAndHalf4Header;
+
+ int CommonTop; /// = TitleY + 60
+ int BodyTop; /// = HdrTop + 160
+ ///
+ int titleHeight;
+ int commonHeight;
+
+ ///
+ /// Property variable for the Font the user wishes to use
+ ///
+ Font font;
+ Font headerFont;
+ Font titleFont;
+
+ ///
+ /// Data to print
+ ///
+ Results.Entities.Batch batch;
+
+ ZapiskaPrinterCfg cfg;
+
+ ///
+ /// Items to print
+ ///
+ string header;
+ IList commonItems1;
+ IList commonItems2;
+ IList commonItems3;
+ IList testItems;
+ string footer;
+
+ ///
+ /// 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 ZapiskaPrintDocument(Results.Entities.Batch batch, ZapiskaPrinterCfg cfg)
+ {
+ this.batch = batch;
+
+ this.cfg = cfg;
+ topMargin = cfg.TopMargin;
+ bottomMargin = cfg.BottomMargin;
+ leftMargin = cfg.LeftMargin;
+
+ header = string.IsNullOrEmpty(cfg.Header) ? string.Empty : cfg.Header.Replace("~", Environment.NewLine);
+ commonItems1 = Results.WMeterRsltItemSpec.FromStrArray(cfg.CommonItems1);
+ commonItems2 = Results.WMeterRsltItemSpec.FromStrArray(cfg.CommonItems2);
+ commonItems3 = Results.WMeterRsltItemSpec.FromStrArray(cfg.CommonItems3);
+ testItems = Results.WMeterRsltItemSpec.FromStrArray(cfg.TestItems); /// TestID info will be overwritten later on
+ footer = string.IsNullOrEmpty(cfg.Footer) ? string.Empty : cfg.Footer.Replace("~", Environment.NewLine);
+
+ /// Initialize fonts
+ titleFont = new Font((cfg.TitFntFml != null ? cfg.TitFntFml : "Arial"), (cfg.TitFntSz > 0 ? cfg.TitFntSz : 10), (FontStyle)cfg.TitFntSty);
+ headerFont = new Font((cfg.HdrFntFml != null ? cfg.HdrFntFml : "Arial"), (cfg.HdrFntSz > 0 ? cfg.HdrFntSz : 10), (FontStyle)cfg.HdrFntSty);
+ font = new Font((cfg.BodyFntFml != null ? cfg.BodyFntFml : "Arial"), (cfg.BodyFntSz > 0 ? cfg.BodyFntSz : 10), (FontStyle)cfg.BodyFntSty);
+
+ /// Set print area size and margins (in dots using 100 dpi)
+ DefaultPageSettings.Landscape = (cfg.PageOrientation == PageOrientation.Landscape);
+ ///
+ if (DefaultPageSettings.Landscape)
+ {
+ printHeight = base.DefaultPageSettings.PaperSize.Width - topMargin - bottomMargin;
+ printWidth = base.DefaultPageSettings.PaperSize.Height - leftMargin - leftMargin;
+ }
+ else
+ {
+ printHeight = base.DefaultPageSettings.PaperSize.Height - topMargin - bottomMargin;
+ printWidth = base.DefaultPageSettings.PaperSize.Width - leftMargin - leftMargin;
+ }
+
+ leftMargin2 = leftMargin + (int)(printWidth * cfg.ColW1Pct / 100.0f);
+ leftMargin3 = leftMargin + (int)(printWidth * (cfg.ColW1Pct + cfg.ColW2Pct) / 100.0f);
+
+ SpacingOne = System.Windows.Forms.TextRenderer.MeasureText("Abcgq", font).Height;
+ SpacingOneAndHalf = (3 * SpacingOne) / 2;
+ SpacingOne4Header = System.Windows.Forms.TextRenderer.MeasureText("Abcgq", headerFont).Height;
+ SpacingOneAndHalf4Header = (3 * SpacingOne4Header) / 2;
+
+ /// Calculate the tests count
+ int testsCount = 0;
+ if (batch.WaterMeters.Count > 0)
+ {
+ foreach (var mtr in batch.WaterMeters[0].MeterTestRslts)
+ {
+ if (mtr.Publish() == Config.Entities.Publish.Always && mtr.IsPilotRslt()) testsCount++;
+ }
+ }
+
+ /// Prepare document outline
+ TitleX = cfg.LeftMargin;
+ TitleY = cfg.TopMargin;
+
+ titleHeight = System.Windows.Forms.TextRenderer.MeasureText(header, titleFont).Height;
+ CommonTop = TitleY + titleHeight + SpacingOne4Header;
+
+ int commonCount = Math.Max(commonItems1.Count, Math.Max(commonItems2.Count, commonItems3.Count));
+ commonHeight = commonCount * SpacingOne;
+ BodyTop = CommonTop + commonHeight + SpacingOne4Header;
+
+ int wmSectionHeight = (testsCount + 1) * SpacingOne + 3 * SpacingOne4Header;
+
+ nrWMsOnFirstPage = (printHeight - BodyTop + TitleY - 2 * SpacingOne) / wmSectionHeight;
+ nrWMsOnNextPage = (printHeight - 2 * SpacingOne) / wmSectionHeight;
+ nrWMsOnNextPage = Math.Max(nrWMsOnNextPage, 1); /// Prevent division by zero if there are too many WM tests
+
+ nrPages = 1 + (batch.WaterMeters.Count - nrWMsOnFirstPage + nrWMsOnNextPage - 1) / 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);
+ }
+
+ ///
+ /// 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));
+ }
+
+ /// Use the StringFormat class for the text layout of our document
+ StringFormat format = new StringFormat(StringFormatFlags.LineLimit);
+
+ if (pageNr == 1)
+ {
+ ///----------
+ /// Title
+ ///----------
+ RectangleF printArea = new RectangleF(TitleX, TitleY, printWidth, titleHeight);
+ e.Graphics.DrawString(header, titleFont, Brushes.Black, printArea);
+
+ ///----------------
+ /// Common items
+ ///----------------
+ for (int n = 1; n <= 3; n++)
+ {
+ IList commonItems;
+ int lMargin;
+ switch (n)
+ {
+ default:
+ case 1: commonItems = commonItems1; lMargin = leftMargin; break;
+ case 2: commonItems = commonItems2; lMargin = leftMargin2; break;
+ case 3: commonItems = commonItems3; lMargin = leftMargin3; break;
+ }
+
+ if (commonItems.Count == 0) continue; /// Common part is empty
+
+ string[] leftColumn = new string[commonItems.Count];
+ string[] rightColumn = new string[commonItems.Count];
+
+ int cnt = 0;
+ foreach (var v in commonItems)
+ {
+ leftColumn[cnt] = v.Caption;
+ rightColumn[cnt] = (batch.WaterMeters.Count > 0) ? v.Print(batch.WaterMeters[0]) : string.Empty;
+ cnt++;
+ }
+
+ /// Determine left column width
+ int leftColWidth = 0;
+ foreach (var s in leftColumn)
+ {
+ int itemWidth = (int)e.Graphics.MeasureString(s, font).Width;
+ if (itemWidth > leftColWidth) leftColWidth = itemWidth;
+ }
+
+ /// Write aligned columns
+ for (int i = 0; i < Math.Min(leftColumn.Length, rightColumn.Length); i++)
+ {
+ PrintAt(e, lMargin, CommonTop + SpacingOne * i, leftColumn[i]);
+ PrintAt(e, lMargin + leftColWidth + 30, CommonTop + 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
+ {
+ int wmPosition = true ? batch.WaterMeters[wmNr].WMPosition : (wmNr + 1);
+ nextWmTop += PrintWM(e, batch.WaterMeters[wmNr], wmPosition, nextWmTop);
+ }
+
+ nextWMNr += nrWMsOnPage;
+ e.HasMorePages = (nextWMNr < batch.WaterMeters.Count);
+
+ ///----------
+ /// Footer
+ ///----------
+ int footerWidth = (int)e.Graphics.MeasureString(footer, font).Width;
+ PrintAt(e, leftMargin + (printWidth - footerWidth) / 2, topMargin + printHeight - 2 * SpacingOne, footer);
+
+ string pageNrText = string.Format("{0} {1}/{2}", Strings.Page, pageNr++, nrPages);
+ int pageNrWidth = (int)e.Graphics.MeasureString(pageNrText, font).Width;
+ PrintAt(e, leftMargin + (printWidth - pageNrWidth) / 2, topMargin + printHeight - SpacingOne, pageNrText);
+ }
+
+
+ ///
+ /// 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[testItems.Count + 1];
+ columnPos[0] = (float)leftMargin;
+
+ for (int i = 0; i < testItems.Count; i++)
+ {
+ float columnWidth = e.Graphics.MeasureString(testItems[i].Caption, headerFont).Width;
+ foreach (var mtr in wm.MeterTestRslts)
+ {
+ if (mtr != null && mtr.IsPilotRslt() && mtr.Publish() == Config.Entities.Publish.Always)
+ {
+ string itemText = testItems[i].Print(wm, mtr.Name());
+
+ /// 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[testItems.Count] - 20;
+
+ string wmText = string.Format("{0} {1}", Strings.Water_Meter, printedWMNr);
+ PrintHeaderAt(e, leftMargin, top, wmText);
+ if (!string.IsNullOrEmpty(wm.SerialNr))
+ {
+ PrintHeaderAt(e, leftMargin + (int)e.Graphics.MeasureString(wmText, headerFont).Width, top,
+ string.Format(" {0} = {1}", Strings.sn, wm.SerialNr));
+ }
+
+ /// Horizontal line
+ int horY = top + SpacingOneAndHalf4Header;
+ e.Graphics.DrawLine(new Pen(Color.Black, 2), new Point(tableLeftX, horY), new Point(tableRightX, horY));
+
+ for (int i = 0; i < testItems.Count; i++)
+ {
+ PrintHeaderAt(e, (int)columnPos[i], top + (int)(1.6 * SpacingOne4Header), testItems[i].Caption);
+ }
+
+ /// Horizontal line
+ horY = top + (int)(2.8 * SpacingOne4Header);
+ 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)
+ {
+ if ((mtr != null) && (mtr.Publish() == Config.Entities.Publish.Always))
+ {
+ testsCount++;
+ for (int i = 0; i < testItems.Count; i++)
+ {
+ string itemText = testItems[i].Print(wm, mtr.Name());
+
+ /// 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?
+ }
+
+ PrintAt(e, (int)columnPos[i], top + 2 * SpacingOne4Header + SpacingOne * testsCount, itemText);
+ }
+ }
+ }
+
+ /// Horizontal line
+ horY = top + 2 * SpacingOneAndHalf4Header + SpacingOne * testsCount;
+ e.Graphics.DrawLine(new Pen(Color.Black, 2), new Point(tableLeftX, horY), new Point(tableRightX, horY));
+
+ return (testsCount + 1) * SpacingOne + 3 * SpacingOne4Header;
+ }
+
+
+ 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, 2000, SpacingOne);
+ e.Graphics.DrawString(text, this.font, Brushes.Black, printArea);
+ }
+
+
+ void PrintHeaderAt(System.Drawing.Printing.PrintPageEventArgs e, Point p, string text)
+ {
+ PrintHeaderAt(e, p.X, p.Y, text);
+ }
+
+
+ void PrintHeaderAt(System.Drawing.Printing.PrintPageEventArgs e, int x, int y, string text)
+ {
+ RectangleF printArea = new RectangleF(x, y, 2000, SpacingOne4Header);
+ e.Graphics.DrawString(text, this.headerFont, Brushes.Black, printArea);
+ }
+ }
+}
diff --git a/Results/Output/Printers/Zapiska/ZapiskaPrinterCfg.cs b/Results/Output/Printers/Zapiska/ZapiskaPrinterCfg.cs
new file mode 100644
index 000000000..edd5f5646
--- /dev/null
+++ b/Results/Output/Printers/Zapiska/ZapiskaPrinterCfg.cs
@@ -0,0 +1,37 @@
+///
+/// Copyright (c) 2017 Sensus Metering Systems
+///
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Results.Output.Printers.Zapiska
+{
+ public class ZapiskaPrinterCfg
+ {
+ public Config.Entities.PageOrientation PageOrientation;
+ public int TopMargin;
+ public int BottomMargin;
+ public int LeftMargin;
+ public string TitFntFml;
+ public int TitFntSz;
+ public int TitFntSty;
+ public string HdrFntFml;
+ public int HdrFntSz;
+ public int HdrFntSty;
+ public string BodyFntFml;
+ public int BodyFntSz;
+ public int BodyFntSty;
+ public bool SupressPrinting; /// Bypass printing when true
+ public System.Globalization.CultureInfo CultureInfo;
+ public int ColW1Pct;
+ public int ColW2Pct;
+ public string[] CommonItems1;
+ public string[] CommonItems2;
+ public string[] CommonItems3;
+ public string[] TestItems;
+ public string Header; /// =Title
+ public string Footer;
+ }
+}
diff --git a/Results/Results.csproj b/Results/Results.csproj
index 9cabccef7..061082460 100644
--- a/Results/Results.csproj
+++ b/Results/Results.csproj
@@ -111,6 +111,10 @@
Component
+
+ Component
+
+
diff --git a/TestBenchFramework/BenchControl/Output/Printers/Zapiska/FactoryCompound.cs b/TestBenchFramework/BenchControl/Output/Printers/Zapiska/FactoryCompound.cs
new file mode 100644
index 000000000..a5439d061
--- /dev/null
+++ b/TestBenchFramework/BenchControl/Output/Printers/Zapiska/FactoryCompound.cs
@@ -0,0 +1,26 @@
+///
+/// Copyright (c) 2017 Sensus Metering Systems
+///
+using System.Collections.Generic;
+using TBF.BenchControl.Generic;
+
+namespace TBF.BenchControl.Output.Printers.Zapiska
+{
+ public class FactoryCompound : IComponentFactory
+ {
+ public string ClassName { get { return this.GetType().Namespace.Substring(17) + ".Compound"; } }
+
+ public void ResetStaticProperties() { Printer.ResetStaticProperties(); }
+
+ public IComponent DummyComponent() { return new Printer(); }
+
+ public IComponent GetComponent(IComponentCfg cfg, IList components) { return new Printer(cfg); }
+
+ public IComponentCfg DefaultConfig() { return new PrinterCfg("Printer.Zapiska.Compound", this, Config.Entities.MetersKind.Combined); }
+
+ public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
+ {
+ return ComponentCfgBase.CreateFromDbEntity(PrinterCfg.Serializer, component, this);
+ }
+ }
+}
diff --git a/TestBenchFramework/BenchControl/Output/Printers/Zapiska/FactoryHeatMeters.cs b/TestBenchFramework/BenchControl/Output/Printers/Zapiska/FactoryHeatMeters.cs
new file mode 100644
index 000000000..d58d02228
--- /dev/null
+++ b/TestBenchFramework/BenchControl/Output/Printers/Zapiska/FactoryHeatMeters.cs
@@ -0,0 +1,26 @@
+///
+/// Copyright (c) 2017 Sensus Metering Systems
+///
+using System.Collections.Generic;
+using TBF.BenchControl.Generic;
+
+namespace TBF.BenchControl.Output.Printers.Zapiska
+{
+ public class FactoryHeatMeters : IComponentFactory
+ {
+ public string ClassName { get { return this.GetType().Namespace.Substring(17) + ".HeatMeters"; } }
+
+ public void ResetStaticProperties() { Printer.ResetStaticProperties(); }
+
+ public IComponent DummyComponent() { return new Printer(); }
+
+ public IComponent GetComponent(IComponentCfg cfg, IList components) { return new Printer(cfg); }
+
+ public IComponentCfg DefaultConfig() { return new PrinterCfg("Printer.Zapiska.HeatMeters", this, Config.Entities.MetersKind.HeatMeter); }
+
+ public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
+ {
+ return ComponentCfgBase.CreateFromDbEntity(PrinterCfg.Serializer, component, this);
+ }
+ }
+}
diff --git a/TestBenchFramework/BenchControl/Output/Printers/Zapiska/FactorySingle.cs b/TestBenchFramework/BenchControl/Output/Printers/Zapiska/FactorySingle.cs
new file mode 100644
index 000000000..ac07ae640
--- /dev/null
+++ b/TestBenchFramework/BenchControl/Output/Printers/Zapiska/FactorySingle.cs
@@ -0,0 +1,26 @@
+///
+/// Copyright (c) 2017 Sensus Metering Systems
+///
+using System.Collections.Generic;
+using TBF.BenchControl.Generic;
+
+namespace TBF.BenchControl.Output.Printers.Zapiska
+{
+ public class FactorySingle : IComponentFactory
+ {
+ public string ClassName { get { return this.GetType().Namespace.Substring(17) + ".Single"; } }
+
+ public void ResetStaticProperties() { Printer.ResetStaticProperties(); }
+
+ public IComponent DummyComponent() { return new Printer(); }
+
+ public IComponent GetComponent(IComponentCfg cfg, IList components) { return new Printer(cfg); }
+
+ public IComponentCfg DefaultConfig() { return new PrinterCfg("Printer.Zapiska.Single", this, Config.Entities.MetersKind.Single); }
+
+ public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
+ {
+ return ComponentCfgBase.CreateFromDbEntity(PrinterCfg.Serializer, component, this);
+ }
+ }
+}
diff --git a/TestBenchFramework/BenchControl/Output/Printers/Zapiska/Printer.cs b/TestBenchFramework/BenchControl/Output/Printers/Zapiska/Printer.cs
new file mode 100644
index 000000000..41a9c580e
--- /dev/null
+++ b/TestBenchFramework/BenchControl/Output/Printers/Zapiska/Printer.cs
@@ -0,0 +1,199 @@
+///
+/// Copyright (c) 2017 Sensus Metering Systems
+///
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Threading;
+using Results.Output.Printers.Zapiska;
+using log4net;
+
+namespace TBF.BenchControl.Output.Printers.Zapiska
+{
+ 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;
+
+ public bool SupressPrinting { get { return printerCfg.SupressPrinting; } }
+
+ ///
+ /// Items to print
+ ///
+ string header;
+ IList commonItems;
+ IList testItems;
+ string footer;
+
+
+ Thread thread; /// Thread where results are printed
+ bool completed; /// Set to 'true' by the thread when printing results is completed
+ bool abort; /// Set to 'true' by Stop() operation to abort printing results
+
+
+ public Printer() { }
+
+
+ public Printer(Generic.IComponentCfg cfg)
+ : base(cfg)
+ {
+ printerCfg = cfg as PrinterCfg;
+ ApplyConfig();
+ log.Debug(this.ToString());
+ }
+
+
+ void ApplyConfig()
+ {
+ header = string.IsNullOrEmpty(printerCfg.Header) ? string.Empty : printerCfg.Header.Replace("~", Environment.NewLine);
+ commonItems = Results.WMeterRsltItemSpec.FromStrArray(printerCfg.CommonItems1);
+ testItems = Results.WMeterRsltItemSpec.FromStrArray(printerCfg.SelectedItems); /// TestID info will be overwritten later on
+ footer = string.IsNullOrEmpty(printerCfg.Footer) ? string.Empty : printerCfg.Footer.Replace("~", Environment.NewLine);
+ }
+
+
+ #region Configuration Change Handling
+
+ public static void OnCfgChange(object sender, CfgChangeArgs args)
+ {
+ if (CfgChangeHandler == null) return;
+ try { CfgChangeHandler(sender, args); }
+ catch (Exception e) { log.Error("CfgChangeHandler(...) failed", e); }
+ }
+
+ public static event EventHandler CfgChangeHandler;
+
+ public override void StartChangeHandler()
+ {
+ CfgChangeHandler += delegate(object sender, CfgChangeArgs args)
+ {
+ PrinterCfg newCfg = args.Cfg as PrinterCfg;
+ if (newCfg != null && newCfg.Name.Equals(Name))
+ {
+ if (args.Command == CfgChangeCmd.CfgChange)
+ {
+ printerCfg.PageOrientation = newCfg.PageOrientation;
+ printerCfg.TopMargin = newCfg.TopMargin;
+ printerCfg.BottomMargin = newCfg.BottomMargin;
+ printerCfg.LeftMargin = newCfg.LeftMargin;
+
+ printerCfg.TitFntFml = newCfg.TitFntFml;
+ printerCfg.TitFntSz = newCfg.TitFntSz;
+ printerCfg.TitFntSty = newCfg.TitFntSty;
+ printerCfg.HdrFntFml = newCfg.HdrFntFml;
+ printerCfg.HdrFntSz = newCfg.HdrFntSz;
+ printerCfg.HdrFntSty = newCfg.HdrFntSty;
+ printerCfg.BodyFntFml = newCfg.BodyFntFml;
+ printerCfg.BodyFntSz = newCfg.BodyFntSz;
+ printerCfg.BodyFntSty = newCfg.BodyFntSty;
+
+ printerCfg.SupressPrinting = newCfg.SupressPrinting;
+ printerCfg.Culture = newCfg.Culture;
+ printerCfg.Header = newCfg.Header;
+ printerCfg.ColW1Pct = newCfg.ColW1Pct;
+ printerCfg.ColW2Pct = newCfg.ColW2Pct;
+ printerCfg.CommonItems1 = newCfg.CommonItems1;
+ printerCfg.CommonItems2 = newCfg.CommonItems2;
+ printerCfg.CommonItems3 = newCfg.CommonItems3;
+ printerCfg.SelectedItems = newCfg.SelectedItems;
+ printerCfg.Footer = newCfg.Footer;
+
+ ApplyConfig();
+ }
+ }
+ };
+ }
+
+ #endregion Configuration Change Handling
+
+
+ ///
+ /// Prints the test cycle results, Events: Event.ResultsPrinted
+ ///
+ /// Batch results to print
+ /// Reference to the operation
+ public IOperation PrintResultsOp(Results.Entities.Batch batch)
+ {
+ thread = new Thread(() =>
+ {
+ PrintResults(batch);
+ completed = true;
+ });
+
+ thread.CurrentCulture = Thread.CurrentThread.CurrentCulture;
+ thread.CurrentUICulture = Thread.CurrentThread.CurrentUICulture;
+
+ if (printerCfg.Culture > Culture.system && printerCfg.Culture < Culture.Count)
+ {
+ thread.CurrentCulture = new CultureInfo(printerCfg.Culture.ToString());
+ }
+
+ return this;
+ }
+
+ /// Start this operation
+ public void Start()
+ {
+ completed = false;
+ abort = false;
+ thread.Start();
+ }
+
+ /// Run this operation
+ /// Event.ResultsPrinted
+ public Event Run()
+ {
+ if (completed)
+ return Event.ResultsPrinted;
+ else
+ return Event.Busy;
+ }
+
+ /// Stop this operation
+ public void Stop()
+ {
+ if (!completed) abort = true;
+ }
+
+
+ void PrintResults(Results.Entities.Batch batch)
+ {
+ CultureInfo culture = Thread.CurrentThread.CurrentCulture;
+ try { culture = new System.Globalization.CultureInfo(printerCfg.Culture.ToString()); }
+ catch { }
+
+ if (batch.WaterMeters.Count > 0)
+ {
+ ZapiskaPrinterCfg cfg = new ZapiskaPrinterCfg {
+ PageOrientation = printerCfg.PageOrientation,
+ TopMargin = printerCfg.TopMargin,
+ BottomMargin = printerCfg.BottomMargin,
+ LeftMargin = printerCfg.LeftMargin,
+ TitFntFml = printerCfg.TitFntFml,
+ HdrFntFml = printerCfg.HdrFntFml,
+ BodyFntFml = printerCfg.BodyFntFml,
+ TitFntSz = printerCfg.TitFntSz,
+ HdrFntSz = printerCfg.HdrFntSz,
+ BodyFntSz = printerCfg.BodyFntSz,
+ TitFntSty = printerCfg.TitFntSty,
+ HdrFntSty = printerCfg.HdrFntSty,
+ BodyFntSty = printerCfg.BodyFntSty,
+ SupressPrinting = printerCfg.SupressPrinting,
+ CultureInfo = culture,
+ Header = printerCfg.Header,
+ ColW1Pct = printerCfg.ColW1Pct,
+ ColW2Pct = printerCfg.ColW2Pct,
+ CommonItems1 = printerCfg.CommonItems1,
+ CommonItems2 = printerCfg.CommonItems2,
+ CommonItems3 = printerCfg.CommonItems3,
+ TestItems = printerCfg.SelectedItems,
+ Footer = printerCfg.Footer,
+ };
+
+ new Results.Output.Printers.Zapiska.ZapiskaPrintDocument(batch, cfg).Print();
+ }
+ }
+ }
+}
diff --git a/TestBenchFramework/BenchControl/Output/Printers/Zapiska/PrinterCfg.cs b/TestBenchFramework/BenchControl/Output/Printers/Zapiska/PrinterCfg.cs
new file mode 100644
index 000000000..922293b9d
--- /dev/null
+++ b/TestBenchFramework/BenchControl/Output/Printers/Zapiska/PrinterCfg.cs
@@ -0,0 +1,90 @@
+///
+/// Copyright (c) 2017 Sensus Metering Systems
+///
+using System.Xml.Serialization;
+using Config.Entities;
+using TBF.BenchControl.Generic;
+
+namespace TBF.BenchControl.Output.Printers.Zapiska
+{
+ public class PrinterCfg : ComponentCfgBase, Generic.IComponentCfg
+ {
+ public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(PrinterCfg) })[0];
+ protected override XmlSerializer GetSerializer() { return Serializer; }
+
+ public IComponentCfgCtrl GetControl() { return new PrinterCfgCtrl(); }
+
+ ///
+ /// Serialized parameters
+ ///
+ public PageOrientation PageOrientation;
+ public int TopMargin;
+ public int BottomMargin;
+ public int LeftMargin;
+ public string TitFntFml;
+ public string HdrFntFml;
+ public string BodyFntFml;
+ public int TitFntSz;
+ public int HdrFntSz;
+ public int BodyFntSz;
+ public int TitFntSty;
+ public int HdrFntSty;
+ public int BodyFntSty;
+ public bool SupressPrinting; /// Bypass printing when true
+ public Culture Culture;
+ public int ColW1Pct;
+ public int ColW2Pct;
+ public string[] CommonItems1;
+ public string[] CommonItems2;
+ public string[] CommonItems3;
+ public string[] SelectedItems;
+ public string Header; /// =Title
+ public string Footer;
+
+ [XmlIgnore]
+ public Config.Entities.MetersKind MetersKind;
+
+ /// Private parameterless constructor invoked by all other (public) constructors
+ PrinterCfg()
+ {
+ }
+
+ public PrinterCfg(string name, IComponentFactory factory, Config.Entities.MetersKind metersKind)
+ : this()
+ {
+ Name = name;
+ Factory = factory;
+ MetersKind = metersKind;
+
+ ParentName = string.Empty;
+ PageOrientation = PageOrientation.Portrait;
+ TopMargin = 100;
+ BottomMargin = 100;
+ LeftMargin = 100;
+ TitFntFml = "Arial";
+ TitFntSz = 18;
+ TitFntSty = 1;
+ TitFntFml = "Arial";
+ TitFntSz = 10;
+ TitFntSty = 0;
+ TitFntFml = "Arial";
+ TitFntSz = 10;
+ TitFntSty = 0;
+ SupressPrinting = false;
+ Header = string.Empty;
+ Footer = string.Empty;
+ }
+
+ public string ToString(int i)
+ {
+ return string.Format("Name={0}, Orientation={1}, Margins T={2} B={3} L={4}, SupressPrinting={5}",
+ Name,
+ PageOrientation,
+ TopMargin,
+ BottomMargin,
+ LeftMargin,
+ SupressPrinting ? "yes" : "no"
+ );
+ }
+ }
+}
diff --git a/TestBenchFramework/BenchControl/Output/Printers/Zapiska/PrinterCfgCtrl.Designer.cs b/TestBenchFramework/BenchControl/Output/Printers/Zapiska/PrinterCfgCtrl.Designer.cs
new file mode 100644
index 000000000..cd94e07cd
--- /dev/null
+++ b/TestBenchFramework/BenchControl/Output/Printers/Zapiska/PrinterCfgCtrl.Designer.cs
@@ -0,0 +1,544 @@
+///
+/// Copyright (c) 2017 Sensus Metering Systems
+///
+namespace TBF.BenchControl.Output.Printers.Zapiska
+{
+ 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.leftMarginTextBox = new System.Windows.Forms.TextBox();
+ this.bottomMarginTextBox = new System.Windows.Forms.TextBox();
+ this.cultureComboBox = new System.Windows.Forms.ComboBox();
+ this.cultureLabel = new System.Windows.Forms.Label();
+ this.commonItems1Button = new System.Windows.Forms.Button();
+ this.footerButton = new System.Windows.Forms.Button();
+ this.headerButton = new System.Windows.Forms.Button();
+ this.testItemsButton = new System.Windows.Forms.Button();
+ this.headerFontLabel = new System.Windows.Forms.Label();
+ this.titleFontLabel = new System.Windows.Forms.Label();
+ this.titleFontFamilyComboBox = new System.Windows.Forms.ComboBox();
+ this.headerFontFamilyComboBox = new System.Windows.Forms.ComboBox();
+ this.bodyFontFamilyComboBox = new System.Windows.Forms.ComboBox();
+ this.bodyFontLabel = new System.Windows.Forms.Label();
+ this.titleFontSizeTextBox = new System.Windows.Forms.TextBox();
+ this.headerFontSizeTextBox = new System.Windows.Forms.TextBox();
+ this.bodyFontSizeTextBox = new System.Windows.Forms.TextBox();
+ this.titleBoldCheckBox = new System.Windows.Forms.CheckBox();
+ this.titleItalicCheckBox = new System.Windows.Forms.CheckBox();
+ this.headerItalicCheckBox = new System.Windows.Forms.CheckBox();
+ this.headerBoldCheckBox = new System.Windows.Forms.CheckBox();
+ this.bodyItalicCheckBox = new System.Windows.Forms.CheckBox();
+ this.bodyBoldCheckBox = new System.Windows.Forms.CheckBox();
+ this.label1 = new System.Windows.Forms.Label();
+ this.label2 = new System.Windows.Forms.Label();
+ this.commonItems2Button = new System.Windows.Forms.Button();
+ this.commonItems3Button = new System.Windows.Forms.Button();
+ this.colW2TextBox = new System.Windows.Forms.TextBox();
+ this.colW1TextBox = new System.Windows.Forms.TextBox();
+ this.label3 = new System.Windows.Forms.Label();
+ this.label4 = new System.Windows.Forms.Label();
+ this.label5 = new System.Windows.Forms.Label();
+ this.SuspendLayout();
+ //
+ // nameTextBox
+ //
+ this.nameTextBox.Enabled = false;
+ this.nameTextBox.Location = new System.Drawing.Point(142, 40);
+ this.nameTextBox.Name = "nameTextBox";
+ this.nameTextBox.Size = new System.Drawing.Size(218, 20);
+ this.nameTextBox.TabIndex = 2;
+ //
+ // nameLabel
+ //
+ this.nameLabel.AutoSize = true;
+ this.nameLabel.Location = new System.Drawing.Point(16, 43);
+ 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, 16);
+ 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(19, 313);
+ this.supressPrintingCheckBox.Name = "supressPrintingCheckBox";
+ this.supressPrintingCheckBox.Size = new System.Drawing.Size(101, 17);
+ this.supressPrintingCheckBox.TabIndex = 38;
+ this.supressPrintingCheckBox.Text = "Supress printing";
+ this.supressPrintingCheckBox.UseVisualStyleBackColor = true;
+ //
+ // orientationLabel
+ //
+ this.orientationLabel.AutoSize = true;
+ this.orientationLabel.Location = new System.Drawing.Point(16, 67);
+ 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, 64);
+ this.orientationComboBox.Name = "orientationComboBox";
+ this.orientationComboBox.Size = new System.Drawing.Size(218, 21);
+ this.orientationComboBox.TabIndex = 4;
+ //
+ // topMarginTextBox
+ //
+ this.topMarginTextBox.Enabled = false;
+ this.topMarginTextBox.Location = new System.Drawing.Point(142, 89);
+ this.topMarginTextBox.Name = "topMarginTextBox";
+ this.topMarginTextBox.Size = new System.Drawing.Size(44, 20);
+ this.topMarginTextBox.TabIndex = 6;
+ //
+ // topMarginLabel
+ //
+ this.topMarginLabel.AutoSize = true;
+ this.topMarginLabel.Location = new System.Drawing.Point(16, 92);
+ this.topMarginLabel.Name = "topMarginLabel";
+ this.topMarginLabel.Size = new System.Drawing.Size(116, 13);
+ this.topMarginLabel.TabIndex = 5;
+ this.topMarginLabel.Text = "Top/bottom/left margin";
+ //
+ // leftMarginTextBox
+ //
+ this.leftMarginTextBox.Enabled = false;
+ this.leftMarginTextBox.Location = new System.Drawing.Point(244, 89);
+ this.leftMarginTextBox.Name = "leftMarginTextBox";
+ this.leftMarginTextBox.Size = new System.Drawing.Size(44, 20);
+ this.leftMarginTextBox.TabIndex = 8;
+ //
+ // bottomMarginTextBox
+ //
+ this.bottomMarginTextBox.Enabled = false;
+ this.bottomMarginTextBox.Location = new System.Drawing.Point(193, 89);
+ this.bottomMarginTextBox.Name = "bottomMarginTextBox";
+ this.bottomMarginTextBox.Size = new System.Drawing.Size(44, 20);
+ this.bottomMarginTextBox.TabIndex = 7;
+ //
+ // cultureComboBox
+ //
+ this.cultureComboBox.Enabled = false;
+ this.cultureComboBox.FormattingEnabled = true;
+ this.cultureComboBox.Location = new System.Drawing.Point(142, 185);
+ this.cultureComboBox.Name = "cultureComboBox";
+ this.cultureComboBox.Size = new System.Drawing.Size(218, 21);
+ this.cultureComboBox.TabIndex = 26;
+ //
+ // cultureLabel
+ //
+ this.cultureLabel.AutoSize = true;
+ this.cultureLabel.Location = new System.Drawing.Point(16, 188);
+ this.cultureLabel.Name = "cultureLabel";
+ this.cultureLabel.Size = new System.Drawing.Size(42, 13);
+ this.cultureLabel.TabIndex = 25;
+ this.cultureLabel.Text = "Cullture";
+ //
+ // commonItems1Button
+ //
+ this.commonItems1Button.Enabled = false;
+ this.commonItems1Button.Location = new System.Drawing.Point(142, 259);
+ this.commonItems1Button.Name = "commonItems1Button";
+ this.commonItems1Button.Size = new System.Drawing.Size(70, 23);
+ this.commonItems1Button.TabIndex = 33;
+ this.commonItems1Button.Text = "Common 1";
+ this.commonItems1Button.UseVisualStyleBackColor = true;
+ this.commonItems1Button.Click += new System.EventHandler(this.commonItems1Button_Click);
+ //
+ // footerButton
+ //
+ this.footerButton.Enabled = false;
+ this.footerButton.Location = new System.Drawing.Point(142, 309);
+ this.footerButton.Name = "footerButton";
+ this.footerButton.Size = new System.Drawing.Size(218, 23);
+ this.footerButton.TabIndex = 37;
+ this.footerButton.Text = "Footer";
+ this.footerButton.UseVisualStyleBackColor = true;
+ this.footerButton.Click += new System.EventHandler(this.footerButton_Click);
+ //
+ // headerButton
+ //
+ this.headerButton.Enabled = false;
+ this.headerButton.Location = new System.Drawing.Point(142, 209);
+ this.headerButton.Name = "headerButton";
+ this.headerButton.Size = new System.Drawing.Size(218, 23);
+ this.headerButton.TabIndex = 27;
+ this.headerButton.Text = "Title";
+ this.headerButton.UseVisualStyleBackColor = true;
+ this.headerButton.Click += new System.EventHandler(this.headerButton_Click);
+ //
+ // testItemsButton
+ //
+ this.testItemsButton.Enabled = false;
+ this.testItemsButton.Location = new System.Drawing.Point(142, 284);
+ this.testItemsButton.Name = "testItemsButton";
+ this.testItemsButton.Size = new System.Drawing.Size(218, 23);
+ this.testItemsButton.TabIndex = 36;
+ this.testItemsButton.Text = "Test items";
+ this.testItemsButton.UseVisualStyleBackColor = true;
+ this.testItemsButton.Click += new System.EventHandler(this.testItemsButton_Click);
+ //
+ // headerFontLabel
+ //
+ this.headerFontLabel.AutoSize = true;
+ this.headerFontLabel.Location = new System.Drawing.Point(16, 140);
+ this.headerFontLabel.Name = "headerFontLabel";
+ this.headerFontLabel.Size = new System.Drawing.Size(112, 13);
+ this.headerFontLabel.TabIndex = 14;
+ this.headerFontLabel.Text = "Header font/size/style";
+ //
+ // titleFontLabel
+ //
+ this.titleFontLabel.AutoSize = true;
+ this.titleFontLabel.Location = new System.Drawing.Point(16, 116);
+ this.titleFontLabel.Name = "titleFontLabel";
+ this.titleFontLabel.Size = new System.Drawing.Size(97, 13);
+ this.titleFontLabel.TabIndex = 9;
+ this.titleFontLabel.Text = "Title font/size/style";
+ //
+ // titleFontFamilyComboBox
+ //
+ this.titleFontFamilyComboBox.Enabled = false;
+ this.titleFontFamilyComboBox.FormattingEnabled = true;
+ this.titleFontFamilyComboBox.Location = new System.Drawing.Point(142, 113);
+ this.titleFontFamilyComboBox.Name = "titleFontFamilyComboBox";
+ this.titleFontFamilyComboBox.Size = new System.Drawing.Size(110, 21);
+ this.titleFontFamilyComboBox.TabIndex = 10;
+ //
+ // headerFontFamilyComboBox
+ //
+ this.headerFontFamilyComboBox.Enabled = false;
+ this.headerFontFamilyComboBox.FormattingEnabled = true;
+ this.headerFontFamilyComboBox.Location = new System.Drawing.Point(142, 137);
+ this.headerFontFamilyComboBox.Name = "headerFontFamilyComboBox";
+ this.headerFontFamilyComboBox.Size = new System.Drawing.Size(110, 21);
+ this.headerFontFamilyComboBox.TabIndex = 15;
+ //
+ // bodyFontFamilyComboBox
+ //
+ this.bodyFontFamilyComboBox.Enabled = false;
+ this.bodyFontFamilyComboBox.FormattingEnabled = true;
+ this.bodyFontFamilyComboBox.Location = new System.Drawing.Point(142, 161);
+ this.bodyFontFamilyComboBox.Name = "bodyFontFamilyComboBox";
+ this.bodyFontFamilyComboBox.Size = new System.Drawing.Size(110, 21);
+ this.bodyFontFamilyComboBox.TabIndex = 20;
+ //
+ // bodyFontLabel
+ //
+ this.bodyFontLabel.AutoSize = true;
+ this.bodyFontLabel.Location = new System.Drawing.Point(16, 164);
+ this.bodyFontLabel.Name = "bodyFontLabel";
+ this.bodyFontLabel.Size = new System.Drawing.Size(101, 13);
+ this.bodyFontLabel.TabIndex = 19;
+ this.bodyFontLabel.Text = "Body font/size/style";
+ //
+ // titleFontSizeTextBox
+ //
+ this.titleFontSizeTextBox.Enabled = false;
+ this.titleFontSizeTextBox.Location = new System.Drawing.Point(258, 113);
+ this.titleFontSizeTextBox.Name = "titleFontSizeTextBox";
+ this.titleFontSizeTextBox.Size = new System.Drawing.Size(30, 20);
+ this.titleFontSizeTextBox.TabIndex = 11;
+ //
+ // headerFontSizeTextBox
+ //
+ this.headerFontSizeTextBox.Enabled = false;
+ this.headerFontSizeTextBox.Location = new System.Drawing.Point(258, 137);
+ this.headerFontSizeTextBox.Name = "headerFontSizeTextBox";
+ this.headerFontSizeTextBox.Size = new System.Drawing.Size(30, 20);
+ this.headerFontSizeTextBox.TabIndex = 16;
+ //
+ // bodyFontSizeTextBox
+ //
+ this.bodyFontSizeTextBox.Enabled = false;
+ this.bodyFontSizeTextBox.Location = new System.Drawing.Point(258, 161);
+ this.bodyFontSizeTextBox.Name = "bodyFontSizeTextBox";
+ this.bodyFontSizeTextBox.Size = new System.Drawing.Size(29, 20);
+ this.bodyFontSizeTextBox.TabIndex = 21;
+ //
+ // titleBoldCheckBox
+ //
+ this.titleBoldCheckBox.AutoSize = true;
+ this.titleBoldCheckBox.Enabled = false;
+ this.titleBoldCheckBox.Location = new System.Drawing.Point(306, 116);
+ this.titleBoldCheckBox.Name = "titleBoldCheckBox";
+ this.titleBoldCheckBox.Size = new System.Drawing.Size(15, 14);
+ this.titleBoldCheckBox.TabIndex = 12;
+ this.titleBoldCheckBox.UseVisualStyleBackColor = true;
+ //
+ // titleItalicCheckBox
+ //
+ this.titleItalicCheckBox.AutoSize = true;
+ this.titleItalicCheckBox.Enabled = false;
+ this.titleItalicCheckBox.Location = new System.Drawing.Point(334, 116);
+ this.titleItalicCheckBox.Name = "titleItalicCheckBox";
+ this.titleItalicCheckBox.Size = new System.Drawing.Size(15, 14);
+ this.titleItalicCheckBox.TabIndex = 13;
+ this.titleItalicCheckBox.UseVisualStyleBackColor = true;
+ //
+ // headerItalicCheckBox
+ //
+ this.headerItalicCheckBox.AutoSize = true;
+ this.headerItalicCheckBox.Enabled = false;
+ this.headerItalicCheckBox.Location = new System.Drawing.Point(334, 140);
+ this.headerItalicCheckBox.Name = "headerItalicCheckBox";
+ this.headerItalicCheckBox.Size = new System.Drawing.Size(15, 14);
+ this.headerItalicCheckBox.TabIndex = 18;
+ this.headerItalicCheckBox.UseVisualStyleBackColor = true;
+ //
+ // headerBoldCheckBox
+ //
+ this.headerBoldCheckBox.AutoSize = true;
+ this.headerBoldCheckBox.Enabled = false;
+ this.headerBoldCheckBox.Location = new System.Drawing.Point(306, 140);
+ this.headerBoldCheckBox.Name = "headerBoldCheckBox";
+ this.headerBoldCheckBox.Size = new System.Drawing.Size(15, 14);
+ this.headerBoldCheckBox.TabIndex = 17;
+ this.headerBoldCheckBox.UseVisualStyleBackColor = true;
+ //
+ // bodyItalicCheckBox
+ //
+ this.bodyItalicCheckBox.AutoSize = true;
+ this.bodyItalicCheckBox.Enabled = false;
+ this.bodyItalicCheckBox.Location = new System.Drawing.Point(334, 164);
+ this.bodyItalicCheckBox.Name = "bodyItalicCheckBox";
+ this.bodyItalicCheckBox.Size = new System.Drawing.Size(15, 14);
+ this.bodyItalicCheckBox.TabIndex = 23;
+ this.bodyItalicCheckBox.UseVisualStyleBackColor = true;
+ //
+ // bodyBoldCheckBox
+ //
+ this.bodyBoldCheckBox.AutoSize = true;
+ this.bodyBoldCheckBox.Enabled = false;
+ this.bodyBoldCheckBox.Location = new System.Drawing.Point(306, 164);
+ this.bodyBoldCheckBox.Name = "bodyBoldCheckBox";
+ this.bodyBoldCheckBox.Size = new System.Drawing.Size(15, 14);
+ this.bodyBoldCheckBox.TabIndex = 22;
+ this.bodyBoldCheckBox.UseVisualStyleBackColor = true;
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
+ this.label1.Location = new System.Drawing.Point(296, 100);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(32, 13);
+ this.label1.TabIndex = 31;
+ this.label1.Text = "Bold";
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
+ this.label2.Location = new System.Drawing.Point(330, 100);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(24, 13);
+ this.label2.TabIndex = 32;
+ this.label2.Text = "Ital.";
+ //
+ // commonItems2Button
+ //
+ this.commonItems2Button.Enabled = false;
+ this.commonItems2Button.Location = new System.Drawing.Point(216, 259);
+ this.commonItems2Button.Name = "commonItems2Button";
+ this.commonItems2Button.Size = new System.Drawing.Size(70, 23);
+ this.commonItems2Button.TabIndex = 34;
+ this.commonItems2Button.Text = "Common 2";
+ this.commonItems2Button.UseVisualStyleBackColor = true;
+ this.commonItems2Button.Click += new System.EventHandler(this.commonItems2Button_Click);
+ //
+ // commonItems3Button
+ //
+ this.commonItems3Button.Enabled = false;
+ this.commonItems3Button.Location = new System.Drawing.Point(290, 259);
+ this.commonItems3Button.Name = "commonItems3Button";
+ this.commonItems3Button.Size = new System.Drawing.Size(70, 23);
+ this.commonItems3Button.TabIndex = 35;
+ this.commonItems3Button.Text = "Common 3";
+ this.commonItems3Button.UseVisualStyleBackColor = true;
+ this.commonItems3Button.Click += new System.EventHandler(this.commonItems3Button_Click);
+ //
+ // colW2TextBox
+ //
+ this.colW2TextBox.Enabled = false;
+ this.colW2TextBox.Location = new System.Drawing.Point(216, 236);
+ this.colW2TextBox.Name = "colW2TextBox";
+ this.colW2TextBox.Size = new System.Drawing.Size(44, 20);
+ this.colW2TextBox.TabIndex = 31;
+ //
+ // colW1TextBox
+ //
+ this.colW1TextBox.Enabled = false;
+ this.colW1TextBox.Location = new System.Drawing.Point(142, 236);
+ this.colW1TextBox.Name = "colW1TextBox";
+ this.colW1TextBox.Size = new System.Drawing.Size(44, 20);
+ this.colW1TextBox.TabIndex = 29;
+ //
+ // label3
+ //
+ this.label3.AutoSize = true;
+ this.label3.Location = new System.Drawing.Point(186, 239);
+ this.label3.Name = "label3";
+ this.label3.Size = new System.Drawing.Size(15, 13);
+ this.label3.TabIndex = 30;
+ this.label3.Text = "%";
+ //
+ // label4
+ //
+ this.label4.AutoSize = true;
+ this.label4.Location = new System.Drawing.Point(260, 238);
+ this.label4.Name = "label4";
+ this.label4.Size = new System.Drawing.Size(15, 13);
+ this.label4.TabIndex = 32;
+ this.label4.Text = "%";
+ //
+ // label5
+ //
+ this.label5.AutoSize = true;
+ this.label5.Location = new System.Drawing.Point(16, 239);
+ this.label5.Name = "label5";
+ this.label5.Size = new System.Drawing.Size(97, 13);
+ this.label5.TabIndex = 28;
+ this.label5.Text = "Column widths in %";
+ //
+ // PrinterCfgCtrl
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.label5);
+ this.Controls.Add(this.label4);
+ this.Controls.Add(this.label3);
+ this.Controls.Add(this.colW2TextBox);
+ this.Controls.Add(this.colW1TextBox);
+ this.Controls.Add(this.commonItems3Button);
+ this.Controls.Add(this.commonItems2Button);
+ this.Controls.Add(this.label2);
+ this.Controls.Add(this.label1);
+ this.Controls.Add(this.bodyItalicCheckBox);
+ this.Controls.Add(this.bodyBoldCheckBox);
+ this.Controls.Add(this.headerItalicCheckBox);
+ this.Controls.Add(this.headerBoldCheckBox);
+ this.Controls.Add(this.titleItalicCheckBox);
+ this.Controls.Add(this.titleBoldCheckBox);
+ this.Controls.Add(this.bodyFontSizeTextBox);
+ this.Controls.Add(this.headerFontSizeTextBox);
+ this.Controls.Add(this.titleFontSizeTextBox);
+ this.Controls.Add(this.bodyFontFamilyComboBox);
+ this.Controls.Add(this.bodyFontLabel);
+ this.Controls.Add(this.headerFontFamilyComboBox);
+ this.Controls.Add(this.titleFontFamilyComboBox);
+ this.Controls.Add(this.cultureComboBox);
+ this.Controls.Add(this.cultureLabel);
+ this.Controls.Add(this.commonItems1Button);
+ this.Controls.Add(this.footerButton);
+ this.Controls.Add(this.headerButton);
+ this.Controls.Add(this.testItemsButton);
+ this.Controls.Add(this.bottomMarginTextBox);
+ this.Controls.Add(this.titleFontLabel);
+ this.Controls.Add(this.leftMarginTextBox);
+ this.Controls.Add(this.headerFontLabel);
+ 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(400, 350);
+ 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;
+ private System.Windows.Forms.TextBox leftMarginTextBox;
+ private System.Windows.Forms.TextBox bottomMarginTextBox;
+ private System.Windows.Forms.ComboBox cultureComboBox;
+ private System.Windows.Forms.Label cultureLabel;
+ private System.Windows.Forms.Button commonItems1Button;
+ private System.Windows.Forms.Button footerButton;
+ private System.Windows.Forms.Button headerButton;
+ private System.Windows.Forms.Button testItemsButton;
+ private System.Windows.Forms.Label headerFontLabel;
+ private System.Windows.Forms.Label titleFontLabel;
+ private System.Windows.Forms.ComboBox titleFontFamilyComboBox;
+ private System.Windows.Forms.ComboBox headerFontFamilyComboBox;
+ private System.Windows.Forms.ComboBox bodyFontFamilyComboBox;
+ private System.Windows.Forms.Label bodyFontLabel;
+ private System.Windows.Forms.TextBox titleFontSizeTextBox;
+ private System.Windows.Forms.TextBox headerFontSizeTextBox;
+ private System.Windows.Forms.TextBox bodyFontSizeTextBox;
+ private System.Windows.Forms.CheckBox titleBoldCheckBox;
+ private System.Windows.Forms.CheckBox titleItalicCheckBox;
+ private System.Windows.Forms.CheckBox headerItalicCheckBox;
+ private System.Windows.Forms.CheckBox headerBoldCheckBox;
+ private System.Windows.Forms.CheckBox bodyItalicCheckBox;
+ private System.Windows.Forms.CheckBox bodyBoldCheckBox;
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.Button commonItems2Button;
+ private System.Windows.Forms.Button commonItems3Button;
+ private System.Windows.Forms.TextBox colW2TextBox;
+ private System.Windows.Forms.TextBox colW1TextBox;
+ private System.Windows.Forms.Label label3;
+ private System.Windows.Forms.Label label4;
+ private System.Windows.Forms.Label label5;
+ }
+}
diff --git a/TestBenchFramework/BenchControl/Output/Printers/Zapiska/PrinterCfgCtrl.cs b/TestBenchFramework/BenchControl/Output/Printers/Zapiska/PrinterCfgCtrl.cs
new file mode 100644
index 000000000..a3848a628
--- /dev/null
+++ b/TestBenchFramework/BenchControl/Output/Printers/Zapiska/PrinterCfgCtrl.cs
@@ -0,0 +1,478 @@
+///
+/// Copyright (c) 2017 Sensus Metering Systems
+///
+using System;
+using System.Collections.Generic;
+using System.Windows.Forms;
+using log4net;
+using Config.Entities;
+using TBF.BenchControl.Generic;
+using TBF.Resources;
+
+namespace TBF.BenchControl.Output.Printers.Zapiska
+{
+ 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();
+ }
+ }
+
+ string header;
+ string[] commonItems1;
+ string[] commonItems2;
+ string[] commonItems3;
+ string[] testItems;
+ string footer;
+
+ public PrinterCfgCtrl()
+ {
+ InitializeComponent();
+ Localize();
+
+ orientationComboBox.Items.Add(PageOrientation.Portrait.ToString());
+ orientationComboBox.Items.Add(PageOrientation.Landscape.ToString());
+
+ foreach (var ff in System.Drawing.FontFamily.Families)
+ {
+ titleFontFamilyComboBox.Items.Add(ff.Name);
+ headerFontFamilyComboBox.Items.Add(ff.Name);
+ bodyFontFamilyComboBox.Items.Add(ff.Name);
+ }
+ }
+
+ private void PrinterCfgCtrl_Load(object sender, EventArgs e)
+ {
+ for (Culture s = 0; s < Culture.Count; s++) cultureComboBox.Items.Add(s.ToString());
+
+ header = config.Header;
+ commonItems1 = config.CommonItems1;
+ commonItems2 = config.CommonItems2;
+ commonItems3 = config.CommonItems3;
+ testItems = config.SelectedItems;
+ footer = config.Footer;
+
+ Redraw();
+ }
+
+ void Localize()
+ {
+ nameLabel.Text = Strings.Name;
+ cultureLabel.Text = "Culture";
+ headerButton.Text = Strings.Header;
+ commonItems1Button.Text = "Common 1";
+ commonItems2Button.Text = "Common 2";
+ commonItems3Button.Text = "Common 3";
+ testItemsButton.Text = "Test items";
+ footerButton.Text = Strings.Footer;
+ }
+
+ 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();
+ bottomMarginTextBox.Text = config.BottomMargin.ToString();
+ leftMarginTextBox.Text = config.LeftMargin.ToString();
+
+ titleFontFamilyComboBox.Text = config.TitFntFml;
+ titleFontSizeTextBox.Text = config.TitFntSz.ToString();
+ titleBoldCheckBox.Checked = ((config.TitFntSty & (int)System.Drawing.FontStyle.Bold) != 0);
+ titleItalicCheckBox.Checked = ((config.TitFntSty & (int)System.Drawing.FontStyle.Italic) != 0);
+
+ headerFontFamilyComboBox.Text = config.HdrFntFml;
+ headerFontSizeTextBox.Text = config.HdrFntSz.ToString();
+ headerBoldCheckBox.Checked = ((config.HdrFntSty & (int)System.Drawing.FontStyle.Bold) != 0);
+ headerItalicCheckBox.Checked = ((config.HdrFntSty & (int)System.Drawing.FontStyle.Italic) != 0);
+
+ bodyFontFamilyComboBox.Text = config.BodyFntFml;
+ bodyFontSizeTextBox.Text = config.BodyFntSz.ToString();
+ bodyBoldCheckBox.Checked = ((config.BodyFntSty & (int)System.Drawing.FontStyle.Bold) != 0);
+ bodyItalicCheckBox.Checked = ((config.BodyFntSty & (int)System.Drawing.FontStyle.Italic) != 0);
+
+ colW1TextBox.Text = config.ColW1Pct.ToString();
+ colW2TextBox.Text = config.ColW2Pct.ToString();
+
+ supressPrintingCheckBox.Checked = config.SupressPrinting;
+ cultureComboBox.Text = config.Culture.ToString();
+ }
+
+ public void Unlock()
+ {
+ nameTextBox.Enabled = true;
+ orientationComboBox.Enabled = true;
+ topMarginTextBox.Enabled = true;
+ bottomMarginTextBox.Enabled = true;
+ leftMarginTextBox.Enabled = true;
+ titleFontFamilyComboBox.Enabled = true;
+ titleFontSizeTextBox.Enabled = true;
+ titleBoldCheckBox.Enabled = true;
+ titleItalicCheckBox.Enabled = true;
+ headerFontFamilyComboBox.Enabled = true;
+ headerFontSizeTextBox.Enabled = true;
+ headerBoldCheckBox.Enabled = true;
+ headerItalicCheckBox.Enabled = true;
+ bodyFontFamilyComboBox.Enabled = true;
+ bodyFontSizeTextBox.Enabled = true;
+ bodyBoldCheckBox.Enabled = true;
+ bodyItalicCheckBox.Enabled = true;
+ supressPrintingCheckBox.Enabled = true;
+ cultureComboBox.Enabled = true;
+ headerButton.Enabled = true;
+ colW1TextBox.Enabled = true;
+ colW2TextBox.Enabled = true;
+ commonItems1Button.Enabled = true;
+ commonItems2Button.Enabled = true;
+ commonItems3Button.Enabled = true;
+ testItemsButton.Enabled = true;
+ footerButton.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, dummy2;
+ 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;
+ }
+
+ if (!int.TryParse(bottomMarginTextBox.Text, out dummy) || dummy < 0 || dummy > 200)
+ {
+ message += Environment.NewLine + "'Bottom margin' should be between 0 and 200";
+ flags |= CfgUpdateFlags.Error;
+ }
+
+ if (!int.TryParse(leftMarginTextBox.Text, out dummy) || dummy < 0 || dummy > 200)
+ {
+ message += Environment.NewLine + "Left margin' should be between 0 and 200";
+ flags |= CfgUpdateFlags.Error;
+ }
+
+ if (!int.TryParse(titleFontSizeTextBox.Text, out dummy) || dummy < 6 || dummy > 48)
+ {
+ message += Environment.NewLine + "Title font size should be between 6 and 48";
+ flags |= CfgUpdateFlags.Error;
+ }
+
+ if (!int.TryParse(headerFontSizeTextBox.Text, out dummy) || dummy < 6 || dummy > 48)
+ {
+ message += Environment.NewLine + "Header font size should be between 6 and 48";
+ flags |= CfgUpdateFlags.Error;
+ }
+
+ if (!int.TryParse(bodyFontSizeTextBox.Text, out dummy) || dummy < 6 || dummy > 48)
+ {
+ message += Environment.NewLine + "Body font size should be between 6 and 48";
+ flags |= CfgUpdateFlags.Error;
+ }
+
+ if (!cultureComboBox.Items.Contains(cultureComboBox.Text))
+ {
+ flags |= CfgUpdateFlags.Error;
+ message += Environment.NewLine + "Invalid culture";
+ }
+
+ if (!int.TryParse(colW1TextBox.Text, out dummy) || dummy < 0 || dummy > 100)
+ {
+ message += Environment.NewLine + "Column width 1 should be between 0 and 100";
+ flags |= CfgUpdateFlags.Error;
+ }
+
+ if (!int.TryParse(colW2TextBox.Text, out dummy2) || dummy2 < 0 || dummy2 > 100)
+ {
+ message += Environment.NewLine + "Column width 2 should be between 0 and 100";
+ flags |= CfgUpdateFlags.Error;
+ }
+
+ if (dummy + dummy2 > 100)
+ {
+ message += Environment.NewLine + "Sum of column widths should be <= 100";
+ flags |= CfgUpdateFlags.Error;
+ }
+
+ return flags;
+ }
+
+ public CfgUpdateFlags UpdateCfg()
+ {
+ CfgUpdateFlags flags = CfgUpdateFlags.None;
+
+ if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
+
+ if (config.Name != nameTextBox.Text)
+ {
+ config.Name = nameTextBox.Text;
+ flags |= (CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
+ }
+
+ if (config.PageOrientation != GetOrientation(orientationComboBox.Text))
+ {
+ config.PageOrientation = GetOrientation(orientationComboBox.Text);
+ flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
+ }
+
+ int tmp = int.Parse(topMarginTextBox.Text);
+ if (config.TopMargin != tmp)
+ {
+ config.TopMargin = tmp;
+ flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
+ }
+
+ tmp = int.Parse(bottomMarginTextBox.Text);
+ if (config.BottomMargin != tmp)
+ {
+ config.BottomMargin = tmp;
+ flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
+ }
+
+ tmp = int.Parse(leftMarginTextBox.Text);
+ if (config.LeftMargin != tmp)
+ {
+ config.LeftMargin = tmp;
+ flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
+ }
+
+ /// Title font properties
+ if (config.TitFntFml != titleFontFamilyComboBox.Text)
+ {
+ config.TitFntFml = titleFontFamilyComboBox.Text;
+ flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
+ }
+ tmp = int.Parse(titleFontSizeTextBox.Text);
+ if (config.TitFntSz != tmp)
+ {
+ config.TitFntSz = tmp;
+ flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
+ }
+ tmp = (titleBoldCheckBox.Checked ? (int)System.Drawing.FontStyle.Bold : 0)
+ + (titleItalicCheckBox.Checked ? (int)System.Drawing.FontStyle.Italic : 0);
+ if (config.TitFntSty != tmp)
+ {
+ config.TitFntSty = tmp;
+ flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
+ }
+
+ /// Header font properties
+ if (config.HdrFntFml != headerFontFamilyComboBox.Text)
+ {
+ config.HdrFntFml = headerFontFamilyComboBox.Text;
+ flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
+ }
+ tmp = int.Parse(headerFontSizeTextBox.Text);
+ if (config.HdrFntSz != tmp)
+ {
+ config.HdrFntSz = tmp;
+ flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
+ }
+ tmp = (headerBoldCheckBox.Checked ? (int)System.Drawing.FontStyle.Bold : 0)
+ + (headerItalicCheckBox.Checked ? (int)System.Drawing.FontStyle.Italic : 0);
+ if (config.HdrFntSty != tmp)
+ {
+ config.HdrFntSty = tmp;
+ flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
+ }
+
+ /// Body font properties
+ if (config.BodyFntFml != bodyFontFamilyComboBox.Text)
+ {
+ config.BodyFntFml = bodyFontFamilyComboBox.Text;
+ flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
+ }
+ tmp = int.Parse(bodyFontSizeTextBox.Text);
+ if (config.BodyFntSz != tmp)
+ {
+ config.BodyFntSz = tmp;
+ flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
+ }
+ tmp = (bodyBoldCheckBox.Checked ? (int)System.Drawing.FontStyle.Bold : 0)
+ + (bodyItalicCheckBox.Checked ? (int)System.Drawing.FontStyle.Italic : 0);
+ if (config.BodyFntSty != tmp)
+ {
+ config.BodyFntSty = tmp;
+ flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
+ }
+
+ if (config.SupressPrinting != supressPrintingCheckBox.Checked)
+ {
+ config.SupressPrinting = supressPrintingCheckBox.Checked;
+ flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
+ }
+
+ tmp = int.Parse(colW1TextBox.Text);
+ if (config.ColW1Pct != tmp)
+ {
+ config.ColW1Pct = tmp;
+ flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
+ }
+ tmp = int.Parse(colW2TextBox.Text);
+ if (config.ColW2Pct != tmp)
+ {
+ config.ColW2Pct = tmp;
+ flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
+ }
+
+ if (config.CommonItems1 != commonItems1)
+ {
+ config.CommonItems1 = commonItems1;
+ flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
+ }
+ if (config.CommonItems2 != commonItems2)
+ {
+ config.CommonItems2 = commonItems2;
+ flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
+ }
+ if (config.CommonItems3 != commonItems3)
+ {
+ config.CommonItems3 = commonItems3;
+ flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
+ }
+
+ if (config.SelectedItems != testItems)
+ {
+ config.SelectedItems = testItems;
+ flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
+ }
+
+ if (config.Header != header)
+ {
+ config.Header = header;
+ flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
+ }
+
+ if (config.Footer != footer)
+ {
+ config.Footer = footer;
+ flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
+ }
+
+ if ((flags & CfgUpdateFlags.InvokeCfgChange) != 0)
+ {
+ Printer.OnCfgChange(this, new CfgChangeArgs(CfgChangeCmd.CfgChange, config));
+ }
+
+ return flags;
+ }
+
+ private void headerButton_Click(object sender, EventArgs e)
+ {
+ HeaderFooterDlg dlg = new HeaderFooterDlg(true, string.IsNullOrEmpty(header) ? string.Empty : header.Replace("~", Environment.NewLine));
+ if (dlg.ShowDialog() == DialogResult.OK)
+ {
+ header = dlg.EditedText.Replace(Environment.NewLine, "~");
+ }
+ }
+
+ private void commonItems1Button_Click(object sender, EventArgs e)
+ {
+ Results.Forms.ResultsConfigDlg dlg = new Results.Forms.ResultsConfigDlg()
+ {
+ MetersKind = config.MetersKind,
+ SelectedItems = Results.WMeterRsltItemSpec.FromStrArray(commonItems1),
+ };
+
+ if (dlg.ShowDialog() == DialogResult.OK)
+ {
+ commonItems1 = Results.WMeterRsltItemSpec.ToStrArray(dlg.SelectedItems);
+ }
+ }
+
+ private void commonItems2Button_Click(object sender, EventArgs e)
+ {
+ Results.Forms.ResultsConfigDlg dlg = new Results.Forms.ResultsConfigDlg()
+ {
+ MetersKind = config.MetersKind,
+ SelectedItems = Results.WMeterRsltItemSpec.FromStrArray(commonItems2),
+ };
+
+ if (dlg.ShowDialog() == DialogResult.OK)
+ {
+ commonItems2 = Results.WMeterRsltItemSpec.ToStrArray(dlg.SelectedItems);
+ }
+ }
+
+ private void commonItems3Button_Click(object sender, EventArgs e)
+ {
+ Results.Forms.ResultsConfigDlg dlg = new Results.Forms.ResultsConfigDlg()
+ {
+ MetersKind = config.MetersKind,
+ SelectedItems = Results.WMeterRsltItemSpec.FromStrArray(commonItems3),
+ };
+
+ if (dlg.ShowDialog() == DialogResult.OK)
+ {
+ commonItems3 = Results.WMeterRsltItemSpec.ToStrArray(dlg.SelectedItems);
+ }
+ }
+
+ private void testItemsButton_Click(object sender, EventArgs e)
+ {
+ Results.Forms.ResultsConfigDlg dlg = new Results.Forms.ResultsConfigDlg(true)
+ {
+ MetersKind = config.MetersKind,
+ SelectedItems = Results.WMeterRsltItemSpec.FromStrArray(testItems),
+ };
+
+ if (dlg.ShowDialog() == DialogResult.OK)
+ {
+ testItems = Results.WMeterRsltItemSpec.ToStrArray(dlg.SelectedItems);
+ }
+ }
+
+ private void footerButton_Click(object sender, EventArgs e)
+ {
+ HeaderFooterDlg dlg = new HeaderFooterDlg(false, string.IsNullOrEmpty(footer) ? string.Empty : footer.Replace("~", Environment.NewLine));
+ if (dlg.ShowDialog() == DialogResult.OK)
+ {
+ footer = dlg.EditedText.Replace(Environment.NewLine, "~");
+ }
+ }
+
+ #region Configuration Change Handling
+
+ public static void OnCmdResponse(object sender, CmdResponseArgs args)
+ {
+ if (CmdResponseHandler == null) return;
+ try { CmdResponseHandler(sender, args); }
+ catch (Exception e) { log.Error("CmdResponseHandler(...) failed", e); }
+ }
+
+ public static event EventHandler CmdResponseHandler;
+
+ public void StartResponseHandler() { }
+ public void StopResponseHandler() { }
+
+ #endregion Configuration Change Handling
+ }
+}
diff --git a/TestBenchFramework/BenchControl/Output/Printers/Zapiska/PrinterCfgCtrl.resx b/TestBenchFramework/BenchControl/Output/Printers/Zapiska/PrinterCfgCtrl.resx
new file mode 100644
index 000000000..1af7de150
--- /dev/null
+++ b/TestBenchFramework/BenchControl/Output/Printers/Zapiska/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/TbfComponents.cs b/TestBenchFramework/BenchControl/TbfComponents.cs
index 2048ee64e..8a20b27e0 100644
--- a/TestBenchFramework/BenchControl/TbfComponents.cs
+++ b/TestBenchFramework/BenchControl/TbfComponents.cs
@@ -103,6 +103,9 @@ namespace TBF.BenchControl
Factories.Add(new Output.Printers.OnePagePerMeter.FactorySingle());
Factories.Add(new Output.Printers.OnePagePerMeter.FactoryCompound());
Factories.Add(new Output.Printers.OnePagePerMeter.FactoryHeatMeters());
+ Factories.Add(new Output.Printers.Zapiska.FactorySingle());
+ Factories.Add(new Output.Printers.Zapiska.FactoryCompound());
+ Factories.Add(new Output.Printers.Zapiska.FactoryHeatMeters());
Factories.Add(new Elde.PressureMeter.PressureMeterFactory());
Factories.Add(new Elde.PressureMeterInternal.PressureMeterFactory());
Factories.Add(new Elde.Pump.PumpFactory());
diff --git a/TestBenchFramework/TBF.csproj b/TestBenchFramework/TBF.csproj
index 7d0441b6a..6ed562b89 100644
--- a/TestBenchFramework/TBF.csproj
+++ b/TestBenchFramework/TBF.csproj
@@ -774,6 +774,17 @@
PrinterCfgCtrl.cs
+
+
+
+
+
+
+ UserControl
+
+
+ PrinterCfgCtrl.cs
+
@@ -2143,6 +2154,9 @@
PrinterCfgCtrl.cs
+
+ PrinterCfgCtrl.cs
+
PrinterCfgCtrl.cs
diff --git a/packages/ControlBoard/Kempno_50/ControlComponent3U.dll b/packages/ControlBoard/Kempno_50/ControlComponent3U.dll
index 4155fb461..787a56c03 100644
Binary files a/packages/ControlBoard/Kempno_50/ControlComponent3U.dll and b/packages/ControlBoard/Kempno_50/ControlComponent3U.dll differ