From 267236a1776e06946ce273a703c3fbfeadfcdbbb Mon Sep 17 00:00:00 2001 From: Milan Hanajik Date: Mon, 20 Apr 2020 08:50:29 +0200 Subject: [PATCH] AutoTests are skipped in all outputs, RegularTestRslts(), AutoTestRslts()... in entities and Output.XY, Output.Printers.OnePerBatch --- Config/Entities/Procedure.cs | 11 + Results/Entities/Batch.cs | 51 +- Results/Entities/WaterMeter.cs | 23 + .../Printers/Munich/MunichPrintDocument.cs | 8 +- .../OnePerBatch/OnePerBatchPrintDocument.cs | 355 +++++++ .../OnePerBatch/OnePerBatchPrinterCfg.cs | 59 ++ Results/Output/Table.cs | 22 +- Results/Output/WMChart.cs | 2 +- Results/Results.csproj | 4 + .../Output/DB/SensusOracle/Database.cs | 4 +- .../Output/FileWriters/Elde/Writer.cs | 10 +- .../Output/FileWriters/Enhanced/Writer.cs | 4 +- .../FileWriters/OneFilePerMeter/Writer.cs | 4 +- .../Output/FileWriters/Xml/Writer.cs | 2 +- .../Output/FileWriters/XmlBatch/Writer.cs | 2 +- .../Output/Printers/OnePerBatch/Factory.cs | 26 + .../Output/Printers/OnePerBatch/Printer.cs | 250 +++++ .../Output/Printers/OnePerBatch/PrinterCfg.cs | 128 +++ .../OnePerBatch/PrinterCfgCtrl.Designer.cs | 995 ++++++++++++++++++ .../Printers/OnePerBatch/PrinterCfgCtrl.cs | 636 +++++++++++ .../Printers/OnePerBatch/PrinterCfgCtrl.resx | 120 +++ .../Output/Printers/OnePerMeter/Printer.cs | 13 +- TBF/BenchControl/TbfComponents.cs | 1 + TBF/TBF.csproj | 12 + .../TestWizard/OracleWZTypSelection.cs | 5 +- 25 files changed, 2711 insertions(+), 36 deletions(-) create mode 100644 Results/Output/Printers/OnePerBatch/OnePerBatchPrintDocument.cs create mode 100644 Results/Output/Printers/OnePerBatch/OnePerBatchPrinterCfg.cs create mode 100644 TBF/BenchControl/Output/Printers/OnePerBatch/Factory.cs create mode 100644 TBF/BenchControl/Output/Printers/OnePerBatch/Printer.cs create mode 100644 TBF/BenchControl/Output/Printers/OnePerBatch/PrinterCfg.cs create mode 100644 TBF/BenchControl/Output/Printers/OnePerBatch/PrinterCfgCtrl.Designer.cs create mode 100644 TBF/BenchControl/Output/Printers/OnePerBatch/PrinterCfgCtrl.cs create mode 100644 TBF/BenchControl/Output/Printers/OnePerBatch/PrinterCfgCtrl.resx diff --git a/Config/Entities/Procedure.cs b/Config/Entities/Procedure.cs index e7224179f..5210cf22d 100644 --- a/Config/Entities/Procedure.cs +++ b/Config/Entities/Procedure.cs @@ -53,6 +53,17 @@ namespace Config.Entities public virtual IList MoreParams { get; set; } public virtual IList Tests { get; set; } + /// Wrapper + public virtual IList RegularTests() + { + IList rslt = new List(); + foreach (var t in Tests) + { + if ((t.Name.Length > 0 && t.Name[0] != '[') || !t.Name.Contains("]")) rslt.Add(t); + } + return rslt; + } + /// ------------- Additional stuff not mapped into the database ------------- public Procedure() diff --git a/Results/Entities/Batch.cs b/Results/Entities/Batch.cs index 9a8bda07c..f7f8e00d3 100644 --- a/Results/Entities/Batch.cs +++ b/Results/Entities/Batch.cs @@ -45,7 +45,56 @@ namespace Results.Entities public virtual IList WaterMeters { get; set; } public virtual IList TestRslts { get; set; } public virtual bool Compound { get; set; } /// Not mapped to DB now - public virtual bool HeatMeter { get; set; } /// Not mapped to DB now /// + public virtual bool HeatMeter { get; set; } /// Not mapped to DB now + + public virtual IList RegularTests() + { + IList rslt = new List(); + foreach (var td in Tests) + { + if ((td.Name.Length > 0 && td.Name[0] != '[') || !td.Name.Contains("]")) rslt.Add(td); + } + return rslt; + } + + public virtual IList RegularTestRslts() + { + IList rslt = new List(); + foreach (var tr in TestRslts) + { + if ((tr.Name().Length > 0 && tr.Name()[0] != '[') || !tr.Name().Contains("]")) rslt.Add(tr); + } + return rslt; + } + + public virtual IList AutoTests(string param) + { + int len = param.Length; + IList rslt = new List(); + foreach (var td in Tests) + { + if (td.Name.Length > len + 1 && td.Name[0] == '[' && td.Name.IndexOf(param) == 1 && td.Name[len + 1] == ']') + { + rslt.Add(td); + } + } + return rslt; + } + + public virtual IList AutoTestRslts(string param) + { + int len = param.Length; + IList rslt = new List(); + foreach (var tr in TestRslts) + { + if (tr.Name().Length > len + 1 && tr.Name()[0] == '[' && tr.Name().IndexOf(param) == 1 && tr.Name()[len + 1] == ']') + { + rslt.Add(tr); + } + } + return rslt; + } + public Batch() { diff --git a/Results/Entities/WaterMeter.cs b/Results/Entities/WaterMeter.cs index 0437060b8..7c3654e3d 100644 --- a/Results/Entities/WaterMeter.cs +++ b/Results/Entities/WaterMeter.cs @@ -133,6 +133,29 @@ namespace Results.Entities public virtual DateTime StartTime() { return Batch.StartTime; } public virtual DateTime EndTime() { return Batch.EndTime; } + public virtual IList RegularMeterTestRslts() + { + IList rslt = new List(); + foreach (var mtr in MeterTestRslts) + { + if ((mtr.Name().Length > 0 && mtr.Name()[0] != '[') || !mtr.Name().Contains("]")) rslt.Add(mtr); + } + return rslt; + } + + public virtual IList AutoMeterTestRslts(string param) + { + int len = param.Length; + IList rslt = new List(); + foreach (var mtr in MeterTestRslts) + { + if (mtr.Name().Length > len + 1 && mtr.Name()[0] == '[' && mtr.Name().IndexOf(param) == 1 && mtr.Name()[len + 1] == ']') + { + rslt.Add(mtr); + } + } + return rslt; + } public virtual long ErrorFlagsFromTests() { diff --git a/Results/Output/Printers/Munich/MunichPrintDocument.cs b/Results/Output/Printers/Munich/MunichPrintDocument.cs index d6bc21c80..eeb422750 100644 --- a/Results/Output/Printers/Munich/MunichPrintDocument.cs +++ b/Results/Output/Printers/Munich/MunichPrintDocument.cs @@ -115,10 +115,10 @@ namespace Results.Output.Printers.Munich zaehlertyp = compound ? "Verbundzähler" : "Einzelzähler"; } - results = wm.MeterTestRslts; + results = wm.RegularMeterTestRslts(); resultsCount = 0; - foreach (var mtr in wm.MeterTestRslts) + foreach (var mtr in wm.RegularMeterTestRslts()) { if (mtr != null && mtr.IsPilotRslt() && mtr.Publish() == Config.Entities.Publish.Always) resultsCount++; } @@ -379,7 +379,7 @@ namespace Results.Output.Printers.Munich table.AddRow(tableHeader, horizontalAlignment, verticalAlignment); int rowCount = 0; - foreach (var mtr in wm.MeterTestRslts) + foreach (var mtr in wm.RegularMeterTestRslts()) { if (mtr != null && mtr.IsPilotRslt() && mtr.Publish() == Config.Entities.Publish.Always) { @@ -447,7 +447,7 @@ namespace Results.Output.Printers.Munich table.AddRow(tableHeader, horizontalAlignment, verticalAlignment); int rowCount = 0; - foreach (var mtr in wm.MeterTestRslts) + foreach (var mtr in wm.RegularMeterTestRslts()) { if (mtr != null && mtr.IsPilotRslt() && mtr.Publish() == Config.Entities.Publish.Always) { diff --git a/Results/Output/Printers/OnePerBatch/OnePerBatchPrintDocument.cs b/Results/Output/Printers/OnePerBatch/OnePerBatchPrintDocument.cs new file mode 100644 index 000000000..e863b78ef --- /dev/null +++ b/Results/Output/Printers/OnePerBatch/OnePerBatchPrintDocument.cs @@ -0,0 +1,355 @@ +/// +/// Copyright (c) 2020 Sensus Slovensko a.s. +/// +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.OnePerBatch +{ + public class OnePerBatchPrintDocument : PrintersCommon + { + const float GapBetweenTableColumns = 10; + const float GapBetweenCommonColumns = 10; + + /// 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 TitleX; + readonly int TitleY; /// Depends on the size of the header + + readonly int spacingOne; + readonly int spacingOne4Header; + + float titleHeight; + + /// + /// Property variable for the Font the user wishes to use + /// + Font titleFont; + Font headerFont; + Font font; + Font footerFont; + + /// + /// Data to print + /// + Results.Entities.Batch batch; + OnePerBatchPrinterCfg cfg; + Results.Entities.WaterMeter wm; + + /// + /// Items to print + /// + string header; + IList commonItems1; + IList commonItems2; + IList commonItems3; + IList testItems; + IList testItems2; + IList belowItems1; + IList belowItems2; + IList belowItems3; + string footer; + + int nrPages; + int pageNr; /// Page number to be printed at the bottom of the page + + /// + /// Constructor + /// + /// Text to be printed + public OnePerBatchPrintDocument(Results.Entities.Batch batch, OnePerBatchPrinterCfg cfg, Results.Entities.WaterMeter wm, string documentName) + { + this.batch = batch; + this.cfg = cfg; + this.wm = wm; + DocumentName = documentName; + + 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 + testItems2 = Results.WMeterRsltItemSpec.FromStrArray(cfg.TestItems2); /// TestID info will be overwritten later on + belowItems1 = Results.WMeterRsltItemSpec.FromStrArray(cfg.BelowItems1); + belowItems2 = Results.WMeterRsltItemSpec.FromStrArray(cfg.BelowItems2); + belowItems3 = Results.WMeterRsltItemSpec.FromStrArray(cfg.BelowItems3); + 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); + footerFont = new Font((cfg.FooterFntFml != null ? cfg.FooterFntFml : "Arial"), (cfg.FooterFntSz > 0 ? cfg.FooterFntSz : 10), (FontStyle)cfg.FooterFntSty); + + /// 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; + } + + spacingOne = System.Windows.Forms.TextRenderer.MeasureText("Abcgq", font).Height; + spacingOne4Header = System.Windows.Forms.TextRenderer.MeasureText("Abcgq", headerFont).Height; + + /// Prepare document outline + TitleX = cfg.LeftMargin; + TitleY = cfg.TopMargin; + + pageNr = 1; + nrPages = (testItems2.Count != 0) ? 2 : 1; + } + + /// + /// 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 (!string.IsNullOrEmpty(cfg.Template)) + { + string templatePath = Path.Combine("C:\\TBF\\Templates\\", cfg.Template); + if (File.Exists(templatePath)) + { + if (cfg.PageOrientation == PageOrientation.Portrait) + e.Graphics.DrawImage(new Bitmap(Image.FromFile(templatePath), 827, 1169), new Rectangle(0, 0, 827, 1169)); + else + e.Graphics.DrawImage(new Bitmap(Image.FromFile(templatePath), 1169, 827), new Rectangle(0, 0, 1169, 827)); + } + } + + if ((cfg.GraphHgh != 0) && (cfg.GraphWid != 0)) + { + Rectangle pos = new Rectangle(cfg.GraphLeft, cfg.GraphTop, cfg.GraphWid, cfg.GraphHgh); + WMChart.GetChart(wm, true).Printing.PrintPaint(e.Graphics, pos); + } + + float tableTop = cfg.TopMargin; + + if (pageNr == 1) + { + /// First page + + /// + /// Print water meter picture + /// + if (cfg.ImgWid != 0 && cfg.ImgHgh != 0 && cfg.ImgFullPathName != null) + { + try + { + e.Graphics.DrawImage(new Bitmap(Image.FromFile(cfg.ImgFullPathName), cfg.ImgWid, cfg.ImgHgh), + new Rectangle(cfg.ImgLeft, cfg.ImgTop, cfg.ImgWid, cfg.ImgHgh)); + } + catch (Exception) { } /// Cope with situations when file is missing or is not correct + } + + /// + /// Title + /// + RectangleF printArea = new RectangleF(TitleX, TitleY, printWidth, titleHeight); + e.Graphics.DrawString(header, titleFont, Brushes.Black, printArea); + + titleHeight = System.Windows.Forms.TextRenderer.MeasureText(header, titleFont).Height; + float commonTop = TitleY + titleHeight; + + ///---------------- + /// Common items + ///---------------- + commonTop += spacingOne4Header; /// Space above common part + float leftMarginCommon1 = leftMargin + printWidth * 0.01f * cfg.ColW0Pct; + float leftMarginCommon2 = leftMargin + printWidth * 0.01f * (cfg.ColW0Pct + cfg.ColW1Pct); + float leftMarginCommon3 = leftMargin + printWidth * 0.01f * (cfg.ColW0Pct + cfg.ColW1Pct + cfg.ColW2Pct); + + Alignment[] horizAlgn = new Alignment[] { Alignment.Left, Alignment.Left }; + VertAlignment[] vertAlgn = new VertAlignment[] { VertAlignment.Top, VertAlignment.Top }; + TableStyle commonTableStyle = new TableStyle { Font = font, MarginX = 5, MarginY = 3 }; + + Table table1 = new Table(2, cfg.AutoTestParam) { Style = commonTableStyle }; + foreach (var item in commonItems1) + { + string[] row = new string[] { item.Caption, item.Print(wm).Split(new char[] { '|' })[0] }; + table1.AddRow(row, horizAlgn, vertAlgn); + } + float bodyTop1 = table1.Draw(e, leftMarginCommon1, commonTop); + + + table1 = new Table(2, cfg.AutoTestParam) { Style = commonTableStyle }; + foreach (var item in commonItems2) + { + string[] row = new string[] { item.Caption, item.Print(wm).Split(new char[] { '|' })[0] }; + table1.AddRow(row, horizAlgn, vertAlgn); + } + float bodyTop2 = table1.Draw(e, leftMarginCommon2, commonTop); + + + table1 = new Table(2, cfg.AutoTestParam) { Style = commonTableStyle }; + foreach (var item in commonItems3) + { + string[] row = new string[] { item.Caption, item.Print(wm).Split(new char[] { '|' })[0] }; + table1.AddRow(row, horizAlgn, vertAlgn); + } + float bodyTop3 = table1.Draw(e, leftMarginCommon3, commonTop); + + float bodyTop12 = (bodyTop1 > bodyTop2) ? bodyTop1 : bodyTop2; + tableTop = (bodyTop12 > bodyTop3) ? bodyTop12 : bodyTop3; /// Max. of all three bodyTop-s + tableTop += spacingOne4Header; /// Space between the common part and the table + } + + + /// + /// Draw table (on the 1st, as well as on the 2nd page) + /// + float belowTop; + TableStyle style; + Table table; + switch (cfg.Form) + { + default: + case TableForm.Rows: + + style = new TableStyle + { + Font = font, + HeaderFont = headerFont, + MarginX = 5, + MarginY = 3, + LineWidth = 1, + TopHeadersCount = 1, + HorizLines = TableLines.All, + VertLines = TableLines.All + }; + table = Table.Create_TestsAreRows(wm, (pageNr == 1) ? testItems : testItems2, style, cfg.AutoTestParam); + break; + + case TableForm.Columns: + + style = new TableStyle + { + Font = font, + HeaderFont = headerFont, + MarginX = 5, + MarginY = 3, + LineWidth = 1, + LeftHeadersCount = 1, + HorizLines = TableLines.FirstSecondAndLast, + VertLines = TableLines.All + }; + table = Table.Create_TestsAreColumns(wm, (pageNr == 1) ? testItems : testItems2, style); + break; + + case TableForm.ColumnsPL: + + style = new TableStyle + { + Font = font, + HeaderFont = headerFont, + MarginX = 5, + MarginY = 3, + LineWidth = 1, + TopHeadersCount = 1, + HorizLines = TableLines.FirstSecondAndLast, + VertLines = TableLines.All + }; + table = Table.Create_TestsAreColumnsPL(wm, (pageNr == 1) ? testItems : testItems2, style, cfg.AutoTestParam); + break; + } + + SizeF size = table.Measure(e); + float tableLeft = (float)leftMargin + ((float)printWidth - size.Width) / 2; + belowTop = table.Draw(e, tableLeft, tableTop); + + if (pageNr == nrPages) + { + ///---------------- + /// Common items + ///---------------- + belowTop += spacingOne4Header; /// Space between the table and the bottom common part + float leftMarginBelow1 = leftMargin + printWidth * 0.01f * cfg.BelowW0Pct; + float leftMarginBelow2 = leftMargin + printWidth * 0.01f * (cfg.BelowW0Pct + cfg.BelowW1Pct); + float leftMarginBelow3 = leftMargin + printWidth * 0.01f * (cfg.BelowW0Pct + cfg.BelowW1Pct + cfg.BelowW2Pct); + + Alignment[] horizAlgn = new Alignment[] { Alignment.Left, Alignment.Left }; + VertAlignment[] vertAlgn = new VertAlignment[] { VertAlignment.Top, VertAlignment.Top }; + TableStyle commonTableStyle = new TableStyle { Font = font, MarginX = 5, MarginY = 3 }; + + Table table2 = new Table(2, cfg.AutoTestParam) { Style = commonTableStyle }; + foreach (var item in belowItems1) + { + string[] row = new string[] { item.Caption, item.Print(wm).Split(new char[] { '|' })[0] }; + table2.AddRow(row, horizAlgn, vertAlgn); + } + table2.Draw(e, leftMarginBelow1, belowTop); + + + table2 = new Table(2, cfg.AutoTestParam) { Style = commonTableStyle }; + foreach (var item in belowItems2) + { + string[] row = new string[] { item.Caption, item.Print(wm).Split(new char[] { '|' })[0] }; + table2.AddRow(row, horizAlgn, vertAlgn); + } + table2.Draw(e, leftMarginBelow2, belowTop); + + + table2 = new Table(2, cfg.AutoTestParam) { Style = commonTableStyle }; + foreach (var item in belowItems3) + { + string[] row = new string[] { item.Caption, item.Print(wm).Split(new char[] { '|' })[0] }; + table2.AddRow(row, horizAlgn, vertAlgn); + } + table2.Draw(e, leftMarginBelow3, belowTop); + + + /// + /// Footer on the last page + /// + float footerWidth = e.Graphics.MeasureString(footer, footerFont).Width; + PrintAt(e, footer, footerFont, leftMargin, topMargin + printHeight - 2 * spacingOne, 0, 0, Alignment.Left, VertAlignment.Top); + } + + /// + /// Page number on each page + /// + string pageNrText = string.Format("{0} {1}/{2}", Strings.Page, pageNr, nrPages); + float pageNrWidth = e.Graphics.MeasureString(pageNrText, font).Width; + PrintAt(e, pageNrText, font, leftMargin + (printWidth - pageNrWidth) / 2, topMargin + printHeight - spacingOne, 0, 0, Alignment.Left, VertAlignment.Top); + + e.HasMorePages = !(pageNr == nrPages); + + pageNr++; + } + } +} diff --git a/Results/Output/Printers/OnePerBatch/OnePerBatchPrinterCfg.cs b/Results/Output/Printers/OnePerBatch/OnePerBatchPrinterCfg.cs new file mode 100644 index 000000000..f4eeb7fc2 --- /dev/null +++ b/Results/Output/Printers/OnePerBatch/OnePerBatchPrinterCfg.cs @@ -0,0 +1,59 @@ +/// +/// Copyright (c) 2020 Sensus Slovensko a.s. +/// + +namespace Results.Output.Printers.OnePerBatch +{ + public class OnePerBatchPrinterCfg + { + public string AutoTestParam; + public Config.Entities.PageOrientation PageOrientation; + public string Template; + 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 string FooterFntFml; + public int FooterFntSz; + public int FooterFntSty; + public bool GoodOnly; + public bool SupressPrinting; /// Bypass printing when true + public System.Globalization.CultureInfo CultureInfo; + public string Header; /// =Title + public int ColW0Pct; + public int ColW1Pct; + public int ColW2Pct; + public string[] CommonItems1; + public string[] CommonItems2; + public string[] CommonItems3; + public Config.Entities.TableForm Form; + public string[] TestItems; + public Config.Entities.TableForm Form2; + public string[] TestItems2; + public int BelowW0Pct; + public int BelowW1Pct; + public int BelowW2Pct; + public string[] BelowItems1; + public string[] BelowItems2; + public string[] BelowItems3; + public string Footer; + public bool TestsAreRows; + public int GraphLeft; + public int GraphTop; + public int GraphWid; + public int GraphHgh; + public int ImgLeft; + public int ImgTop; + public int ImgWid; + public int ImgHgh; + public string ImgFullPathName; + } +} diff --git a/Results/Output/Table.cs b/Results/Output/Table.cs index f5fd7776d..2d825e868 100644 --- a/Results/Output/Table.cs +++ b/Results/Output/Table.cs @@ -34,6 +34,7 @@ namespace Results.Output public class Table { public readonly int ColumnsCount; + public readonly string AutoTestParam; public int RowsCount { get { return Rows.Count; } } public readonly IList Rows; @@ -42,9 +43,10 @@ namespace Results.Output public TableStyle Style; - public Table(int columnsCount) + public Table(int columnsCount, string autoTestParam = null) { - ColumnsCount = columnsCount; + this.ColumnsCount = columnsCount; + this.AutoTestParam = autoTestParam; Rows = new List(); HorizAlignments = new List(); @@ -260,7 +262,7 @@ namespace Results.Output } - public static Table Create_TestsAreRows(Results.Entities.WaterMeter wm, IList items, TableStyle style) + public static Table Create_TestsAreRows(Results.Entities.WaterMeter wm, IList items, TableStyle style, string autoTestParam = null) { /// Top row contains column captions @@ -279,7 +281,7 @@ namespace Results.Output table.AddRow(tableHeader, horizAlignment, vertAlignment); WMeterRsltItemSpec.TableRowNr = 1; - foreach (var mtr in wm.MeterTestRslts) + foreach (var mtr in string.IsNullOrEmpty(autoTestParam) ? wm.RegularMeterTestRslts() : wm.AutoMeterTestRslts(autoTestParam)) { if (mtr != null && mtr.IsPilotRslt() && mtr.Publish() == Config.Entities.Publish.Always) { @@ -305,7 +307,7 @@ namespace Results.Output } - public static Table Create_TestsAreColumns(Results.Entities.WaterMeter wm, IList items, TableStyle style) + public static Table Create_TestsAreColumns(Results.Entities.WaterMeter wm, IList items, TableStyle style, string autoTestParam = null) { /// Left column contains row captions @@ -313,7 +315,7 @@ namespace Results.Output /// Calculate columns count /// int columnsCount = 1; /// Left column contains item caption - foreach (var mtr in wm.MeterTestRslts) + foreach (var mtr in string.IsNullOrEmpty(autoTestParam) ? wm.RegularMeterTestRslts() : wm.AutoMeterTestRslts(autoTestParam)) { if (mtr != null && mtr.IsPilotRslt() && mtr.Publish() == Config.Entities.Publish.Always) { @@ -339,7 +341,7 @@ namespace Results.Output vertAlignment[0] = VertAlignment.Middle; WMeterRsltItemSpec.TableColumnNr = 1; - foreach (var mtr in wm.MeterTestRslts) + foreach (var mtr in string.IsNullOrEmpty(autoTestParam) ? wm.RegularMeterTestRslts() : wm.AutoMeterTestRslts(autoTestParam)) { if (mtr != null && mtr.IsPilotRslt() && mtr.Publish() == Config.Entities.Publish.Always) { @@ -362,7 +364,7 @@ namespace Results.Output } - public static Table Create_TestsAreColumnsPL(Results.Entities.WaterMeter wm, IList items, TableStyle style) + public static Table Create_TestsAreColumnsPL(Results.Entities.WaterMeter wm, IList items, TableStyle style, string autoTestParam = null) { /// Left column contains row captions @@ -370,7 +372,7 @@ namespace Results.Output /// Calculate columns count /// int columnsCount = 2; /// Left two columns contain item caption and units - foreach (var mtr in wm.MeterTestRslts) + foreach (var mtr in string.IsNullOrEmpty(autoTestParam) ? wm.RegularMeterTestRslts() : wm.AutoMeterTestRslts(autoTestParam)) { if (mtr != null && mtr.IsPilotRslt() && mtr.Publish() == Config.Entities.Publish.Always) { @@ -406,7 +408,7 @@ namespace Results.Output vertAlignment[1] = VertAlignment.Middle; WMeterRsltItemSpec.TableColumnNr = 1; - foreach (var mtr in wm.MeterTestRslts) + foreach (var mtr in string.IsNullOrEmpty(autoTestParam) ? wm.RegularMeterTestRslts() : wm.AutoMeterTestRslts(autoTestParam)) { if (mtr != null && mtr.IsPilotRslt() && mtr.Publish() == Config.Entities.Publish.Always) { diff --git a/Results/Output/WMChart.cs b/Results/Output/WMChart.cs index 577db1b61..f55fdcd71 100644 --- a/Results/Output/WMChart.cs +++ b/Results/Output/WMChart.cs @@ -20,7 +20,7 @@ namespace Results.Output { double maxFlow_m3h = 0; IList unsortedPoints = new List(); - foreach (var mtr in wm.MeterTestRslts) + foreach (var mtr in wm.RegularMeterTestRslts()) { if (mtr.IsPilotRslt() && mtr.TestRslt.TestData.Evaluate && (mtr.TestRslt.TestTime > 0) && (mtr.TestRslt.PulsesMaster > 0)) { diff --git a/Results/Results.csproj b/Results/Results.csproj index c91895ee7..528176af2 100644 --- a/Results/Results.csproj +++ b/Results/Results.csproj @@ -159,6 +159,10 @@ Component + + Component + + Component diff --git a/TBF/BenchControl/Output/DB/SensusOracle/Database.cs b/TBF/BenchControl/Output/DB/SensusOracle/Database.cs index 29d930794..4655e6723 100644 --- a/TBF/BenchControl/Output/DB/SensusOracle/Database.cs +++ b/TBF/BenchControl/Output/DB/SensusOracle/Database.cs @@ -369,7 +369,7 @@ namespace TBF.BenchControl.Output.DB.SensusOracle /// Prepare a procedure signature to distinguish between different procedures with the same wmTypeId IList wmTestNames = new List(); StringBuilder procedureSignatureSB = new StringBuilder(); - foreach (var mtr in wm.MeterTestRslts) + foreach (var mtr in wm.RegularMeterTestRslts()) { wmTestNames.Add(mtr.Name()); procedureSignatureSB.Append(mtr.Name()); @@ -745,7 +745,7 @@ namespace TBF.BenchControl.Output.DB.SensusOracle { IList wmTestNames = new List(); StringBuilder procedureSignatureSB = new StringBuilder(); - foreach (var tr in b.TestRslts) + foreach (var tr in b.RegularTestRslts()) { wmTestNames.Add(tr.Name()); procedureSignatureSB.Append(tr.Name()); diff --git a/TBF/BenchControl/Output/FileWriters/Elde/Writer.cs b/TBF/BenchControl/Output/FileWriters/Elde/Writer.cs index f77d37c4e..38e1b8b32 100644 --- a/TBF/BenchControl/Output/FileWriters/Elde/Writer.cs +++ b/TBF/BenchControl/Output/FileWriters/Elde/Writer.cs @@ -351,7 +351,7 @@ namespace TBF.BenchControl.Output.FileWriters.Elde int emptyTestsLeft = 5; int[] widths = new int[] { 11, 5, 6, 9, 12, 12, 8, 11, 10, 15, 8, 1 }; /// Widths of columns - foreach (var testRslt in batch.TestRslts) + foreach (var testRslt in batch.RegularTestRslts()) { if (testRslt.Publish() == Config.Entities.Publish.Always) { @@ -377,7 +377,7 @@ namespace TBF.BenchControl.Output.FileWriters.Elde wrtr.Write(" "); for (int i = 0; i < 3; i++) { - foreach (var testRslt in batch.TestRslts) + foreach (var testRslt in batch.RegularTestRslts()) { if (testRslt.Publish() == Config.Entities.Publish.Always) { @@ -404,7 +404,7 @@ namespace TBF.BenchControl.Output.FileWriters.Elde for (int j = 0; j < Math.Max(1, 14 - toPrint.Length); j++) wrtr.Write(' '); /// Volume start - foreach (var mtr in wm.MeterTestRslts) + foreach (var mtr in wm.RegularMeterTestRslts()) { if (mtr.Publish() == Config.Entities.Publish.Always) { @@ -415,7 +415,7 @@ namespace TBF.BenchControl.Output.FileWriters.Elde for (int k = 0; k < emptyTestsLeft; k++) wrtr.Write(" "); /// Volume end - foreach (var mtr in wm.MeterTestRslts) + foreach (var mtr in wm.RegularMeterTestRslts()) { if (mtr.Publish() == Config.Entities.Publish.Always) { @@ -426,7 +426,7 @@ namespace TBF.BenchControl.Output.FileWriters.Elde for (int k = 0; k < emptyTestsLeft; k++) wrtr.Write(" "); /// Error - foreach (var mtr in wm.MeterTestRslts) + foreach (var mtr in wm.RegularMeterTestRslts()) { if (mtr.Publish() == Config.Entities.Publish.Always) { diff --git a/TBF/BenchControl/Output/FileWriters/Enhanced/Writer.cs b/TBF/BenchControl/Output/FileWriters/Enhanced/Writer.cs index c854a7e53..7c33d6df5 100644 --- a/TBF/BenchControl/Output/FileWriters/Enhanced/Writer.cs +++ b/TBF/BenchControl/Output/FileWriters/Enhanced/Writer.cs @@ -365,7 +365,7 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced if (abort) return; columnWidths[i] = ElSpaces(testItems[i].Caption).Length; - foreach (var mtr in wm.MeterTestRslts) + foreach (var mtr in wm.RegularMeterTestRslts()) { if ((mtr != null) && (mtr.Publish() == Config.Entities.Publish.Always)) { @@ -420,7 +420,7 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced /// Write table data int rowsCount = 0; - foreach (var mtr in wm.MeterTestRslts) + foreach (var mtr in wm.RegularMeterTestRslts()) { if (abort) return; diff --git a/TBF/BenchControl/Output/FileWriters/OneFilePerMeter/Writer.cs b/TBF/BenchControl/Output/FileWriters/OneFilePerMeter/Writer.cs index b88ac14eb..40c109350 100644 --- a/TBF/BenchControl/Output/FileWriters/OneFilePerMeter/Writer.cs +++ b/TBF/BenchControl/Output/FileWriters/OneFilePerMeter/Writer.cs @@ -355,7 +355,7 @@ namespace TBF.BenchControl.Output.FileWriters.OneFilePerMeter if (abort) return; columnWidths[i] = ElSpaces(testItems[i].Caption).Length; - foreach (var mtr in wm.MeterTestRslts) + foreach (var mtr in wm.RegularMeterTestRslts()) { if ((mtr != null) && (mtr.Publish() == Config.Entities.Publish.Always)) { @@ -403,7 +403,7 @@ namespace TBF.BenchControl.Output.FileWriters.OneFilePerMeter wr.WriteLine(horizontalLine); /// Horizontal line between the header and the body /// Write table data - foreach (var mtr in wm.MeterTestRslts) + foreach (var mtr in wm.RegularMeterTestRslts()) { if (abort) return; diff --git a/TBF/BenchControl/Output/FileWriters/Xml/Writer.cs b/TBF/BenchControl/Output/FileWriters/Xml/Writer.cs index d7e53b683..b64050a38 100644 --- a/TBF/BenchControl/Output/FileWriters/Xml/Writer.cs +++ b/TBF/BenchControl/Output/FileWriters/Xml/Writer.cs @@ -265,7 +265,7 @@ namespace TBF.BenchControl.Output.FileWriters.Xml } /// Test items - foreach (var mtr in wm.MeterTestRslts) + foreach (var mtr in wm.RegularMeterTestRslts()) { if (abort) return; diff --git a/TBF/BenchControl/Output/FileWriters/XmlBatch/Writer.cs b/TBF/BenchControl/Output/FileWriters/XmlBatch/Writer.cs index 43f51600c..677e3b88a 100644 --- a/TBF/BenchControl/Output/FileWriters/XmlBatch/Writer.cs +++ b/TBF/BenchControl/Output/FileWriters/XmlBatch/Writer.cs @@ -286,7 +286,7 @@ namespace TBF.BenchControl.Output.FileWriters.XmlBatch } /// Test items - foreach (var mtr in wm.MeterTestRslts) + foreach (var mtr in wm.RegularMeterTestRslts()) { if (abort) return; diff --git a/TBF/BenchControl/Output/Printers/OnePerBatch/Factory.cs b/TBF/BenchControl/Output/Printers/OnePerBatch/Factory.cs new file mode 100644 index 000000000..e816a48e3 --- /dev/null +++ b/TBF/BenchControl/Output/Printers/OnePerBatch/Factory.cs @@ -0,0 +1,26 @@ +/// +/// Copyright (c) 2020 Sensus Slovensko a.s. +/// +using System.Collections.Generic; +using TBF.BenchControl.Generic; + +namespace TBF.BenchControl.Output.Printers.OnePerBatch +{ + public class Factory : IComponentFactory + { + public string ClassName { get { return this.GetType().Namespace.Substring(17); } } + + 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(this.GetType().Namespace.Substring(24), this, Config.Entities.MetersKind.Single); } + + public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component) + { + return ComponentCfgBase.CreateFromDbEntity(PrinterCfg.Serializer, component, this); + } + } +} diff --git a/TBF/BenchControl/Output/Printers/OnePerBatch/Printer.cs b/TBF/BenchControl/Output/Printers/OnePerBatch/Printer.cs new file mode 100644 index 000000000..18952e517 --- /dev/null +++ b/TBF/BenchControl/Output/Printers/OnePerBatch/Printer.cs @@ -0,0 +1,250 @@ +/// +/// Copyright (c) 2020 Sensus Slovensko a.s. +/// +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using Results.Entities; +using Results.Output.Printers.OnePerBatch; +using log4net; + +namespace TBF.BenchControl.Output.Printers.OnePerBatch +{ + public class Printer : ComponentBase, IOperation, GenericDevices.IResultsPrinter + { + private static readonly ILog log = LogManager.GetLogger(typeof(Printer)); + public override string ToString() { return string.Format("Output.Printers.OnePerMeter({0})", Cfg.ToString(1)); } + + readonly PrinterCfg printerCfg; + + public bool SupressPrinting { get { return printerCfg.SupressPrinting; } } + + /// Data to print + Batch batch; + + /// + /// Items to print + /// + string header; + IList commonItems; + IList testItems; + string footer; + + + 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.AutoTestParam = newCfg.AutoTestParam; + printerCfg.PageOrientation = newCfg.PageOrientation; + printerCfg.Template = newCfg.Template; + 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.FooterFntFml = newCfg.FooterFntFml; + printerCfg.FooterFntSz = newCfg.FooterFntSz; + printerCfg.FooterFntSty = newCfg.FooterFntSty; + + printerCfg.GoodOnly = newCfg.GoodOnly; + printerCfg.SupressPrinting = newCfg.SupressPrinting; + printerCfg.Culture = newCfg.Culture; + printerCfg.Header = newCfg.Header; + printerCfg.ColW0Pct = newCfg.ColW0Pct; + printerCfg.ColW1Pct = newCfg.ColW1Pct; + printerCfg.ColW2Pct = newCfg.ColW2Pct; + printerCfg.CommonItems1 = newCfg.CommonItems1; + printerCfg.CommonItems2 = newCfg.CommonItems2; + printerCfg.CommonItems3 = newCfg.CommonItems3; + printerCfg.Form = newCfg.Form; + printerCfg.SelectedItems = newCfg.SelectedItems; + printerCfg.SelectedItems2 = newCfg.SelectedItems2; + printerCfg.BelowW0Pct = newCfg.BelowW0Pct; + printerCfg.BelowW1Pct = newCfg.BelowW1Pct; + printerCfg.BelowW2Pct = newCfg.BelowW2Pct; + printerCfg.BelowItems1 = newCfg.BelowItems1; + printerCfg.BelowItems2 = newCfg.BelowItems2; + printerCfg.BelowItems3 = newCfg.BelowItems3; + printerCfg.Footer = newCfg.Footer; + printerCfg.TestsAreRows = newCfg.TestsAreRows; + printerCfg.GraphLeft = newCfg.GraphLeft; + printerCfg.GraphTop = newCfg.GraphTop; + printerCfg.GraphWid = newCfg.GraphWid; + printerCfg.GraphHgh = newCfg.GraphHgh; + printerCfg.ImgLeft = newCfg.ImgLeft; + printerCfg.ImgTop = newCfg.ImgTop; + printerCfg.ImgWid = newCfg.ImgWid; + printerCfg.ImgHgh = newCfg.ImgHgh; + printerCfg.ImgName = newCfg.ImgName; + printerCfg.DocName = newCfg.DocName; + + ApplyConfig(); + } + } + }; + } + + #endregion Configuration Change Handling + + + /// + /// Prints the test cycle results, Events: Event.ResultsPrinted + /// + /// Batch results to print + /// Reference to the operation + public IOperation ProcessResultsOp(Batch batch) + { + this.batch = batch; + return this; + } + + /// Start this operation + public void Start() + { + CultureInfo oriCulture = Thread.CurrentThread.CurrentCulture; + + if (printerCfg.Culture != Culture.system) + { + Thread.CurrentThread.CurrentCulture = new CultureInfo(printerCfg.Culture.ToString()); + } + + foreach (var wm in batch.WaterMeters) + { + if (wm != null && !wm.Disabled && (!printerCfg.GoodOnly || wm.Passed)) + { + string documentName; + try + { + if (string.IsNullOrEmpty(printerCfg.DocName)) throw (new Exception()); + documentName = string.Format(printerCfg.DocName, wm.StartTime(), wm.EndTime(), wm.BatchNr(), wm.WMPosition, wm.SerialNr); + } + catch + { + documentName = string.Format("{0}-{1}", batch.BatchNr, wm.WMPosition); + } + + PrintResults(batch, wm, documentName); + break; + } + } + + Thread.CurrentThread.CurrentCulture = oriCulture; + } + + /// Run this operation + /// Event.ResultsPrinted + public Event Run() + { + return Event.ResultsPrinted; + } + + /// Stop this operation + public void Stop() + { + } + + + void PrintResults(Batch batch, WaterMeter wm, string documentName) + { + OnePerBatchPrinterCfg cfg = new OnePerBatchPrinterCfg + { + AutoTestParam = printerCfg.AutoTestParam, + PageOrientation = printerCfg.PageOrientation, + Template = printerCfg.Template, + TopMargin = printerCfg.TopMargin, + BottomMargin = printerCfg.BottomMargin, + LeftMargin = printerCfg.LeftMargin, + TitFntFml = printerCfg.TitFntFml, + TitFntSz = printerCfg.TitFntSz, + TitFntSty = printerCfg.TitFntSty, + HdrFntFml = printerCfg.HdrFntFml, + HdrFntSz = printerCfg.HdrFntSz, + HdrFntSty = printerCfg.HdrFntSty, + BodyFntFml = printerCfg.BodyFntFml, + BodyFntSz = printerCfg.BodyFntSz, + BodyFntSty = printerCfg.BodyFntSty, + FooterFntFml = printerCfg.FooterFntFml, + FooterFntSz = printerCfg.FooterFntSz, + FooterFntSty = printerCfg.FooterFntSty, + GoodOnly = printerCfg.GoodOnly, + SupressPrinting = printerCfg.SupressPrinting, + CultureInfo = (printerCfg.Culture == Culture.system) ? Thread.CurrentThread.CurrentCulture : new CultureInfo(printerCfg.Culture.ToString()), + Header = printerCfg.Header, + ColW0Pct = printerCfg.ColW0Pct, + ColW1Pct = printerCfg.ColW1Pct, + ColW2Pct = printerCfg.ColW2Pct, + CommonItems1 = printerCfg.CommonItems1, + CommonItems2 = printerCfg.CommonItems2, + CommonItems3 = printerCfg.CommonItems3, + Form = printerCfg.Form, + TestItems = printerCfg.SelectedItems, + TestItems2 = printerCfg.SelectedItems2, + BelowW0Pct = printerCfg.BelowW0Pct, + BelowW1Pct = printerCfg.BelowW1Pct, + BelowW2Pct = printerCfg.BelowW2Pct, + BelowItems1 = printerCfg.BelowItems1, + BelowItems2 = printerCfg.BelowItems2, + BelowItems3 = printerCfg.BelowItems3, + Footer = printerCfg.Footer, + TestsAreRows = printerCfg.TestsAreRows, + GraphLeft = printerCfg.GraphLeft, + GraphTop = printerCfg.GraphTop, + GraphWid = printerCfg.GraphWid, + GraphHgh = printerCfg.GraphHgh, + ImgLeft = printerCfg.ImgLeft, + ImgTop = printerCfg.ImgTop, + ImgWid = printerCfg.ImgWid, + ImgHgh = printerCfg.ImgHgh, + ImgFullPathName = (wm.ArchivePath != null) ? System.IO.Path.Combine(wm.ArchivePath, printerCfg.ImgName) : null, + }; + + new OnePerBatchPrintDocument(batch, cfg, wm, documentName).Print(); + } + } +} diff --git a/TBF/BenchControl/Output/Printers/OnePerBatch/PrinterCfg.cs b/TBF/BenchControl/Output/Printers/OnePerBatch/PrinterCfg.cs new file mode 100644 index 000000000..139fecbfc --- /dev/null +++ b/TBF/BenchControl/Output/Printers/OnePerBatch/PrinterCfg.cs @@ -0,0 +1,128 @@ +/// +/// Copyright (c) 2020 Sensus Slovensko a.s. +/// +using System.Xml.Serialization; +using Config.Entities; +using TBF.BenchControl.Generic; + +namespace TBF.BenchControl.Output.Printers.OnePerBatch +{ + public class PrinterCfg : ComponentCfgBase, Generic.IComponentCfg + { + public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(PrinterCfg) })[0]; + public override XmlSerializer GetSerializer() { return Serializer; } + + public IComponentCfgCtrl GetControl() { return new PrinterCfgCtrl(); } + + /// + /// Serialized parameters + /// + public string AutoTestParam; + public PageOrientation PageOrientation; + public string Template; + public int TopMargin; + public int BottomMargin; + public int LeftMargin; + public string TitFntFml; + public string HdrFntFml; + public string BodyFntFml; + public string FooterFntFml; + public int TitFntSz; + public int HdrFntSz; + public int BodyFntSz; + public int FooterFntSz; + public int TitFntSty; + public int HdrFntSty; + public int BodyFntSty; + public int FooterFntSty; + public bool GoodOnly; + public bool SupressPrinting; /// Bypass printing when true + public Culture Culture; + public string Header; /// =Title + + public int ColW0Pct; + public string[] CommonItems1; + public int ColW1Pct; + public string[] CommonItems2; + public int ColW2Pct; + public string[] CommonItems3; + + public TableForm Form; + public string[] SelectedItems; + public string[] SelectedItems2; + + public int BelowW0Pct; + public string[] BelowItems1; + public int BelowW1Pct; + public string[] BelowItems2; + public int BelowW2Pct; + public string[] BelowItems3; + + public string Footer; + public bool TestsAreRows; /// true = Tests are rows + public int GraphLeft; + public int GraphTop; + public int GraphWid; + public int GraphHgh; + public int ImgLeft; + public int ImgTop; + public int ImgWid; + public int ImgHgh; + public string ImgName; + public string DocName; + + [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; + AutoTestParam = string.Empty; + Template = string.Empty; + PageOrientation = PageOrientation.Portrait; + TopMargin = 100; + BottomMargin = 100; + LeftMargin = 100; + TitFntFml = "Arial"; + TitFntSz = 18; + TitFntSty = 1; + HdrFntFml = "Arial"; + HdrFntSz = 10; + HdrFntSty = 0; + BodyFntFml = "Arial"; + BodyFntSz = 10; + BodyFntSty = 0; + FooterFntFml = "Arial"; + FooterFntSz = 10; + FooterFntSty = 0; + GoodOnly = false; + SupressPrinting = false; + Header = string.Empty; + Footer = string.Empty; + DocName = string.Empty; + ImgName = 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/TBF/BenchControl/Output/Printers/OnePerBatch/PrinterCfgCtrl.Designer.cs b/TBF/BenchControl/Output/Printers/OnePerBatch/PrinterCfgCtrl.Designer.cs new file mode 100644 index 000000000..78d52ad30 --- /dev/null +++ b/TBF/BenchControl/Output/Printers/OnePerBatch/PrinterCfgCtrl.Designer.cs @@ -0,0 +1,995 @@ +/// +/// Copyright (c) 2020 Sensus Slovensko a.s. +/// +namespace TBF.BenchControl.Output.Printers.OnePerBatch +{ + 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.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.testItems2Button = new System.Windows.Forms.Button(); + this.goodOnlyCheckBox = new System.Windows.Forms.CheckBox(); + this.templateTextBox = new System.Windows.Forms.TextBox(); + this.templateLabel = new System.Windows.Forms.Label(); + this.docNameLabel = new System.Windows.Forms.Label(); + this.docNameTextBox = new System.Windows.Forms.TextBox(); + this.footerItalicCheckBox = new System.Windows.Forms.CheckBox(); + this.footerBoldCheckBox = new System.Windows.Forms.CheckBox(); + this.footerFontSizeTextBox = new System.Windows.Forms.TextBox(); + this.footerFontFamilyComboBox = new System.Windows.Forms.ComboBox(); + this.footerFontLabel = new System.Windows.Forms.Label(); + this.imageNameTextBox = new System.Windows.Forms.TextBox(); + this.imageLeftTextBox = new System.Windows.Forms.TextBox(); + this.imageTopTextBox = new System.Windows.Forms.TextBox(); + this.imageWidthTextBox = new System.Windows.Forms.TextBox(); + this.imageHeightTextBox = new System.Windows.Forms.TextBox(); + this.label4 = new System.Windows.Forms.Label(); + this.label8 = new System.Windows.Forms.Label(); + this.label6 = new System.Windows.Forms.Label(); + this.colW0TextBox = new System.Windows.Forms.TextBox(); + this.label5 = new System.Windows.Forms.Label(); + this.label7 = new System.Windows.Forms.Label(); + this.label9 = new System.Windows.Forms.Label(); + this.colW2TextBox = new System.Windows.Forms.TextBox(); + this.colW1TextBox = new System.Windows.Forms.TextBox(); + this.commonItems3Button = new System.Windows.Forms.Button(); + this.commonItems2Button = new System.Windows.Forms.Button(); + this.commonItems1Button = new System.Windows.Forms.Button(); + this.label10 = new System.Windows.Forms.Label(); + this.belowW0TextBox = new System.Windows.Forms.TextBox(); + this.label11 = new System.Windows.Forms.Label(); + this.label12 = new System.Windows.Forms.Label(); + this.label13 = new System.Windows.Forms.Label(); + this.belowW2TextBox = new System.Windows.Forms.TextBox(); + this.belowW1TextBox = new System.Windows.Forms.TextBox(); + this.belowItems3Button = new System.Windows.Forms.Button(); + this.belowItems2Button = new System.Windows.Forms.Button(); + this.belowItems1Button = new System.Windows.Forms.Button(); + this.table1FormComboBox = new System.Windows.Forms.ComboBox(); + this.label3 = new System.Windows.Forms.Label(); + this.graphHeightTextBox = new System.Windows.Forms.TextBox(); + this.graphWidthTextBox = new System.Windows.Forms.TextBox(); + this.graphTopTextBox = new System.Windows.Forms.TextBox(); + this.graphLeftTextBox = new System.Windows.Forms.TextBox(); + this.label14 = new System.Windows.Forms.Label(); + this.autoTestParamTextBox = new System.Windows.Forms.TextBox(); + this.SuspendLayout(); + // + // nameTextBox + // + this.nameTextBox.Enabled = false; + this.nameTextBox.Location = new System.Drawing.Point(142, 22); + this.nameTextBox.Name = "nameTextBox"; + this.nameTextBox.Size = new System.Drawing.Size(146, 20); + this.nameTextBox.TabIndex = 2; + // + // nameLabel + // + this.nameLabel.AutoSize = true; + this.nameLabel.Location = new System.Drawing.Point(16, 25); + 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, 5); + 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(334, 51); + this.supressPrintingCheckBox.Name = "supressPrintingCheckBox"; + this.supressPrintingCheckBox.Size = new System.Drawing.Size(101, 17); + this.supressPrintingCheckBox.TabIndex = 33; + 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 = 5; + 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(146, 21); + this.orientationComboBox.TabIndex = 6; + // + // topMarginTextBox + // + this.topMarginTextBox.Enabled = false; + this.topMarginTextBox.Location = new System.Drawing.Point(142, 86); + this.topMarginTextBox.Name = "topMarginTextBox"; + this.topMarginTextBox.Size = new System.Drawing.Size(44, 20); + this.topMarginTextBox.TabIndex = 8; + // + // topMarginLabel + // + this.topMarginLabel.AutoSize = true; + this.topMarginLabel.Location = new System.Drawing.Point(16, 88); + this.topMarginLabel.Name = "topMarginLabel"; + this.topMarginLabel.Size = new System.Drawing.Size(116, 13); + this.topMarginLabel.TabIndex = 7; + this.topMarginLabel.Text = "Top/bottom/left margin"; + // + // leftMarginTextBox + // + this.leftMarginTextBox.Enabled = false; + this.leftMarginTextBox.Location = new System.Drawing.Point(244, 86); + this.leftMarginTextBox.Name = "leftMarginTextBox"; + this.leftMarginTextBox.Size = new System.Drawing.Size(44, 20); + this.leftMarginTextBox.TabIndex = 10; + // + // bottomMarginTextBox + // + this.bottomMarginTextBox.Enabled = false; + this.bottomMarginTextBox.Location = new System.Drawing.Point(193, 86); + this.bottomMarginTextBox.Name = "bottomMarginTextBox"; + this.bottomMarginTextBox.Size = new System.Drawing.Size(44, 20); + this.bottomMarginTextBox.TabIndex = 9; + // + // cultureComboBox + // + this.cultureComboBox.Enabled = false; + this.cultureComboBox.FormattingEnabled = true; + this.cultureComboBox.Location = new System.Drawing.Point(142, 192); + this.cultureComboBox.Name = "cultureComboBox"; + this.cultureComboBox.Size = new System.Drawing.Size(110, 21); + this.cultureComboBox.TabIndex = 32; + // + // cultureLabel + // + this.cultureLabel.AutoSize = true; + this.cultureLabel.Location = new System.Drawing.Point(16, 197); + this.cultureLabel.Name = "cultureLabel"; + this.cultureLabel.Size = new System.Drawing.Size(42, 13); + this.cultureLabel.TabIndex = 31; + this.cultureLabel.Text = "Cullture"; + // + // footerButton + // + this.footerButton.Enabled = false; + this.footerButton.Location = new System.Drawing.Point(291, 285); + this.footerButton.Name = "footerButton"; + this.footerButton.Size = new System.Drawing.Size(100, 20); + this.footerButton.TabIndex = 41; + 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(291, 190); + this.headerButton.Name = "headerButton"; + this.headerButton.Size = new System.Drawing.Size(100, 20); + this.headerButton.TabIndex = 37; + 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(291, 228); + this.testItemsButton.Name = "testItemsButton"; + this.testItemsButton.Size = new System.Drawing.Size(100, 20); + this.testItemsButton.TabIndex = 39; + this.testItemsButton.Text = "1st table"; + 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, 131); + this.headerFontLabel.Name = "headerFontLabel"; + this.headerFontLabel.Size = new System.Drawing.Size(112, 13); + this.headerFontLabel.TabIndex = 16; + this.headerFontLabel.Text = "Header font/size/style"; + // + // titleFontLabel + // + this.titleFontLabel.AutoSize = true; + this.titleFontLabel.Location = new System.Drawing.Point(16, 110); + this.titleFontLabel.Name = "titleFontLabel"; + this.titleFontLabel.Size = new System.Drawing.Size(97, 13); + this.titleFontLabel.TabIndex = 11; + this.titleFontLabel.Text = "Title font/size/style"; + // + // titleFontFamilyComboBox + // + this.titleFontFamilyComboBox.Enabled = false; + this.titleFontFamilyComboBox.FormattingEnabled = true; + this.titleFontFamilyComboBox.Location = new System.Drawing.Point(142, 107); + this.titleFontFamilyComboBox.Name = "titleFontFamilyComboBox"; + this.titleFontFamilyComboBox.Size = new System.Drawing.Size(110, 21); + this.titleFontFamilyComboBox.TabIndex = 12; + // + // headerFontFamilyComboBox + // + this.headerFontFamilyComboBox.Enabled = false; + this.headerFontFamilyComboBox.FormattingEnabled = true; + this.headerFontFamilyComboBox.Location = new System.Drawing.Point(142, 128); + this.headerFontFamilyComboBox.Name = "headerFontFamilyComboBox"; + this.headerFontFamilyComboBox.Size = new System.Drawing.Size(110, 21); + this.headerFontFamilyComboBox.TabIndex = 17; + // + // bodyFontFamilyComboBox + // + this.bodyFontFamilyComboBox.Enabled = false; + this.bodyFontFamilyComboBox.FormattingEnabled = true; + this.bodyFontFamilyComboBox.Location = new System.Drawing.Point(142, 149); + this.bodyFontFamilyComboBox.Name = "bodyFontFamilyComboBox"; + this.bodyFontFamilyComboBox.Size = new System.Drawing.Size(110, 21); + this.bodyFontFamilyComboBox.TabIndex = 22; + // + // bodyFontLabel + // + this.bodyFontLabel.AutoSize = true; + this.bodyFontLabel.Location = new System.Drawing.Point(16, 152); + this.bodyFontLabel.Name = "bodyFontLabel"; + this.bodyFontLabel.Size = new System.Drawing.Size(101, 13); + this.bodyFontLabel.TabIndex = 21; + this.bodyFontLabel.Text = "Body font/size/style"; + // + // titleFontSizeTextBox + // + this.titleFontSizeTextBox.Enabled = false; + this.titleFontSizeTextBox.Location = new System.Drawing.Point(258, 107); + this.titleFontSizeTextBox.Name = "titleFontSizeTextBox"; + this.titleFontSizeTextBox.Size = new System.Drawing.Size(30, 20); + this.titleFontSizeTextBox.TabIndex = 13; + // + // headerFontSizeTextBox + // + this.headerFontSizeTextBox.Enabled = false; + this.headerFontSizeTextBox.Location = new System.Drawing.Point(258, 128); + this.headerFontSizeTextBox.Name = "headerFontSizeTextBox"; + this.headerFontSizeTextBox.Size = new System.Drawing.Size(30, 20); + this.headerFontSizeTextBox.TabIndex = 18; + // + // bodyFontSizeTextBox + // + this.bodyFontSizeTextBox.Enabled = false; + this.bodyFontSizeTextBox.Location = new System.Drawing.Point(258, 149); + this.bodyFontSizeTextBox.Name = "bodyFontSizeTextBox"; + this.bodyFontSizeTextBox.Size = new System.Drawing.Size(30, 20); + this.bodyFontSizeTextBox.TabIndex = 23; + // + // titleBoldCheckBox + // + this.titleBoldCheckBox.AutoSize = true; + this.titleBoldCheckBox.Enabled = false; + this.titleBoldCheckBox.Location = new System.Drawing.Point(306, 110); + this.titleBoldCheckBox.Name = "titleBoldCheckBox"; + this.titleBoldCheckBox.Size = new System.Drawing.Size(15, 14); + this.titleBoldCheckBox.TabIndex = 14; + this.titleBoldCheckBox.UseVisualStyleBackColor = true; + // + // titleItalicCheckBox + // + this.titleItalicCheckBox.AutoSize = true; + this.titleItalicCheckBox.Enabled = false; + this.titleItalicCheckBox.Location = new System.Drawing.Point(334, 110); + this.titleItalicCheckBox.Name = "titleItalicCheckBox"; + this.titleItalicCheckBox.Size = new System.Drawing.Size(15, 14); + this.titleItalicCheckBox.TabIndex = 15; + this.titleItalicCheckBox.UseVisualStyleBackColor = true; + // + // headerItalicCheckBox + // + this.headerItalicCheckBox.AutoSize = true; + this.headerItalicCheckBox.Enabled = false; + this.headerItalicCheckBox.Location = new System.Drawing.Point(334, 131); + this.headerItalicCheckBox.Name = "headerItalicCheckBox"; + this.headerItalicCheckBox.Size = new System.Drawing.Size(15, 14); + this.headerItalicCheckBox.TabIndex = 20; + this.headerItalicCheckBox.UseVisualStyleBackColor = true; + // + // headerBoldCheckBox + // + this.headerBoldCheckBox.AutoSize = true; + this.headerBoldCheckBox.Enabled = false; + this.headerBoldCheckBox.Location = new System.Drawing.Point(306, 131); + this.headerBoldCheckBox.Name = "headerBoldCheckBox"; + this.headerBoldCheckBox.Size = new System.Drawing.Size(15, 14); + this.headerBoldCheckBox.TabIndex = 19; + this.headerBoldCheckBox.UseVisualStyleBackColor = true; + // + // bodyItalicCheckBox + // + this.bodyItalicCheckBox.AutoSize = true; + this.bodyItalicCheckBox.Enabled = false; + this.bodyItalicCheckBox.Location = new System.Drawing.Point(334, 152); + this.bodyItalicCheckBox.Name = "bodyItalicCheckBox"; + this.bodyItalicCheckBox.Size = new System.Drawing.Size(15, 14); + this.bodyItalicCheckBox.TabIndex = 25; + this.bodyItalicCheckBox.UseVisualStyleBackColor = true; + // + // bodyBoldCheckBox + // + this.bodyBoldCheckBox.AutoSize = true; + this.bodyBoldCheckBox.Enabled = false; + this.bodyBoldCheckBox.Location = new System.Drawing.Point(306, 152); + this.bodyBoldCheckBox.Name = "bodyBoldCheckBox"; + this.bodyBoldCheckBox.Size = new System.Drawing.Size(15, 14); + this.bodyBoldCheckBox.TabIndex = 24; + 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, 94); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(32, 13); + this.label1.TabIndex = 37; + 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, 94); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(24, 13); + this.label2.TabIndex = 38; + this.label2.Text = "Ital."; + // + // testItems2Button + // + this.testItems2Button.Enabled = false; + this.testItems2Button.Location = new System.Drawing.Point(291, 247); + this.testItems2Button.Name = "testItems2Button"; + this.testItems2Button.Size = new System.Drawing.Size(100, 20); + this.testItems2Button.TabIndex = 40; + this.testItems2Button.Text = "2nd table"; + this.testItems2Button.UseVisualStyleBackColor = true; + this.testItems2Button.Click += new System.EventHandler(this.testItems2Button_Click); + // + // goodOnlyCheckBox + // + this.goodOnlyCheckBox.AutoSize = true; + this.goodOnlyCheckBox.Enabled = false; + this.goodOnlyCheckBox.Location = new System.Drawing.Point(334, 69); + this.goodOnlyCheckBox.Name = "goodOnlyCheckBox"; + this.goodOnlyCheckBox.Size = new System.Drawing.Size(74, 17); + this.goodOnlyCheckBox.TabIndex = 34; + this.goodOnlyCheckBox.Text = "Good only"; + this.goodOnlyCheckBox.UseVisualStyleBackColor = true; + // + // templateTextBox + // + this.templateTextBox.Enabled = false; + this.templateTextBox.Location = new System.Drawing.Point(142, 43); + this.templateTextBox.Name = "templateTextBox"; + this.templateTextBox.Size = new System.Drawing.Size(146, 20); + this.templateTextBox.TabIndex = 4; + // + // templateLabel + // + this.templateLabel.AutoSize = true; + this.templateLabel.Location = new System.Drawing.Point(16, 46); + this.templateLabel.Name = "templateLabel"; + this.templateLabel.Size = new System.Drawing.Size(51, 13); + this.templateLabel.TabIndex = 3; + this.templateLabel.Text = "Template"; + // + // docNameLabel + // + this.docNameLabel.AutoSize = true; + this.docNameLabel.Location = new System.Drawing.Point(16, 331); + this.docNameLabel.Name = "docNameLabel"; + this.docNameLabel.Size = new System.Drawing.Size(246, 13); + this.docNameLabel.TabIndex = 42; + this.docNameLabel.Text = "Doc.name (0=start 1-end, 2=batch, 3=wm, 4=s/n) :"; + // + // docNameTextBox + // + this.docNameTextBox.Enabled = false; + this.docNameTextBox.Location = new System.Drawing.Point(261, 328); + this.docNameTextBox.Name = "docNameTextBox"; + this.docNameTextBox.Size = new System.Drawing.Size(135, 20); + this.docNameTextBox.TabIndex = 43; + // + // footerItalicCheckBox + // + this.footerItalicCheckBox.AutoSize = true; + this.footerItalicCheckBox.Enabled = false; + this.footerItalicCheckBox.Location = new System.Drawing.Point(334, 173); + this.footerItalicCheckBox.Name = "footerItalicCheckBox"; + this.footerItalicCheckBox.Size = new System.Drawing.Size(15, 14); + this.footerItalicCheckBox.TabIndex = 30; + this.footerItalicCheckBox.UseVisualStyleBackColor = true; + // + // footerBoldCheckBox + // + this.footerBoldCheckBox.AutoSize = true; + this.footerBoldCheckBox.Enabled = false; + this.footerBoldCheckBox.Location = new System.Drawing.Point(306, 173); + this.footerBoldCheckBox.Name = "footerBoldCheckBox"; + this.footerBoldCheckBox.Size = new System.Drawing.Size(15, 14); + this.footerBoldCheckBox.TabIndex = 29; + this.footerBoldCheckBox.UseVisualStyleBackColor = true; + // + // footerFontSizeTextBox + // + this.footerFontSizeTextBox.Enabled = false; + this.footerFontSizeTextBox.Location = new System.Drawing.Point(258, 170); + this.footerFontSizeTextBox.Name = "footerFontSizeTextBox"; + this.footerFontSizeTextBox.Size = new System.Drawing.Size(30, 20); + this.footerFontSizeTextBox.TabIndex = 28; + // + // footerFontFamilyComboBox + // + this.footerFontFamilyComboBox.Enabled = false; + this.footerFontFamilyComboBox.FormattingEnabled = true; + this.footerFontFamilyComboBox.Location = new System.Drawing.Point(142, 170); + this.footerFontFamilyComboBox.Name = "footerFontFamilyComboBox"; + this.footerFontFamilyComboBox.Size = new System.Drawing.Size(110, 21); + this.footerFontFamilyComboBox.TabIndex = 27; + // + // footerFontLabel + // + this.footerFontLabel.AutoSize = true; + this.footerFontLabel.Location = new System.Drawing.Point(16, 173); + this.footerFontLabel.Name = "footerFontLabel"; + this.footerFontLabel.Size = new System.Drawing.Size(107, 13); + this.footerFontLabel.TabIndex = 26; + this.footerFontLabel.Text = "Footer font/size/style"; + // + // imageNameTextBox + // + this.imageNameTextBox.Enabled = false; + this.imageNameTextBox.Location = new System.Drawing.Point(287, 306); + this.imageNameTextBox.Name = "imageNameTextBox"; + this.imageNameTextBox.Size = new System.Drawing.Size(135, 20); + this.imageNameTextBox.TabIndex = 44; + // + // imageLeftTextBox + // + this.imageLeftTextBox.Enabled = false; + this.imageLeftTextBox.Location = new System.Drawing.Point(141, 306); + this.imageLeftTextBox.Name = "imageLeftTextBox"; + this.imageLeftTextBox.Size = new System.Drawing.Size(33, 20); + this.imageLeftTextBox.TabIndex = 46; + // + // imageTopTextBox + // + this.imageTopTextBox.Enabled = false; + this.imageTopTextBox.Location = new System.Drawing.Point(177, 306); + this.imageTopTextBox.Name = "imageTopTextBox"; + this.imageTopTextBox.Size = new System.Drawing.Size(31, 20); + this.imageTopTextBox.TabIndex = 47; + // + // imageWidthTextBox + // + this.imageWidthTextBox.Enabled = false; + this.imageWidthTextBox.Location = new System.Drawing.Point(211, 306); + this.imageWidthTextBox.Name = "imageWidthTextBox"; + this.imageWidthTextBox.Size = new System.Drawing.Size(31, 20); + this.imageWidthTextBox.TabIndex = 48; + // + // imageHeightTextBox + // + this.imageHeightTextBox.Enabled = false; + this.imageHeightTextBox.Location = new System.Drawing.Point(245, 306); + this.imageHeightTextBox.Name = "imageHeightTextBox"; + this.imageHeightTextBox.Size = new System.Drawing.Size(31, 20); + this.imageHeightTextBox.TabIndex = 49; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(17, 309); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(115, 13); + this.label4.TabIndex = 50; + this.label4.Text = "Image left/top/w/h/file"; + // + // label8 + // + this.label8.AutoSize = true; + this.label8.Location = new System.Drawing.Point(55, 269); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(224, 13); + this.label8.TabIndex = 57; + this.label8.Text = "Graph and image coordinates are in 0.254 mm"; + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Location = new System.Drawing.Point(172, 219); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(15, 13); + this.label6.TabIndex = 67; + this.label6.Text = "%"; + // + // colW0TextBox + // + this.colW0TextBox.Enabled = false; + this.colW0TextBox.Location = new System.Drawing.Point(142, 216); + this.colW0TextBox.Name = "colW0TextBox"; + this.colW0TextBox.Size = new System.Drawing.Size(30, 20); + this.colW0TextBox.TabIndex = 66; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(16, 219); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(97, 13); + this.label5.TabIndex = 58; + this.label5.Text = "Column widths in %"; + // + // label7 + // + this.label7.AutoSize = true; + this.label7.Location = new System.Drawing.Point(264, 219); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(15, 13); + this.label7.TabIndex = 62; + this.label7.Text = "%"; + // + // label9 + // + this.label9.AutoSize = true; + this.label9.Location = new System.Drawing.Point(218, 219); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(15, 13); + this.label9.TabIndex = 60; + this.label9.Text = "%"; + // + // colW2TextBox + // + this.colW2TextBox.Enabled = false; + this.colW2TextBox.Location = new System.Drawing.Point(234, 216); + this.colW2TextBox.Name = "colW2TextBox"; + this.colW2TextBox.Size = new System.Drawing.Size(30, 20); + this.colW2TextBox.TabIndex = 61; + // + // colW1TextBox + // + this.colW1TextBox.Enabled = false; + this.colW1TextBox.Location = new System.Drawing.Point(188, 216); + this.colW1TextBox.Name = "colW1TextBox"; + this.colW1TextBox.Size = new System.Drawing.Size(30, 20); + this.colW1TextBox.TabIndex = 59; + // + // commonItems3Button + // + this.commonItems3Button.Enabled = false; + this.commonItems3Button.Location = new System.Drawing.Point(397, 209); + this.commonItems3Button.Name = "commonItems3Button"; + this.commonItems3Button.Size = new System.Drawing.Size(47, 20); + this.commonItems3Button.TabIndex = 65; + this.commonItems3Button.Text = "Col. 3"; + this.commonItems3Button.UseVisualStyleBackColor = true; + this.commonItems3Button.Click += new System.EventHandler(this.commonItems3Button_Click); + // + // commonItems2Button + // + this.commonItems2Button.Enabled = false; + this.commonItems2Button.Location = new System.Drawing.Point(344, 209); + this.commonItems2Button.Name = "commonItems2Button"; + this.commonItems2Button.Size = new System.Drawing.Size(47, 20); + this.commonItems2Button.TabIndex = 64; + this.commonItems2Button.Text = "Col. 2"; + this.commonItems2Button.UseVisualStyleBackColor = true; + this.commonItems2Button.Click += new System.EventHandler(this.commonItems2Button_Click); + // + // commonItems1Button + // + this.commonItems1Button.Enabled = false; + this.commonItems1Button.Location = new System.Drawing.Point(291, 209); + this.commonItems1Button.Name = "commonItems1Button"; + this.commonItems1Button.Size = new System.Drawing.Size(47, 20); + this.commonItems1Button.TabIndex = 63; + this.commonItems1Button.Text = "Col. 1"; + this.commonItems1Button.UseVisualStyleBackColor = true; + this.commonItems1Button.Click += new System.EventHandler(this.commonItems1Button_Click); + // + // label10 + // + this.label10.AutoSize = true; + this.label10.Location = new System.Drawing.Point(172, 244); + this.label10.Name = "label10"; + this.label10.Size = new System.Drawing.Size(15, 13); + this.label10.TabIndex = 74; + this.label10.Text = "%"; + // + // belowW0TextBox + // + this.belowW0TextBox.Enabled = false; + this.belowW0TextBox.Location = new System.Drawing.Point(142, 241); + this.belowW0TextBox.Name = "belowW0TextBox"; + this.belowW0TextBox.Size = new System.Drawing.Size(30, 20); + this.belowW0TextBox.TabIndex = 73; + // + // label11 + // + this.label11.AutoSize = true; + this.label11.Location = new System.Drawing.Point(16, 244); + this.label11.Name = "label11"; + this.label11.Size = new System.Drawing.Size(97, 13); + this.label11.TabIndex = 68; + this.label11.Text = "Column widths in %"; + // + // label12 + // + this.label12.AutoSize = true; + this.label12.Location = new System.Drawing.Point(264, 244); + this.label12.Name = "label12"; + this.label12.Size = new System.Drawing.Size(15, 13); + this.label12.TabIndex = 72; + this.label12.Text = "%"; + // + // label13 + // + this.label13.AutoSize = true; + this.label13.Location = new System.Drawing.Point(218, 244); + this.label13.Name = "label13"; + this.label13.Size = new System.Drawing.Size(15, 13); + this.label13.TabIndex = 70; + this.label13.Text = "%"; + // + // belowW2TextBox + // + this.belowW2TextBox.Enabled = false; + this.belowW2TextBox.Location = new System.Drawing.Point(234, 241); + this.belowW2TextBox.Name = "belowW2TextBox"; + this.belowW2TextBox.Size = new System.Drawing.Size(30, 20); + this.belowW2TextBox.TabIndex = 71; + // + // belowW1TextBox + // + this.belowW1TextBox.Enabled = false; + this.belowW1TextBox.Location = new System.Drawing.Point(188, 241); + this.belowW1TextBox.Name = "belowW1TextBox"; + this.belowW1TextBox.Size = new System.Drawing.Size(30, 20); + this.belowW1TextBox.TabIndex = 69; + // + // belowItems3Button + // + this.belowItems3Button.Enabled = false; + this.belowItems3Button.Location = new System.Drawing.Point(397, 266); + this.belowItems3Button.Name = "belowItems3Button"; + this.belowItems3Button.Size = new System.Drawing.Size(47, 20); + this.belowItems3Button.TabIndex = 77; + this.belowItems3Button.Text = "Col. 3"; + this.belowItems3Button.UseVisualStyleBackColor = true; + this.belowItems3Button.Click += new System.EventHandler(this.belowItems3Button_Click); + // + // belowItems2Button + // + this.belowItems2Button.Enabled = false; + this.belowItems2Button.Location = new System.Drawing.Point(344, 266); + this.belowItems2Button.Name = "belowItems2Button"; + this.belowItems2Button.Size = new System.Drawing.Size(47, 20); + this.belowItems2Button.TabIndex = 76; + this.belowItems2Button.Text = "Col. 2"; + this.belowItems2Button.UseVisualStyleBackColor = true; + this.belowItems2Button.Click += new System.EventHandler(this.belowItems2Button_Click); + // + // belowItems1Button + // + this.belowItems1Button.Enabled = false; + this.belowItems1Button.Location = new System.Drawing.Point(291, 266); + this.belowItems1Button.Name = "belowItems1Button"; + this.belowItems1Button.Size = new System.Drawing.Size(47, 20); + this.belowItems1Button.TabIndex = 75; + this.belowItems1Button.Text = "Col. 1"; + this.belowItems1Button.UseVisualStyleBackColor = true; + this.belowItems1Button.Click += new System.EventHandler(this.belowItems1Button_Click); + // + // table1FormComboBox + // + this.table1FormComboBox.Enabled = false; + this.table1FormComboBox.FormattingEnabled = true; + this.table1FormComboBox.Location = new System.Drawing.Point(392, 237); + this.table1FormComboBox.Name = "table1FormComboBox"; + this.table1FormComboBox.Size = new System.Drawing.Size(64, 21); + this.table1FormComboBox.TabIndex = 78; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(17, 288); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(97, 13); + this.label3.TabIndex = 83; + this.label3.Text = "Graph left/top/w/h"; + // + // graphHeightTextBox + // + this.graphHeightTextBox.Enabled = false; + this.graphHeightTextBox.Location = new System.Drawing.Point(245, 285); + this.graphHeightTextBox.Name = "graphHeightTextBox"; + this.graphHeightTextBox.Size = new System.Drawing.Size(31, 20); + this.graphHeightTextBox.TabIndex = 82; + // + // graphWidthTextBox + // + this.graphWidthTextBox.Enabled = false; + this.graphWidthTextBox.Location = new System.Drawing.Point(211, 285); + this.graphWidthTextBox.Name = "graphWidthTextBox"; + this.graphWidthTextBox.Size = new System.Drawing.Size(31, 20); + this.graphWidthTextBox.TabIndex = 81; + // + // graphTopTextBox + // + this.graphTopTextBox.Enabled = false; + this.graphTopTextBox.Location = new System.Drawing.Point(177, 285); + this.graphTopTextBox.Name = "graphTopTextBox"; + this.graphTopTextBox.Size = new System.Drawing.Size(31, 20); + this.graphTopTextBox.TabIndex = 80; + // + // graphLeftTextBox + // + this.graphLeftTextBox.Enabled = false; + this.graphLeftTextBox.Location = new System.Drawing.Point(141, 285); + this.graphLeftTextBox.Name = "graphLeftTextBox"; + this.graphLeftTextBox.Size = new System.Drawing.Size(33, 20); + this.graphLeftTextBox.TabIndex = 79; + // + // label14 + // + this.label14.AutoSize = true; + this.label14.Location = new System.Drawing.Point(298, 25); + this.label14.Name = "label14"; + this.label14.Size = new System.Drawing.Size(32, 13); + this.label14.TabIndex = 87; + this.label14.Text = "Auto:"; + // + // autoTestParamTextBox + // + this.autoTestParamTextBox.Enabled = false; + this.autoTestParamTextBox.Location = new System.Drawing.Point(333, 22); + this.autoTestParamTextBox.Name = "autoTestParamTextBox"; + this.autoTestParamTextBox.Size = new System.Drawing.Size(107, 20); + this.autoTestParamTextBox.TabIndex = 86; + // + // PrinterCfgCtrl + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.label14); + this.Controls.Add(this.autoTestParamTextBox); + this.Controls.Add(this.label3); + this.Controls.Add(this.graphHeightTextBox); + this.Controls.Add(this.graphWidthTextBox); + this.Controls.Add(this.graphTopTextBox); + this.Controls.Add(this.graphLeftTextBox); + this.Controls.Add(this.table1FormComboBox); + this.Controls.Add(this.belowItems3Button); + this.Controls.Add(this.belowItems2Button); + this.Controls.Add(this.belowItems1Button); + this.Controls.Add(this.label10); + this.Controls.Add(this.belowW0TextBox); + this.Controls.Add(this.label11); + this.Controls.Add(this.label12); + this.Controls.Add(this.label13); + this.Controls.Add(this.belowW2TextBox); + this.Controls.Add(this.belowW1TextBox); + this.Controls.Add(this.label6); + this.Controls.Add(this.colW0TextBox); + this.Controls.Add(this.label5); + this.Controls.Add(this.label7); + this.Controls.Add(this.label9); + this.Controls.Add(this.colW2TextBox); + this.Controls.Add(this.colW1TextBox); + this.Controls.Add(this.commonItems3Button); + this.Controls.Add(this.commonItems2Button); + this.Controls.Add(this.commonItems1Button); + this.Controls.Add(this.label8); + this.Controls.Add(this.label4); + this.Controls.Add(this.imageHeightTextBox); + this.Controls.Add(this.imageWidthTextBox); + this.Controls.Add(this.imageTopTextBox); + this.Controls.Add(this.imageLeftTextBox); + this.Controls.Add(this.imageNameTextBox); + this.Controls.Add(this.footerItalicCheckBox); + this.Controls.Add(this.footerBoldCheckBox); + this.Controls.Add(this.footerFontSizeTextBox); + this.Controls.Add(this.footerFontFamilyComboBox); + this.Controls.Add(this.footerFontLabel); + this.Controls.Add(this.docNameTextBox); + this.Controls.Add(this.docNameLabel); + this.Controls.Add(this.templateTextBox); + this.Controls.Add(this.templateLabel); + this.Controls.Add(this.goodOnlyCheckBox); + this.Controls.Add(this.testItems2Button); + 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.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(455, 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 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 testItems2Button; + private System.Windows.Forms.CheckBox goodOnlyCheckBox; + private System.Windows.Forms.TextBox templateTextBox; + private System.Windows.Forms.Label templateLabel; + private System.Windows.Forms.Label docNameLabel; + private System.Windows.Forms.TextBox docNameTextBox; + private System.Windows.Forms.CheckBox footerItalicCheckBox; + private System.Windows.Forms.CheckBox footerBoldCheckBox; + private System.Windows.Forms.TextBox footerFontSizeTextBox; + private System.Windows.Forms.ComboBox footerFontFamilyComboBox; + private System.Windows.Forms.Label footerFontLabel; + private System.Windows.Forms.TextBox imageNameTextBox; + private System.Windows.Forms.TextBox imageLeftTextBox; + private System.Windows.Forms.TextBox imageTopTextBox; + private System.Windows.Forms.TextBox imageWidthTextBox; + private System.Windows.Forms.TextBox imageHeightTextBox; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.Label label8; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.TextBox colW0TextBox; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.Label label9; + private System.Windows.Forms.TextBox colW2TextBox; + private System.Windows.Forms.TextBox colW1TextBox; + private System.Windows.Forms.Button commonItems3Button; + private System.Windows.Forms.Button commonItems2Button; + private System.Windows.Forms.Button commonItems1Button; + private System.Windows.Forms.Label label10; + private System.Windows.Forms.TextBox belowW0TextBox; + private System.Windows.Forms.Label label11; + private System.Windows.Forms.Label label12; + private System.Windows.Forms.Label label13; + private System.Windows.Forms.TextBox belowW2TextBox; + private System.Windows.Forms.TextBox belowW1TextBox; + private System.Windows.Forms.Button belowItems3Button; + private System.Windows.Forms.Button belowItems2Button; + private System.Windows.Forms.Button belowItems1Button; + private System.Windows.Forms.ComboBox table1FormComboBox; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.TextBox graphHeightTextBox; + private System.Windows.Forms.TextBox graphWidthTextBox; + private System.Windows.Forms.TextBox graphTopTextBox; + private System.Windows.Forms.TextBox graphLeftTextBox; + private System.Windows.Forms.Label label14; + private System.Windows.Forms.TextBox autoTestParamTextBox; + } +} diff --git a/TBF/BenchControl/Output/Printers/OnePerBatch/PrinterCfgCtrl.cs b/TBF/BenchControl/Output/Printers/OnePerBatch/PrinterCfgCtrl.cs new file mode 100644 index 000000000..af693a0b7 --- /dev/null +++ b/TBF/BenchControl/Output/Printers/OnePerBatch/PrinterCfgCtrl.cs @@ -0,0 +1,636 @@ +/// +/// Copyright (c) 2020 Sensus Slovensko a.s. +/// +using System; +using System.Collections.Generic; +using System.Linq; +using System.Windows.Forms; +using log4net; +using Config.Entities; +using TBF.BenchControl.Generic; +using TBF.Resources; +using TBF.BenchControl.Configs; + +namespace TBF.BenchControl.Output.Printers.OnePerBatch +{ + public partial class PrinterCfgCtrl : ConfigCtrlUtils, 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[] testItems2; + string[] belowItems1; + string[] belowItems2; + string[] belowItems3; + 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); + footerFontFamilyComboBox.Items.Add(ff.Name); + } + + for (TableForm f = 0; f < TableForm.Count; f++) + { + table1FormComboBox.Items.Add(f.ToString()); + } + } + + 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; + testItems2 = config.SelectedItems2; + belowItems1 = config.BelowItems1; + belowItems2 = config.BelowItems2; + belowItems3 = config.BelowItems3; + footer = config.Footer; + + Redraw(); + } + + void Localize() + { + nameLabel.Text = Strings.Name; + templateLabel.Text = "Template"; + cultureLabel.Text = "Culture"; + headerButton.Text = Strings.Header; + footerButton.Text = Strings.Footer; + } + + public void Closing() + { + } + + void Redraw() + { + if (config == null) return; /// Control was not loaded, settings were not changed + classNameLabel.Text = config.Factory.ClassName; + nameTextBox.Text = config.Name; + autoTestParamTextBox.Text = config.AutoTestParam; + templateTextBox.Text = config.Template; + 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); + + footerFontFamilyComboBox.Text = config.FooterFntFml; + footerFontSizeTextBox.Text = config.FooterFntSz.ToString(); + footerBoldCheckBox.Checked = ((config.FooterFntSty & (int)System.Drawing.FontStyle.Bold) != 0); + footerItalicCheckBox.Checked = ((config.FooterFntSty & (int)System.Drawing.FontStyle.Italic) != 0); + + colW0TextBox.Text = config.ColW0Pct.ToString(); + colW1TextBox.Text = config.ColW1Pct.ToString(); + colW2TextBox.Text = config.ColW2Pct.ToString(); + + belowW0TextBox.Text = config.BelowW0Pct.ToString(); + belowW1TextBox.Text = config.BelowW1Pct.ToString(); + belowW2TextBox.Text = config.BelowW2Pct.ToString(); + + supressPrintingCheckBox.Checked = config.SupressPrinting; + goodOnlyCheckBox.Checked = config.GoodOnly; + + cultureComboBox.Text = config.Culture.ToString(); + + graphLeftTextBox.Text = config.GraphLeft.ToString(); + graphTopTextBox.Text = config.GraphTop.ToString(); + graphWidthTextBox.Text = config.GraphWid.ToString(); + graphHeightTextBox.Text = config.GraphHgh.ToString(); + + imageLeftTextBox.Text = config.ImgLeft.ToString(); + imageTopTextBox.Text = config.ImgTop.ToString(); + imageWidthTextBox.Text = config.ImgWid.ToString(); + imageHeightTextBox.Text = config.ImgHgh.ToString(); + imageNameTextBox.Text = config.ImgName; + docNameTextBox.Text = config.DocName; + + table1FormComboBox.Text = config.Form.ToString(); + } + + public void Unlock() + { + nameTextBox.Enabled = true; + autoTestParamTextBox.Enabled = true; + templateTextBox.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; + footerFontFamilyComboBox.Enabled = true; + footerFontSizeTextBox.Enabled = true; + footerBoldCheckBox.Enabled = true; + footerItalicCheckBox.Enabled = true; + supressPrintingCheckBox.Enabled = true; + goodOnlyCheckBox.Enabled = true; + cultureComboBox.Enabled = true; + headerButton.Enabled = true; + colW0TextBox.Enabled = true; + colW1TextBox.Enabled = true; + colW2TextBox.Enabled = true; + commonItems1Button.Enabled = true; + commonItems2Button.Enabled = true; + commonItems3Button.Enabled = true; + table1FormComboBox.Enabled = true; + testItemsButton.Enabled = true; + testItems2Button.Enabled = true; + belowW0TextBox.Enabled = true; + belowW1TextBox.Enabled = true; + belowW2TextBox.Enabled = true; + belowItems1Button.Enabled = true; + belowItems2Button.Enabled = true; + belowItems3Button.Enabled = true; + footerButton.Enabled = true; + graphLeftTextBox.Enabled = true; + graphTopTextBox.Enabled = true; + graphWidthTextBox.Enabled = true; + graphHeightTextBox.Enabled = true; + imageLeftTextBox.Enabled = true; + imageTopTextBox.Enabled = true; + imageWidthTextBox.Enabled = true; + imageHeightTextBox.Enabled = true; + imageNameTextBox.Enabled = true; + docNameTextBox.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, dummy3; + 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 (!int.TryParse(footerFontSizeTextBox.Text, out dummy) || dummy < 4 || dummy > 48) + { + message += Environment.NewLine + "Footer font size' should be between 4 and 48"; + flags |= CfgUpdateFlags.Error; + } + + if (!cultureComboBox.Items.Contains(cultureComboBox.Text)) + { + flags |= CfgUpdateFlags.Error; + message += Environment.NewLine + "Invalid culture"; + } + + + if (!int.TryParse(colW0TextBox.Text, out dummy) || dummy < 0 || dummy > 100) + { + message += Environment.NewLine + "Column width 0 should be between 0 and 100"; + flags |= CfgUpdateFlags.Error; + } + if (!int.TryParse(colW1TextBox.Text, out dummy2) || dummy2 < 0 || dummy2 > 100) + { + message += Environment.NewLine + "Column width 1 should be between 0 and 100"; + flags |= CfgUpdateFlags.Error; + } + if (!int.TryParse(colW2TextBox.Text, out dummy3) || dummy3 < 0 || dummy3 > 100) + { + message += Environment.NewLine + "Column width 2 should be between 0 and 100"; + flags |= CfgUpdateFlags.Error; + } + if (dummy + dummy2 + dummy3 > 100) + { + message += Environment.NewLine + "Sum of above column widths should be <= 100"; + flags |= CfgUpdateFlags.Error; + } + + + if (!int.TryParse(belowW0TextBox.Text, out dummy) || dummy < 0 || dummy > 100) + { + message += Environment.NewLine + "Column width 0 should be between 0 and 100"; + flags |= CfgUpdateFlags.Error; + } + if (!int.TryParse(belowW1TextBox.Text, out dummy2) || dummy2 < 0 || dummy2 > 100) + { + message += Environment.NewLine + "Column width 1 should be between 0 and 100"; + flags |= CfgUpdateFlags.Error; + } + if (!int.TryParse(belowW2TextBox.Text, out dummy3) || dummy3 < 0 || dummy3 > 100) + { + message += Environment.NewLine + "Column width 2 should be between 0 and 100"; + flags |= CfgUpdateFlags.Error; + } + if (dummy + dummy2 + dummy3 > 100) + { + message += Environment.NewLine + "Sum of below column widths should be <= 100"; + flags |= CfgUpdateFlags.Error; + } + + + if (!int.TryParse(graphLeftTextBox.Text, out dummy) || dummy < 0 || dummy > 1100) + { + message += Environment.NewLine + "Graph left' should be between 0 and 1100"; + flags |= CfgUpdateFlags.Error; + } + if (!int.TryParse(graphTopTextBox.Text, out dummy) || dummy < 0 || dummy > 1100) + { + message += Environment.NewLine + "Graph top' should be between 0 and 1100"; + flags |= CfgUpdateFlags.Error; + } + if (!int.TryParse(graphWidthTextBox.Text, out dummy) || dummy < 0 || dummy > 1100) + { + message += Environment.NewLine + "Graph width' should be between 0 and 1100"; + flags |= CfgUpdateFlags.Error; + } + if (!int.TryParse(graphHeightTextBox.Text, out dummy) || dummy < 0 || dummy > 1100) + { + message += Environment.NewLine + "Graph height' should be between 0 and 1100"; + flags |= CfgUpdateFlags.Error; + } + + if (!int.TryParse(imageLeftTextBox.Text, out dummy) || dummy < 0 || dummy > 1100) + { + message += Environment.NewLine + "Image left' should be between 0 and 1100"; + flags |= CfgUpdateFlags.Error; + } + if (!int.TryParse(imageTopTextBox.Text, out dummy) || dummy < 0 || dummy > 1100) + { + message += Environment.NewLine + "Image top' should be between 0 and 1100"; + flags |= CfgUpdateFlags.Error; + } + if (!int.TryParse(imageWidthTextBox.Text, out dummy) || dummy < 0 || dummy > 1100) + { + message += Environment.NewLine + "Image width' should be between 0 and 1100"; + flags |= CfgUpdateFlags.Error; + } + if (!int.TryParse(imageHeightTextBox.Text, out dummy) || dummy < 0 || dummy > 1100) + { + message += Environment.NewLine + "Image height' should be between 0 and 1100"; + flags |= CfgUpdateFlags.Error; + } + + if (!table1FormComboBox.Items.Contains(table1FormComboBox.Text)) + { + message += Environment.NewLine + "Invalid 'Table form'"; + 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.AutoTestParam != autoTestParamTextBox.Text) + { + config.AutoTestParam = autoTestParamTextBox.Text; + flags |= CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange; + } + + flags |= UpdateDifferent(ref config.Template, templateTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); + + if (config.PageOrientation != GetOrientation(orientationComboBox.Text)) + { + config.PageOrientation = GetOrientation(orientationComboBox.Text); + flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); + } + + flags |= UpdateDifferent(ref config.TopMargin, topMarginTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); + flags |= UpdateDifferent(ref config.BottomMargin, bottomMarginTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); + flags |= UpdateDifferent(ref config.LeftMargin, leftMarginTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); + + /// Title font properties + flags |= UpdateDifferent(ref config.TitFntFml, titleFontFamilyComboBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); + flags |= UpdateDifferent(ref config.TitFntSz, titleFontSizeTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); + int tmp = (titleBoldCheckBox.Checked ? (int)System.Drawing.FontStyle.Bold : 0) + + (titleItalicCheckBox.Checked ? (int)System.Drawing.FontStyle.Italic : 0); + flags |= UpdateDifferent(ref config.TitFntSty, tmp, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); + + /// Header font properties + flags |= UpdateDifferent(ref config.HdrFntFml, headerFontFamilyComboBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); + flags |= UpdateDifferent(ref config.HdrFntSz, headerFontSizeTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); + tmp = (headerBoldCheckBox.Checked ? (int)System.Drawing.FontStyle.Bold : 0) + + (headerItalicCheckBox.Checked ? (int)System.Drawing.FontStyle.Italic : 0); + flags |= UpdateDifferent(ref config.HdrFntSty, tmp, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); + + /// Body font properties + flags |= UpdateDifferent(ref config.BodyFntFml, bodyFontFamilyComboBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); + flags |= UpdateDifferent(ref config.BodyFntSz, int.Parse(bodyFontSizeTextBox.Text), CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); + tmp = (bodyBoldCheckBox.Checked ? (int)System.Drawing.FontStyle.Bold : 0) + + (bodyItalicCheckBox.Checked ? (int)System.Drawing.FontStyle.Italic : 0); + flags |= UpdateDifferent(ref config.BodyFntSty, tmp, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); + + /// Footer font properties + flags |= UpdateDifferent(ref config.FooterFntFml, footerFontFamilyComboBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); + flags |= UpdateDifferent(ref config.FooterFntSz, int.Parse(footerFontSizeTextBox.Text), CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); + tmp = (footerBoldCheckBox.Checked ? (int)System.Drawing.FontStyle.Bold : 0) + + (footerItalicCheckBox.Checked ? (int)System.Drawing.FontStyle.Italic : 0); + flags |= UpdateDifferent(ref config.FooterFntSty, tmp, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); + + flags |= UpdateDifferent(ref config.SupressPrinting, supressPrintingCheckBox.Checked, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); + flags |= UpdateDifferent(ref config.GoodOnly, goodOnlyCheckBox.Checked, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); + + flags |= UpdateDifferent(ref config.ColW0Pct, colW0TextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); + flags |= UpdateDifferent(ref config.ColW1Pct, colW1TextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); + flags |= UpdateDifferent(ref config.ColW2Pct, colW2TextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); + flags |= UpdateDifferent(ref config.BelowW0Pct, belowW0TextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); + flags |= UpdateDifferent(ref config.BelowW1Pct, belowW1TextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); + flags |= UpdateDifferent(ref config.BelowW2Pct, belowW2TextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); + + flags |= UpdateDifferent(ref config.Header, header, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); + flags |= UpdateDifferent(ref config.CommonItems1, commonItems1, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); + flags |= UpdateDifferent(ref config.CommonItems2, commonItems2, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); + flags |= UpdateDifferent(ref config.CommonItems3, commonItems3, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); + flags |= UpdateDifferent(ref config.SelectedItems, testItems, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); + flags |= UpdateDifferent(ref config.SelectedItems2, testItems2, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); + flags |= UpdateDifferent(ref config.BelowItems1, belowItems1, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); + flags |= UpdateDifferent(ref config.BelowItems2, belowItems2, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); + flags |= UpdateDifferent(ref config.BelowItems3, belowItems3, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); + flags |= UpdateDifferent(ref config.Footer, footer, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); + + for (Culture i = 0; i < Culture.Count; i++) + { + if (i.ToString().Equals(cultureComboBox.Text) && (config.Culture != i)) + { + config.Culture = i; + flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); + break; + } + } + + for (TableForm f = 0; f < TableForm.Count; f++) + { + if (f.ToString().Equals(table1FormComboBox.Text)) + { + config.Form = f; + flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); + } + } + + flags |= UpdateDifferent(ref config.GraphLeft, graphLeftTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); + flags |= UpdateDifferent(ref config.GraphTop, graphTopTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); + flags |= UpdateDifferent(ref config.GraphWid, graphWidthTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); + flags |= UpdateDifferent(ref config.GraphHgh, graphHeightTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); + + flags |= UpdateDifferent(ref config.ImgLeft, imageLeftTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); + flags |= UpdateDifferent(ref config.ImgTop, imageTopTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); + flags |= UpdateDifferent(ref config.ImgWid, imageWidthTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); + flags |= UpdateDifferent(ref config.ImgHgh, imageHeightTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); + flags |= UpdateDifferent(ref config.ImgName, imageNameTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); + + flags |= UpdateDifferent(ref config.DocName, docNameTextBox.Text, 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 testItems2Button_Click(object sender, EventArgs e) + { + Results.Forms.ResultsConfigDlg dlg = new Results.Forms.ResultsConfigDlg(true) + { + MetersKind = config.MetersKind, + SelectedItems = Results.WMeterRsltItemSpec.FromStrArray(testItems2), + }; + + if (dlg.ShowDialog() == DialogResult.OK) + { + testItems2 = Results.WMeterRsltItemSpec.ToStrArray(dlg.SelectedItems); + } + } + + private void belowItems1Button_Click(object sender, EventArgs e) + { + Results.Forms.ResultsConfigDlg dlg = new Results.Forms.ResultsConfigDlg() + { + MetersKind = config.MetersKind, + SelectedItems = Results.WMeterRsltItemSpec.FromStrArray(belowItems1), + }; + + if (dlg.ShowDialog() == DialogResult.OK) + { + belowItems1 = Results.WMeterRsltItemSpec.ToStrArray(dlg.SelectedItems); + } + } + + private void belowItems2Button_Click(object sender, EventArgs e) + { + Results.Forms.ResultsConfigDlg dlg = new Results.Forms.ResultsConfigDlg() + { + MetersKind = config.MetersKind, + SelectedItems = Results.WMeterRsltItemSpec.FromStrArray(belowItems2), + }; + + if (dlg.ShowDialog() == DialogResult.OK) + { + belowItems2 = Results.WMeterRsltItemSpec.ToStrArray(dlg.SelectedItems); + } + } + + private void belowItems3Button_Click(object sender, EventArgs e) + { + Results.Forms.ResultsConfigDlg dlg = new Results.Forms.ResultsConfigDlg() + { + MetersKind = config.MetersKind, + SelectedItems = Results.WMeterRsltItemSpec.FromStrArray(belowItems3), + }; + + if (dlg.ShowDialog() == DialogResult.OK) + { + belowItems3 = 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/TBF/BenchControl/Output/Printers/OnePerBatch/PrinterCfgCtrl.resx b/TBF/BenchControl/Output/Printers/OnePerBatch/PrinterCfgCtrl.resx new file mode 100644 index 000000000..1af7de150 --- /dev/null +++ b/TBF/BenchControl/Output/Printers/OnePerBatch/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/TBF/BenchControl/Output/Printers/OnePerMeter/Printer.cs b/TBF/BenchControl/Output/Printers/OnePerMeter/Printer.cs index 9f7a8406a..cfb49ae84 100644 --- a/TBF/BenchControl/Output/Printers/OnePerMeter/Printer.cs +++ b/TBF/BenchControl/Output/Printers/OnePerMeter/Printer.cs @@ -1,10 +1,11 @@ /// -/// Copyright (c) 2017-2019 Sensus Slovensko a.s. +/// Copyright (c) 2017-2020 Sensus Slovensko a.s. /// using System; using System.Collections.Generic; using System.Globalization; using System.Threading; +using Results.Entities; using Results.Output.Printers.OnePerMeter; using log4net; @@ -20,7 +21,7 @@ namespace TBF.BenchControl.Output.Printers.OnePerMeter public bool SupressPrinting { get { return printerCfg.SupressPrinting; } } /// Data to print - Results.Entities.Batch batch; + Batch batch; /// /// Items to print @@ -136,7 +137,7 @@ namespace TBF.BenchControl.Output.Printers.OnePerMeter /// /// Batch results to print /// Reference to the operation - public IOperation ProcessResultsOp(Results.Entities.Batch batch) + public IOperation ProcessResultsOp(Batch batch) { this.batch = batch; return this; @@ -154,7 +155,7 @@ namespace TBF.BenchControl.Output.Printers.OnePerMeter foreach (var wm in batch.WaterMeters) { - if (wm != null && (!printerCfg.GoodOnly || wm.Passed)) + if (wm != null && !wm.Disabled && (!printerCfg.GoodOnly || wm.Passed)) { string documentName; try @@ -187,7 +188,7 @@ namespace TBF.BenchControl.Output.Printers.OnePerMeter } - void PrintResults(Results.Entities.Batch batch, Results.Entities.WaterMeter wm, string documentName) + void PrintResults(Batch batch, WaterMeter wm, string documentName) { OnePerMeterPrinterCfg cfg = new OnePerMeterPrinterCfg { PageOrientation = printerCfg.PageOrientation, @@ -239,7 +240,7 @@ namespace TBF.BenchControl.Output.Printers.OnePerMeter ImgFullPathName = (wm.ArchivePath != null) ? System.IO.Path.Combine(wm.ArchivePath, printerCfg.ImgName) : null, }; - new Results.Output.Printers.OnePerMeter.OnePerMeterPrintDocument(batch, cfg, wm, documentName).Print(); + new OnePerMeterPrintDocument(batch, cfg, wm, documentName).Print(); } } } diff --git a/TBF/BenchControl/TbfComponents.cs b/TBF/BenchControl/TbfComponents.cs index 02c521756..25fb145aa 100644 --- a/TBF/BenchControl/TbfComponents.cs +++ b/TBF/BenchControl/TbfComponents.cs @@ -156,6 +156,7 @@ namespace TBF.BenchControl Factories.Add(new Output.Printers.Label.Factory()); Factories.Add(new Output.Printers.MultiLabel.Factory()); Factories.Add(new Output.Printers.Munich.PrinterFactory()); + Factories.Add(new Output.Printers.OnePerBatch.Factory()); Factories.Add(new Output.Printers.OnePerMeter.FactorySingle()); Factories.Add(new Output.Printers.OnePerMeter.FactoryCompound()); Factories.Add(new Output.Printers.OnePerMeter.FactoryHeatMeters()); diff --git a/TBF/TBF.csproj b/TBF/TBF.csproj index 7775d2363..297a8bdb9 100644 --- a/TBF/TBF.csproj +++ b/TBF/TBF.csproj @@ -1026,6 +1026,15 @@ PrinterCfgCtrl.cs + + + + + UserControl + + + PrinterCfgCtrl.cs + @@ -2937,6 +2946,9 @@ PrinterCfgCtrl.cs + + PrinterCfgCtrl.cs + PrinterCfgCtrl.cs diff --git a/TBF/UI/Procedures/TestWizard/OracleWZTypSelection.cs b/TBF/UI/Procedures/TestWizard/OracleWZTypSelection.cs index 3756ebfce..612283178 100644 --- a/TBF/UI/Procedures/TestWizard/OracleWZTypSelection.cs +++ b/TBF/UI/Procedures/TestWizard/OracleWZTypSelection.cs @@ -195,8 +195,11 @@ namespace TBF.UI.Procedures.TestWizard foreach (var t in loadedProcedure.Tests) { if (t.Publish != (byte)Config.Entities.Publish.Never && - t.Publish != (byte)Config.Entities.Publish.Internal) + t.Publish != (byte)Config.Entities.Publish.Internal && + ((t.Name.Length > 0 && t.Name[0] != '[') || !t.Name.Contains("]"))) { + /// This is a regular test, + /// not an internal/unpublished test, neither an auto action test wmTestNames.Add(Results.Utils.GetTestName(t.Name, 1, 1)); } }