diff --git a/TestBenchFramework/BenchControl/GenericDevices/IResultsPrinter.cs b/TestBenchFramework/BenchControl/GenericDevices/IResultsPrinter.cs index ea1176d24..4fd0968f4 100644 --- a/TestBenchFramework/BenchControl/GenericDevices/IResultsPrinter.cs +++ b/TestBenchFramework/BenchControl/GenericDevices/IResultsPrinter.cs @@ -18,5 +18,11 @@ namespace TBF.BenchControl.GenericDevices Entities.Procedure procedure, IList results, string title); + + /// + /// When true printing at the end of cycle is bypassed. + /// Can be used to disable printing without having to modify all procedures. + /// + bool SupressPrinting { get; } } } diff --git a/TestBenchFramework/BenchControl/ResultsPrinters/Basic/Printer.cs b/TestBenchFramework/BenchControl/ResultsPrinters/Basic/Printer.cs index ca3c3c06c..bc7d70305 100644 --- a/TestBenchFramework/BenchControl/ResultsPrinters/Basic/Printer.cs +++ b/TestBenchFramework/BenchControl/ResultsPrinters/Basic/Printer.cs @@ -17,6 +17,8 @@ namespace TBF.BenchControl.ResultsPrinters.Basic readonly PrinterCfg printerCfg; + public bool SupressPrinting { get { return printerCfg.SupressPrinting; } } + /// /// Data to print /// diff --git a/TestBenchFramework/BenchControl/ResultsPrinters/Basic/PrinterCfg.cs b/TestBenchFramework/BenchControl/ResultsPrinters/Basic/PrinterCfg.cs index 6e7575e52..eecb51605 100644 --- a/TestBenchFramework/BenchControl/ResultsPrinters/Basic/PrinterCfg.cs +++ b/TestBenchFramework/BenchControl/ResultsPrinters/Basic/PrinterCfg.cs @@ -14,11 +14,17 @@ namespace TBF.BenchControl.ResultsPrinters.Basic public IComponent GetComponent(IList components) { return new Printer(this); } public IComponentCfgCtrl GetControl() { return new PrinterCfgCtrl(); } + /// + /// Serialized parameters + /// + public bool SupressPrinting; /// Bypass printing when true + /// Private parameterless constructor invoked by all other (public) constructors PrinterCfg() { Name = "BasicResultsPrinter"; ParentName = string.Empty; + SupressPrinting = false; } public PrinterCfg(IComponentFactory factory) @@ -29,7 +35,10 @@ namespace TBF.BenchControl.ResultsPrinters.Basic public string ToString(int i) { - return string.Format("Name={0}", Name); + return string.Format("Name={0}, SupressPrinting={1}", + Name, + SupressPrinting ? "yes" : "no" + ); } } } diff --git a/TestBenchFramework/BenchControl/ResultsPrinters/Basic/PrinterCfgCtrl.Designer.cs b/TestBenchFramework/BenchControl/ResultsPrinters/Basic/PrinterCfgCtrl.Designer.cs index 2409cdc55..d9d05a663 100644 --- a/TestBenchFramework/BenchControl/ResultsPrinters/Basic/PrinterCfgCtrl.Designer.cs +++ b/TestBenchFramework/BenchControl/ResultsPrinters/Basic/PrinterCfgCtrl.Designer.cs @@ -34,12 +34,13 @@ namespace TBF.BenchControl.ResultsPrinters.Basic 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.SuspendLayout(); // // nameTextBox // this.nameTextBox.Enabled = false; - this.nameTextBox.Location = new System.Drawing.Point(137, 57); + this.nameTextBox.Location = new System.Drawing.Point(106, 57); this.nameTextBox.Name = "nameTextBox"; this.nameTextBox.Size = new System.Drawing.Size(130, 20); this.nameTextBox.TabIndex = 5; @@ -47,7 +48,7 @@ namespace TBF.BenchControl.ResultsPrinters.Basic // nameLabel // this.nameLabel.AutoSize = true; - this.nameLabel.Location = new System.Drawing.Point(27, 60); + this.nameLabel.Location = new System.Drawing.Point(34, 60); this.nameLabel.Name = "nameLabel"; this.nameLabel.Size = new System.Drawing.Size(35, 13); this.nameLabel.TabIndex = 4; @@ -56,20 +57,32 @@ namespace TBF.BenchControl.ResultsPrinters.Basic // classNameLabel // this.classNameLabel.AutoSize = true; - this.classNameLabel.Location = new System.Drawing.Point(134, 33); + this.classNameLabel.Location = new System.Drawing.Point(103, 33); this.classNameLabel.Name = "classNameLabel"; this.classNameLabel.Size = new System.Drawing.Size(83, 13); this.classNameLabel.TabIndex = 3; this.classNameLabel.Text = "ComonentName"; // - // BasicPrinterCfgCtrl + // supressPrintingCheckBox + // + this.supressPrintingCheckBox.AutoSize = true; + this.supressPrintingCheckBox.Enabled = false; + this.supressPrintingCheckBox.Location = new System.Drawing.Point(106, 87); + this.supressPrintingCheckBox.Name = "supressPrintingCheckBox"; + this.supressPrintingCheckBox.Size = new System.Drawing.Size(101, 17); + this.supressPrintingCheckBox.TabIndex = 12; + this.supressPrintingCheckBox.Text = "Supress printing"; + this.supressPrintingCheckBox.UseVisualStyleBackColor = true; + // + // PrinterCfgCtrl // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.supressPrintingCheckBox); this.Controls.Add(this.nameTextBox); this.Controls.Add(this.nameLabel); this.Controls.Add(this.classNameLabel); - this.Name = "BasicPrinterCfgCtrl"; + this.Name = "PrinterCfgCtrl"; this.Size = new System.Drawing.Size(300, 200); this.Load += new System.EventHandler(this.PrinterCfgCtrl_Load); this.ResumeLayout(false); @@ -82,5 +95,6 @@ namespace TBF.BenchControl.ResultsPrinters.Basic private System.Windows.Forms.TextBox nameTextBox; private System.Windows.Forms.Label nameLabel; private System.Windows.Forms.Label classNameLabel; + private System.Windows.Forms.CheckBox supressPrintingCheckBox; } } diff --git a/TestBenchFramework/BenchControl/ResultsPrinters/Basic/PrinterCfgCtrl.cs b/TestBenchFramework/BenchControl/ResultsPrinters/Basic/PrinterCfgCtrl.cs index c5d189139..57e5f5d21 100644 --- a/TestBenchFramework/BenchControl/ResultsPrinters/Basic/PrinterCfgCtrl.cs +++ b/TestBenchFramework/BenchControl/ResultsPrinters/Basic/PrinterCfgCtrl.cs @@ -44,11 +44,13 @@ namespace TBF.BenchControl.ResultsPrinters.Basic if (config == null) return; /// Control was not loaded, settings were not changed classNameLabel.Text = config.Factory.ClassName; nameTextBox.Text = config.Name; + supressPrintingCheckBox.Checked = config.SupressPrinting; } public void Unlock() { nameTextBox.Enabled = true; + supressPrintingCheckBox.Enabled = true; } public CfgUpdateFlags VerifyCfg(ref string message) @@ -64,6 +66,7 @@ namespace TBF.BenchControl.ResultsPrinters.Basic if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed config.Name = nameTextBox.Text; + config.SupressPrinting = supressPrintingCheckBox.Checked; return flags; } diff --git a/TestBenchFramework/BenchControl/ResultsPrinters/Munich/Printer.cs b/TestBenchFramework/BenchControl/ResultsPrinters/Munich/Printer.cs index 5f61dcb55..6b05742a5 100644 --- a/TestBenchFramework/BenchControl/ResultsPrinters/Munich/Printer.cs +++ b/TestBenchFramework/BenchControl/ResultsPrinters/Munich/Printer.cs @@ -29,6 +29,8 @@ namespace TBF.BenchControl.ResultsPrinters.Munich public string Pruefvorlage { get { return printerCfg. ProcParams.Pruefvorlage; } } public string Eichjahr { get { return printerCfg. ProcParams.Eichjahr; } } + public bool SupressPrinting { get { return false; } } + public Printer(PrinterCfg cfg) : base(cfg) diff --git a/TestBenchFramework/BenchControl/Sequences/MainSeq.cs b/TestBenchFramework/BenchControl/Sequences/MainSeq.cs index cbdb4d2de..71e139b64 100644 --- a/TestBenchFramework/BenchControl/Sequences/MainSeq.cs +++ b/TestBenchFramework/BenchControl/Sequences/MainSeq.cs @@ -415,8 +415,14 @@ namespace TBF.BenchControl.Sequences IResultsWriter writer = TbfComponents.FindComponent(StateMachine.Procedure.ResultsWriter) as IResultsWriter; IResultsPrinter printer = TbfComponents.FindComponent(StateMachine.Procedure.ResultsPrinter) as IResultsPrinter; State savingAndPrintingRslts = State.Create("MainSeq : Saving and printing results"); - if (writer != null) savingAndPrintingRslts.AddOperation(writer.WriteResultsOp(StateMachine.Procedure, results)); - if (printer != null) savingAndPrintingRslts.AddOperation(printer.PrintResultsOp(BenchId, WaterMeters, StateMachine.Procedure, results, protocolTitle)); + if (writer != null) + { + savingAndPrintingRslts.AddOperation(writer.WriteResultsOp(StateMachine.Procedure, results)); + } + if (printer != null && !printer.SupressPrinting) + { + savingAndPrintingRslts.AddOperation(printer.PrintResultsOp(BenchId, WaterMeters, StateMachine.Procedure, results, protocolTitle)); + } savingAndPrintingRslts.AddOperation(checkUiOp).EnterState(); do { diff --git a/TestBenchFramework/MainWnd.cs b/TestBenchFramework/MainWnd.cs index c5bb50aa7..2806754a3 100644 --- a/TestBenchFramework/MainWnd.cs +++ b/TestBenchFramework/MainWnd.cs @@ -489,7 +489,9 @@ namespace TBF if ((testResults != null) && (testResults.Count != 0) && (testResults[0].MetersKind == Entities.MetersKind.Single)) { - new PrintOrderDocument(procedure[0], testResults, tester).Print(); + PrintOrderDocument doc = new PrintOrderDocument(procedure[0], testResults, tester); + doc.DefaultPageSettings.Landscape = true; + doc.Print(); } else if((testResults != null) && (testResults.Count != 0) && (testResults[0].MetersKind == Entities.MetersKind.Combined)) { diff --git a/TestBenchFramework/PrintOrderDocument.cs b/TestBenchFramework/PrintOrderDocument.cs index 4967fa6ec..355cb5425 100644 --- a/TestBenchFramework/PrintOrderDocument.cs +++ b/TestBenchFramework/PrintOrderDocument.cs @@ -24,8 +24,6 @@ namespace TBF const int SpacingOneAndHalf = (3 * SpacingOne) / 2; - const bool landscape = true; - /// /// Property variable for the Font the user wishes to use /// @@ -175,9 +173,7 @@ namespace TBF int leftMargin = base.DefaultPageSettings.Margins.Left; /// X int topMargin = base.DefaultPageSettings.Margins.Top; /// Y - e.PageSettings.Landscape = landscape; - - if (landscape) + if (base.DefaultPageSettings.Landscape) { /// Landscape mode: we need to swap height/width parameters int tmp = printHeight; diff --git a/TestBenchFramework/Properties/AssemblyInfo.cs b/TestBenchFramework/Properties/AssemblyInfo.cs index e6009ec2d..bf3132342 100644 --- a/TestBenchFramework/Properties/AssemblyInfo.cs +++ b/TestBenchFramework/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("1.3.15.1")] -[assembly: AssemblyFileVersion("1.3.15.1")] +[assembly: AssemblyVersion("1.3.16.1")] +[assembly: AssemblyFileVersion("1.3.16.1")]