diff --git a/TBF/BenchControl/TbfComponents.cs b/TBF/BenchControl/TbfComponents.cs
index 8f24bbe15..064c5e61e 100644
--- a/TBF/BenchControl/TbfComponents.cs
+++ b/TBF/BenchControl/TbfComponents.cs
@@ -44,6 +44,7 @@ namespace TBF.BenchControl
Factories.Add(new Elde.FlowMeterTwins.FlowMeterFactory());
Factories.Add(new Elde.FlowMeterTriplet.FlowMeterFactory());
Factories.Add(new TestMethods.Adjustment.Factory());
+ Factories.Add(new TestMethods.ChangeOfFlowDirection.Factory());
Factories.Add(new TestMethods.CombinedWithDetection.TestMethodFactory());
Factories.Add(new TestMethods.Endurance.Factory());
Factories.Add(new TestMethods.FixedStart.Single.Factory());
diff --git a/TBF/BenchControl/TestMethods/ChangeOfFlowDirection/ChangeOfFlowDirectionForm.cs b/TBF/BenchControl/TestMethods/ChangeOfFlowDirection/ChangeOfFlowDirectionForm.cs
new file mode 100644
index 000000000..80050ffba
--- /dev/null
+++ b/TBF/BenchControl/TestMethods/ChangeOfFlowDirection/ChangeOfFlowDirectionForm.cs
@@ -0,0 +1,217 @@
+///
+/// Copyright (c) 2018 Sensus Slovensko a.s.
+///
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Windows.Forms;
+using log4net;
+using Config.Entities;
+using TBF.Resources;
+
+namespace TBF.BenchControl.TestMethods.ChangeOfFlowDirection
+{
+ public partial class ChangeOfFlowDirectionForm : Form, GenericDevices.IHasCompleted
+ {
+ private static readonly ILog log = LogManager.GetLogger(typeof(ChangeOfFlowDirectionForm));
+
+ ///
+ /// Updated in constructor
+ ///
+ readonly int waterMetersCount; /// Number of text boxes for serial numbers
+ readonly bool[] disabled;
+ Rectangle[] rects;
+
+ ///
+ /// Updated in OnAdjustmentInProgress()
+ ///
+ double[] error; /// Created in constructor
+ double errLimLo;
+ double errLimHi;
+
+ ///
+ /// Set to 'true' when the form closes
+ ///
+ public bool Completed { get { return completed; } }
+ bool completed;
+
+
+ ///
+ /// Constructor
+ ///
+ /// Number of text boxes for serial numbers
+ public ChangeOfFlowDirectionForm(IList waterMeters)
+ : this()
+ {
+ waterMetersCount = waterMeters.Count;
+
+ rects = new Rectangle[waterMetersCount];
+ for (int i = 0; i < waterMetersCount; i++) rects[i] = new Rectangle(385, 30 + 90 * i, 324, 57);
+
+ disabled = new bool[waterMetersCount];
+ for (int i = 0; i < waterMetersCount; i++) disabled[i] = waterMeters[i].Disabled;
+
+ error = new double[waterMetersCount];
+ }
+
+ /// Parameterless constructor for 3 watermeters
+ public ChangeOfFlowDirectionForm()
+ {
+ InitializeComponent();
+ ControlBox = false;
+
+ completed = false;
+
+ /// Attach to 'AdjustmentInProgress' handler
+ UiBridge.Bridge.AdjustmentInProgressHandler += delegate(object sender, UiBridge.AdjustmentInProgressEventArgs args)
+ {
+ if (InvokeRequired)
+ {
+ Invoke(new EventHandler(OnAdjustmentInProgress), sender, args);
+ }
+ else OnAdjustmentInProgress(sender, args);
+ };
+ }
+
+ void Localize()
+ {
+ Text = Strings.Water_Meter_States;
+ groupBox1.Text = Strings.Water_Meter + " 1";
+ groupBox2.Text = Strings.Water_Meter + " 2";
+ groupBox3.Text = Strings.Water_Meter + " 3";
+ groupBox4.Text = Strings.Water_Meter + " 4";
+ groupBox5.Text = Strings.Water_Meter + " 5";
+ groupBox6.Text = Strings.Water_Meter + " 6";
+ wmErrorLabel1.Text = Strings.Error_pct;
+ wmErrorLabel2.Text = Strings.Error_pct;
+ wmErrorLabel3.Text = Strings.Error_pct;
+ wmErrorLabel4.Text = Strings.Error_pct;
+ wmErrorLabel5.Text = Strings.Error_pct;
+ wmErrorLabel6.Text = Strings.Error_pct;
+ okButton.Text = Strings.OkBtnText;
+ }
+
+ private void WMErrorsForm_Load(object sender, EventArgs e)
+ {
+ Localize();
+
+ Height = 50 + 90 * waterMetersCount;
+
+ if (waterMetersCount < 1 || disabled[0]) groupBox1.Visible = false;
+ if (waterMetersCount < 2 || disabled[1]) groupBox2.Visible = false;
+ if (waterMetersCount < 3 || disabled[2]) groupBox3.Visible = false;
+ if (waterMetersCount < 4 || disabled[3]) groupBox4.Visible = false;
+ if (waterMetersCount < 5 || disabled[4]) groupBox5.Visible = false;
+ if (waterMetersCount < 6 || disabled[5]) groupBox6.Visible = false;
+
+ wmErrorTextBox1.Text = "---";
+ wmErrorTextBox2.Text = "---";
+ wmErrorTextBox3.Text = "---";
+ wmErrorTextBox4.Text = "---";
+ wmErrorTextBox5.Text = "---";
+ wmErrorTextBox6.Text = "---";
+ }
+
+ private void okButton_Click(object sender, EventArgs e)
+ {
+ completed = true;
+ Close();
+ }
+
+ void OnAdjustmentInProgress(object sender, UiBridge.AdjustmentInProgressEventArgs args)
+ {
+ string testName = args.TestName;
+
+ Results.Entities.TestRslt tr = TBF.BenchControl.Sequences.ProcessData.BatchRslts.GetTestRslt(testName, 0);
+ errLimLo = tr.ErrLimLo() + tr.Uncertainty();
+ errLimHi = tr.ErrLimHi() - tr.Uncertainty();
+
+ int count = Math.Min(waterMetersCount, TBF.BenchControl.Sequences.ProcessData.BatchRslts.WMPositionsCount);
+ for (int i = 0; i < count; i++)
+ {
+ Results.Entities.MeterTestRslt mtr = TBF.BenchControl.Sequences.ProcessData.BatchRslts.GetMeterTestRslt(testName, i, CompoundMeterId.Single);
+ if (mtr != null) error[i] = mtr.Error;
+ }
+
+ Redraw();
+ }
+
+ void Redraw()
+ {
+ if (waterMetersCount > 0 && !disabled[0]) wmErrorTextBox1.Text = error[0].ToString("F1");
+ if (waterMetersCount > 1 && !disabled[1]) wmErrorTextBox2.Text = error[1].ToString("F1");
+ if (waterMetersCount > 2 && !disabled[2]) wmErrorTextBox3.Text = error[2].ToString("F1");
+ if (waterMetersCount > 3 && !disabled[3]) wmErrorTextBox4.Text = error[3].ToString("F1");
+ if (waterMetersCount > 4 && !disabled[4]) wmErrorTextBox5.Text = error[4].ToString("F1");
+ if (waterMetersCount > 5 && !disabled[5]) wmErrorTextBox6.Text = error[5].ToString("F1");
+
+ for (int i = 0; i < waterMetersCount; i++) Invalidate(rects[i]);
+ }
+
+ private void WMErrorsForm_Paint(object sender, PaintEventArgs e)
+ {
+ System.Drawing.Graphics graphics = this.CreateGraphics();
+
+ for (int i = 0; i < waterMetersCount; i++)
+ {
+ if (!disabled[i])
+ {
+ PaintOne(graphics, rects[i], error[i], errLimLo, errLimHi);
+ }
+ }
+ }
+
+ void PaintOne(System.Drawing.Graphics g, Rectangle r, double value, double limLo, double limHi)
+ {
+ Rectangle rect1 = new Rectangle(r.Left, r.Top, r.Width / 3, r.Height);
+ Rectangle rect2 = new Rectangle(r.Left + r.Width / 3, r.Top, r.Width / 3, r.Height);
+ Rectangle rect3 = new Rectangle(r.Left + 2 * (r.Width / 3), r.Top, r.Width / 3, r.Height);
+ Rectangle rectCent = new Rectangle(r.Left + r.Width / 2 - 1, r.Top, 3, r.Height);
+
+ Brush redBrush = new SolidBrush(Color.FromName("Salmon"));
+ Brush greenBrush = new SolidBrush(Color.FromName("LightGreen"));
+ Brush centBrush = new SolidBrush(Color.FromName("Green"));
+
+ g.FillRectangle(redBrush, rect1);
+ g.FillRectangle(greenBrush, rect2);
+ g.FillRectangle(redBrush, rect3);
+ g.FillRectangle(centBrush, rectCent);
+
+ int x0 = r.Left + r.Width / 2;
+ int dx = r.Height / 3;
+ int x = (int)((double)r.Width * (2.0 * value - limLo - limHi) / (limHi - limLo) / 6.0f + 0.5f);
+
+ if (x0 - dx + x >= r.Left && x0 + dx + x < r.Left + r.Width)
+ {
+ Point[] triangle = new Point[3]
+ {
+ new Point(x0 - dx + x, r.Top),
+ new Point(x0 + dx + x, r.Top),
+ new Point(x0 + x, r.Top + 2 * r.Height / 3),
+ };
+
+ Brush blackBrush = new SolidBrush(Color.Black);
+ g.FillPolygon(blackBrush, triangle);
+ }
+ }
+
+ #region Forced close handling
+
+ public void StartForceCloseHandler()
+ {
+ UiBridge.Bridge.CloseModelessFormHandler += delegate(object sender, EventArgs args)
+ {
+ if (InvokeRequired) { Invoke(new EventHandler(OnForceClose), sender, args); }
+ else OnForceClose(sender, args);
+ };
+ }
+
+ void OnForceClose(object sender, EventArgs args)
+ {
+ DialogResult = DialogResult.Cancel;
+ Close();
+ }
+
+ #endregion
+ }
+}
diff --git a/TBF/BenchControl/TestMethods/ChangeOfFlowDirection/ChangeOfFlowDirectionForm.designer.cs b/TBF/BenchControl/TestMethods/ChangeOfFlowDirection/ChangeOfFlowDirectionForm.designer.cs
new file mode 100644
index 000000000..e8c248e4e
--- /dev/null
+++ b/TBF/BenchControl/TestMethods/ChangeOfFlowDirection/ChangeOfFlowDirectionForm.designer.cs
@@ -0,0 +1,312 @@
+///
+/// Copyright (c) 2018 Sensus Slovensko a.s.
+///
+namespace TBF.BenchControl.TestMethods.ChangeOfFlowDirection
+{
+ partial class ChangeOfFlowDirectionForm
+ {
+ ///
+ /// 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 Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.groupBox2 = new System.Windows.Forms.GroupBox();
+ this.wmErrorTextBox2 = new System.Windows.Forms.TextBox();
+ this.wmErrorLabel2 = new System.Windows.Forms.Label();
+ this.groupBox1 = new System.Windows.Forms.GroupBox();
+ this.wmErrorTextBox1 = new System.Windows.Forms.TextBox();
+ this.wmErrorLabel1 = new System.Windows.Forms.Label();
+ this.okButton = new System.Windows.Forms.Button();
+ this.groupBox3 = new System.Windows.Forms.GroupBox();
+ this.wmErrorTextBox3 = new System.Windows.Forms.TextBox();
+ this.wmErrorLabel3 = new System.Windows.Forms.Label();
+ this.groupBox4 = new System.Windows.Forms.GroupBox();
+ this.wmErrorTextBox4 = new System.Windows.Forms.TextBox();
+ this.wmErrorLabel4 = new System.Windows.Forms.Label();
+ this.groupBox5 = new System.Windows.Forms.GroupBox();
+ this.wmErrorTextBox5 = new System.Windows.Forms.TextBox();
+ this.wmErrorLabel5 = new System.Windows.Forms.Label();
+ this.groupBox6 = new System.Windows.Forms.GroupBox();
+ this.wmErrorTextBox6 = new System.Windows.Forms.TextBox();
+ this.wmErrorLabel6 = new System.Windows.Forms.Label();
+ this.groupBox2.SuspendLayout();
+ this.groupBox1.SuspendLayout();
+ this.groupBox3.SuspendLayout();
+ this.groupBox4.SuspendLayout();
+ this.groupBox5.SuspendLayout();
+ this.groupBox6.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // groupBox2
+ //
+ this.groupBox2.Controls.Add(this.wmErrorTextBox2);
+ this.groupBox2.Controls.Add(this.wmErrorLabel2);
+ this.groupBox2.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
+ this.groupBox2.ForeColor = System.Drawing.Color.Black;
+ this.groupBox2.Location = new System.Drawing.Point(25, 102);
+ this.groupBox2.Name = "groupBox2";
+ this.groupBox2.Size = new System.Drawing.Size(333, 81);
+ this.groupBox2.TabIndex = 2;
+ this.groupBox2.TabStop = false;
+ this.groupBox2.Text = "Water Meter 2";
+ //
+ // wmErrorTextBox2
+ //
+ this.wmErrorTextBox2.Font = new System.Drawing.Font("Verdana", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
+ this.wmErrorTextBox2.Location = new System.Drawing.Point(183, 21);
+ this.wmErrorTextBox2.Name = "wmErrorTextBox2";
+ this.wmErrorTextBox2.Size = new System.Drawing.Size(137, 52);
+ this.wmErrorTextBox2.TabIndex = 1;
+ //
+ // wmErrorLabel2
+ //
+ this.wmErrorLabel2.AutoSize = true;
+ this.wmErrorLabel2.Location = new System.Drawing.Point(18, 34);
+ this.wmErrorLabel2.Name = "wmErrorLabel2";
+ this.wmErrorLabel2.Size = new System.Drawing.Size(103, 23);
+ this.wmErrorLabel2.TabIndex = 0;
+ this.wmErrorLabel2.Text = "Error [%]";
+ //
+ // groupBox1
+ //
+ this.groupBox1.Controls.Add(this.wmErrorTextBox1);
+ this.groupBox1.Controls.Add(this.wmErrorLabel1);
+ this.groupBox1.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
+ this.groupBox1.ForeColor = System.Drawing.Color.Black;
+ this.groupBox1.Location = new System.Drawing.Point(25, 12);
+ this.groupBox1.Name = "groupBox1";
+ this.groupBox1.Size = new System.Drawing.Size(333, 81);
+ this.groupBox1.TabIndex = 1;
+ this.groupBox1.TabStop = false;
+ this.groupBox1.Text = "Water Meter 1";
+ //
+ // wmErrorTextBox1
+ //
+ this.wmErrorTextBox1.Font = new System.Drawing.Font("Verdana", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
+ this.wmErrorTextBox1.Location = new System.Drawing.Point(183, 21);
+ this.wmErrorTextBox1.Name = "wmErrorTextBox1";
+ this.wmErrorTextBox1.Size = new System.Drawing.Size(137, 52);
+ this.wmErrorTextBox1.TabIndex = 1;
+ //
+ // wmErrorLabel1
+ //
+ this.wmErrorLabel1.AutoSize = true;
+ this.wmErrorLabel1.Location = new System.Drawing.Point(18, 34);
+ this.wmErrorLabel1.Name = "wmErrorLabel1";
+ this.wmErrorLabel1.Size = new System.Drawing.Size(103, 23);
+ this.wmErrorLabel1.TabIndex = 0;
+ this.wmErrorLabel1.Text = "Error [%]";
+ //
+ // okButton
+ //
+ this.okButton.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
+ this.okButton.ForeColor = System.Drawing.Color.Black;
+ this.okButton.Location = new System.Drawing.Point(739, 26);
+ this.okButton.Name = "okButton";
+ this.okButton.Size = new System.Drawing.Size(98, 63);
+ this.okButton.TabIndex = 7;
+ this.okButton.Text = "OK";
+ this.okButton.UseVisualStyleBackColor = true;
+ this.okButton.Click += new System.EventHandler(this.okButton_Click);
+ //
+ // groupBox3
+ //
+ this.groupBox3.Controls.Add(this.wmErrorTextBox3);
+ this.groupBox3.Controls.Add(this.wmErrorLabel3);
+ this.groupBox3.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
+ this.groupBox3.ForeColor = System.Drawing.Color.Black;
+ this.groupBox3.Location = new System.Drawing.Point(25, 192);
+ this.groupBox3.Name = "groupBox3";
+ this.groupBox3.Size = new System.Drawing.Size(333, 81);
+ this.groupBox3.TabIndex = 3;
+ this.groupBox3.TabStop = false;
+ this.groupBox3.Text = "Water Meter 3";
+ //
+ // wmErrorTextBox3
+ //
+ this.wmErrorTextBox3.Font = new System.Drawing.Font("Verdana", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
+ this.wmErrorTextBox3.Location = new System.Drawing.Point(183, 21);
+ this.wmErrorTextBox3.Name = "wmErrorTextBox3";
+ this.wmErrorTextBox3.Size = new System.Drawing.Size(137, 52);
+ this.wmErrorTextBox3.TabIndex = 1;
+ //
+ // wmErrorLabel3
+ //
+ this.wmErrorLabel3.AutoSize = true;
+ this.wmErrorLabel3.Location = new System.Drawing.Point(18, 34);
+ this.wmErrorLabel3.Name = "wmErrorLabel3";
+ this.wmErrorLabel3.Size = new System.Drawing.Size(103, 23);
+ this.wmErrorLabel3.TabIndex = 0;
+ this.wmErrorLabel3.Text = "Error [%]";
+ //
+ // groupBox4
+ //
+ this.groupBox4.Controls.Add(this.wmErrorTextBox4);
+ this.groupBox4.Controls.Add(this.wmErrorLabel4);
+ this.groupBox4.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
+ this.groupBox4.ForeColor = System.Drawing.Color.Black;
+ this.groupBox4.Location = new System.Drawing.Point(25, 282);
+ this.groupBox4.Name = "groupBox4";
+ this.groupBox4.Size = new System.Drawing.Size(333, 81);
+ this.groupBox4.TabIndex = 4;
+ this.groupBox4.TabStop = false;
+ this.groupBox4.Text = "Water Meter 4";
+ //
+ // wmErrorTextBox4
+ //
+ this.wmErrorTextBox4.Font = new System.Drawing.Font("Verdana", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
+ this.wmErrorTextBox4.Location = new System.Drawing.Point(183, 21);
+ this.wmErrorTextBox4.Name = "wmErrorTextBox4";
+ this.wmErrorTextBox4.Size = new System.Drawing.Size(137, 52);
+ this.wmErrorTextBox4.TabIndex = 1;
+ //
+ // wmErrorLabel4
+ //
+ this.wmErrorLabel4.AutoSize = true;
+ this.wmErrorLabel4.Location = new System.Drawing.Point(18, 34);
+ this.wmErrorLabel4.Name = "wmErrorLabel4";
+ this.wmErrorLabel4.Size = new System.Drawing.Size(103, 23);
+ this.wmErrorLabel4.TabIndex = 0;
+ this.wmErrorLabel4.Text = "Error [%]";
+ //
+ // groupBox5
+ //
+ this.groupBox5.Controls.Add(this.wmErrorTextBox5);
+ this.groupBox5.Controls.Add(this.wmErrorLabel5);
+ this.groupBox5.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
+ this.groupBox5.ForeColor = System.Drawing.Color.Black;
+ this.groupBox5.Location = new System.Drawing.Point(25, 372);
+ this.groupBox5.Name = "groupBox5";
+ this.groupBox5.Size = new System.Drawing.Size(333, 81);
+ this.groupBox5.TabIndex = 5;
+ this.groupBox5.TabStop = false;
+ this.groupBox5.Text = "Water Meter 5";
+ //
+ // wmErrorTextBox5
+ //
+ this.wmErrorTextBox5.Font = new System.Drawing.Font("Verdana", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
+ this.wmErrorTextBox5.Location = new System.Drawing.Point(183, 21);
+ this.wmErrorTextBox5.Name = "wmErrorTextBox5";
+ this.wmErrorTextBox5.Size = new System.Drawing.Size(137, 52);
+ this.wmErrorTextBox5.TabIndex = 1;
+ //
+ // wmErrorLabel5
+ //
+ this.wmErrorLabel5.AutoSize = true;
+ this.wmErrorLabel5.Location = new System.Drawing.Point(18, 34);
+ this.wmErrorLabel5.Name = "wmErrorLabel5";
+ this.wmErrorLabel5.Size = new System.Drawing.Size(103, 23);
+ this.wmErrorLabel5.TabIndex = 0;
+ this.wmErrorLabel5.Text = "Error [%]";
+ //
+ // groupBox6
+ //
+ this.groupBox6.Controls.Add(this.wmErrorTextBox6);
+ this.groupBox6.Controls.Add(this.wmErrorLabel6);
+ this.groupBox6.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
+ this.groupBox6.ForeColor = System.Drawing.Color.Black;
+ this.groupBox6.Location = new System.Drawing.Point(25, 462);
+ this.groupBox6.Name = "groupBox6";
+ this.groupBox6.Size = new System.Drawing.Size(333, 81);
+ this.groupBox6.TabIndex = 6;
+ this.groupBox6.TabStop = false;
+ this.groupBox6.Text = "Water Meter 6";
+ //
+ // wmErrorTextBox6
+ //
+ this.wmErrorTextBox6.Font = new System.Drawing.Font("Verdana", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
+ this.wmErrorTextBox6.Location = new System.Drawing.Point(183, 21);
+ this.wmErrorTextBox6.Name = "wmErrorTextBox6";
+ this.wmErrorTextBox6.Size = new System.Drawing.Size(137, 52);
+ this.wmErrorTextBox6.TabIndex = 1;
+ //
+ // wmErrorLabel6
+ //
+ this.wmErrorLabel6.AutoSize = true;
+ this.wmErrorLabel6.Location = new System.Drawing.Point(18, 34);
+ this.wmErrorLabel6.Name = "wmErrorLabel6";
+ this.wmErrorLabel6.Size = new System.Drawing.Size(103, 23);
+ this.wmErrorLabel6.TabIndex = 0;
+ this.wmErrorLabel6.Text = "Error [%]";
+ //
+ // WMErrorsForm
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.BackColor = System.Drawing.Color.DarkGoldenrod;
+ this.ClientSize = new System.Drawing.Size(868, 565);
+ this.Controls.Add(this.groupBox6);
+ this.Controls.Add(this.groupBox5);
+ this.Controls.Add(this.groupBox4);
+ this.Controls.Add(this.groupBox3);
+ this.Controls.Add(this.okButton);
+ this.Controls.Add(this.groupBox2);
+ this.Controls.Add(this.groupBox1);
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
+ this.Name = "WMErrorsForm";
+ this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
+ this.Text = "Water Meter States";
+ this.TopMost = true;
+ this.Load += new System.EventHandler(this.WMErrorsForm_Load);
+ this.Paint += new System.Windows.Forms.PaintEventHandler(this.WMErrorsForm_Paint);
+ this.groupBox2.ResumeLayout(false);
+ this.groupBox2.PerformLayout();
+ this.groupBox1.ResumeLayout(false);
+ this.groupBox1.PerformLayout();
+ this.groupBox3.ResumeLayout(false);
+ this.groupBox3.PerformLayout();
+ this.groupBox4.ResumeLayout(false);
+ this.groupBox4.PerformLayout();
+ this.groupBox5.ResumeLayout(false);
+ this.groupBox5.PerformLayout();
+ this.groupBox6.ResumeLayout(false);
+ this.groupBox6.PerformLayout();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.GroupBox groupBox2;
+ private System.Windows.Forms.TextBox wmErrorTextBox2;
+ private System.Windows.Forms.Label wmErrorLabel2;
+ private System.Windows.Forms.GroupBox groupBox1;
+ private System.Windows.Forms.TextBox wmErrorTextBox1;
+ private System.Windows.Forms.Label wmErrorLabel1;
+ private System.Windows.Forms.Button okButton;
+ private System.Windows.Forms.GroupBox groupBox3;
+ private System.Windows.Forms.TextBox wmErrorTextBox3;
+ private System.Windows.Forms.Label wmErrorLabel3;
+ private System.Windows.Forms.GroupBox groupBox4;
+ private System.Windows.Forms.TextBox wmErrorTextBox4;
+ private System.Windows.Forms.Label wmErrorLabel4;
+ private System.Windows.Forms.GroupBox groupBox5;
+ private System.Windows.Forms.TextBox wmErrorTextBox5;
+ private System.Windows.Forms.Label wmErrorLabel5;
+ private System.Windows.Forms.GroupBox groupBox6;
+ private System.Windows.Forms.TextBox wmErrorTextBox6;
+ private System.Windows.Forms.Label wmErrorLabel6;
+
+ }
+}
\ No newline at end of file
diff --git a/TBF/BenchControl/TestMethods/ChangeOfFlowDirection/ChangeOfFlowDirectionForm.resx b/TBF/BenchControl/TestMethods/ChangeOfFlowDirection/ChangeOfFlowDirectionForm.resx
new file mode 100644
index 000000000..1af7de150
--- /dev/null
+++ b/TBF/BenchControl/TestMethods/ChangeOfFlowDirection/ChangeOfFlowDirectionForm.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/TestMethods/ChangeOfFlowDirection/ChangeOfFlowDirectionSeq.cs b/TBF/BenchControl/TestMethods/ChangeOfFlowDirection/ChangeOfFlowDirectionSeq.cs
new file mode 100644
index 000000000..e410f0637
--- /dev/null
+++ b/TBF/BenchControl/TestMethods/ChangeOfFlowDirection/ChangeOfFlowDirectionSeq.cs
@@ -0,0 +1,121 @@
+///
+/// Copyright (c) 2018 Sensus Slovensko a.s.
+///
+using System;
+using System.Collections.Generic;
+using log4net;
+using Config.Entities;
+using TBF.UiBridge;
+
+namespace TBF.BenchControl.TestMethods.ChangeOfFlowDirection
+{
+ public class ChangeOfFlowDirectionSeq : Sequences.SequenceBase
+ {
+ private static readonly ILog log = LogManager.GetLogger(typeof(ChangeOfFlowDirectionSeq));
+
+ System.Windows.Forms.Form modelessDlg;
+ ///
+ delegate void ErrorsFormDlgt(ChangeOfFlowDirectionSeq myRef, IList waterMeters);
+ ///
+ void OpenWMErrorsForm(ChangeOfFlowDirectionSeq myRef, IList waterMeters)
+ {
+ myRef.modelessDlg = new ChangeOfFlowDirectionForm(waterMeters);
+ modelessDlg.Show();
+ }
+
+ ///
+ /// Adjustment method sequence
+ ///
+ /// Test entity
+ ///
+ /// Event.Done . . . . . . . OK
+ /// Event.UiCmdStop . . . . Stopped by the user using the on-screen button STOP
+ /// Event.OpArgumentError . Target flow is out of range
+ /// Event.Error . . . . . . Unspecified error
+ ///
+ public IList Execute(Test test, int repetitionNr, bool isLastRepetition, DebugMode mode)
+ {
+ ///
+ /// Find purge suquences
+ ///
+ TransitionSequence benchFillSeq = null;
+ TransitionSequence benchEmptySeq = null;
+ foreach (var transition in StateMachine.TransitionSequences)
+ {
+ if (transition.Name == StateMachine.Procedure.TransitionStart) benchFillSeq = transition;
+ if (transition.Name == StateMachine.Procedure.TransitionEnd) benchEmptySeq = transition;
+ }
+
+ IList e = new List(); /// Events from currently running operations
+ checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
+
+ /// Start the test, initialize test results
+ Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, 0));
+ string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
+ TestStartTime = DateTime.Now;
+
+
+ ///
+ /// Empty the line
+ ///
+ Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.TransitionBefore));
+ switch (Transition(benchEmptySeq, TransitionContext.PurgeEnd))
+ {
+ case Event.Error:
+ case Event.UiCmdStop:
+ goto stopTest;
+ default:
+ break;
+ }
+
+
+ ///
+ /// Show a dialog with OK button and an appropriate message
+ ///
+ Bridge.OnAdjustmentInProgress(this, new AdjustmentInProgressEventArgs(testName));
+ Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
+ Bridge.OnActivity(this, test.Method);
+ State.Create(string.Format("{0}({1}) : Turn the direction of watermeters", test.Method, test.Name))
+ .AddOperation(checkUiOp)
+ .AddOperation(new Operations.MessageBoxOp(TBF.Resources.Strings.Press_OK_when_done))
+ .EnterState();
+ do
+ {
+ e = StateMachine.WaitRunDevsRunOps();
+
+ Bridge.OnTestProgress(this, new TestProgressEventArgs(test, 1, Config.Entities.Progress.Test));
+
+ if (e.Contains(Event.Error)) goto stopTest;
+ if (TestAndLogUiCmdStop(test, e)) goto stopTest;
+ }
+ while (!e.Contains(Event.OK));
+
+
+ ///
+ /// Fill the line
+ ///
+ Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.TransitionAfter));
+ switch (Transition(benchFillSeq, TransitionContext.PurgeBegin))
+ {
+ case Event.Error:
+ case Event.UiCmdStop:
+ goto stopTest;
+ default:
+ break;
+ }
+
+
+ /// Create a list with one item 'retVal' (default is Event.Done) and return it
+ IList retList = new List(1);
+ retList.Add(Event.Done);
+ return retList;
+
+ stopTest:
+
+ /// Create a list with one item 'retVal' (default is Event.Done) and return it
+ IList retList2 = new List(1);
+ retList2.Add(Event.UiCmdStop);
+ return retList2;
+ }
+ }
+}
diff --git a/TBF/BenchControl/TestMethods/ChangeOfFlowDirection/Factory.cs b/TBF/BenchControl/TestMethods/ChangeOfFlowDirection/Factory.cs
new file mode 100644
index 000000000..35387bc8d
--- /dev/null
+++ b/TBF/BenchControl/TestMethods/ChangeOfFlowDirection/Factory.cs
@@ -0,0 +1,30 @@
+///
+/// Copyright (c) 2018 Sensus Slovensko a.s.
+///
+using System.Collections.Generic;
+using TBF.BenchControl.Generic;
+using TBF.BenchControl.Configs.NameOnly;
+
+namespace TBF.BenchControl.TestMethods.ChangeOfFlowDirection
+{
+ public class Factory : IComponentFactory
+ {
+ public string ClassName { get { return this.GetType().Namespace.Substring(17); } }
+
+ public void ResetStaticProperties() { TestMethod.ResetStaticProperties(); }
+
+ public IComponent DummyComponent() { return new TestMethod(); }
+
+ public IComponent GetComponent(IComponentCfg cfg, IList components) { return new TestMethod(cfg); }
+
+ public IComponentCfg DefaultConfig()
+ {
+ return new TestMethodCfg(this.GetType().Namespace.Substring(29), this);
+ }
+
+ public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
+ {
+ return ComponentCfgBase.CreateFromDbEntity(TestMethodCfg.Serializer, component, this);
+ }
+ }
+}
diff --git a/TBF/BenchControl/TestMethods/ChangeOfFlowDirection/TestMethod.cs b/TBF/BenchControl/TestMethods/ChangeOfFlowDirection/TestMethod.cs
new file mode 100644
index 000000000..f84788d18
--- /dev/null
+++ b/TBF/BenchControl/TestMethods/ChangeOfFlowDirection/TestMethod.cs
@@ -0,0 +1,35 @@
+///
+/// Copyright (c) 2018 Sensus Slovensko a.s.
+///
+using System;
+using System.Collections.Generic;
+using log4net;
+using Config.Entities;
+using TBF.BenchControl;
+
+namespace TBF.BenchControl.TestMethods.ChangeOfFlowDirection
+{
+ public class TestMethod : ComponentBase, GenericDevices.ITestMethod
+ {
+ private static readonly ILog log = LogManager.GetLogger(typeof(TestMethod));
+ public override string ToString() { return string.Format("TestMethods.ChangeOfFlowDirection({0})", Cfg.ToString(1)); }
+
+ public bool CanTest(MetersKind meters) { return meters == MetersKind.Single; }
+ public bool DoTransitions() { return true; }
+
+ public TestMethod()
+ {
+ }
+
+ public TestMethod(Generic.IComponentCfg cfg)
+ : base(cfg)
+ {
+ log.Debug(this.ToString());
+ }
+
+ public IList Execute(Test test, int repetNr, bool isLastRepetition)
+ {
+ return (new ChangeOfFlowDirectionSeq()).Execute(test, repetNr, isLastRepetition, DebugLevel);
+ }
+ }
+}
diff --git a/TBF/Resources/Strings.Designer.cs b/TBF/Resources/Strings.Designer.cs
index 50584d88a..4b682f0c9 100644
--- a/TBF/Resources/Strings.Designer.cs
+++ b/TBF/Resources/Strings.Designer.cs
@@ -2859,6 +2859,15 @@ namespace TBF.Resources {
}
}
+ ///
+ /// Looks up a localized string similar to Press OK when you are done..
+ ///
+ internal static string Press_OK_when_done {
+ get {
+ return ResourceManager.GetString("Press_OK_when_done", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Pressure.
///
diff --git a/TBF/Resources/Strings.cs.resx b/TBF/Resources/Strings.cs.resx
index ede51e3e8..3e4955461 100644
--- a/TBF/Resources/Strings.cs.resx
+++ b/TBF/Resources/Strings.cs.resx
@@ -1317,4 +1317,7 @@
Tlak
+
+ Po dokončení stiskněte tlačítko OK.
+
\ No newline at end of file
diff --git a/TBF/Resources/Strings.de.resx b/TBF/Resources/Strings.de.resx
index 6517f9839..4a45c6cb7 100644
--- a/TBF/Resources/Strings.de.resx
+++ b/TBF/Resources/Strings.de.resx
@@ -1446,4 +1446,7 @@
Durchfluss nicht erreicht
+
+ Drucken Sie OK, wenn Sie fertig sind.
+
\ No newline at end of file
diff --git a/TBF/Resources/Strings.resx b/TBF/Resources/Strings.resx
index aa1761fd9..491c6b8d7 100644
--- a/TBF/Resources/Strings.resx
+++ b/TBF/Resources/Strings.resx
@@ -1852,4 +1852,7 @@
Remote database is not compatible.
+
+ Press OK when you are done.
+
\ No newline at end of file
diff --git a/TBF/TBF.csproj b/TBF/TBF.csproj
index 66408fa8d..ecbb9c998 100644
--- a/TBF/TBF.csproj
+++ b/TBF/TBF.csproj
@@ -918,6 +918,15 @@
WMErrorsForm24.cs
+
+
+
+
+ Form
+
+
+ ChangeOfFlowDirectionForm.cs
+
@@ -2437,6 +2446,9 @@
WMErrorsForm24.cs
+
+ ChangeOfFlowDirectionForm.cs
+
CycleDlg.cs