TestMethods.ChangeOfFlowDirection added.

This commit is contained in:
Milan Hanajik 2018-09-10 10:06:31 +02:00
parent 2a68934b0e
commit 489ebd04aa
12 changed files with 866 additions and 0 deletions

View File

@ -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());

View File

@ -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;
/// <summary>
/// Constructor
/// </summary>
/// <param name="waterMetersCount">Number of text boxes for serial numbers</param>
public ChangeOfFlowDirectionForm(IList<GenericDevices.IWaterMeter> 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];
}
/// <summary> Parameterless constructor for 3 watermeters </summary>
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<UiBridge.AdjustmentInProgressEventArgs>(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<EventArgs>(OnForceClose), sender, args); }
else OnForceClose(sender, args);
};
}
void OnForceClose(object sender, EventArgs args)
{
DialogResult = DialogResult.Cancel;
Close();
}
#endregion
}
}

View File

@ -0,0 +1,312 @@
///
/// Copyright (c) 2018 Sensus Slovensko a.s.
///
namespace TBF.BenchControl.TestMethods.ChangeOfFlowDirection
{
partial class ChangeOfFlowDirectionForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
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;
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -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<GenericDevices.IWaterMeter> waterMeters);
///
void OpenWMErrorsForm(ChangeOfFlowDirectionSeq myRef, IList<GenericDevices.IWaterMeter> waterMeters)
{
myRef.modelessDlg = new ChangeOfFlowDirectionForm(waterMeters);
modelessDlg.Show();
}
/// <summary>
/// Adjustment method sequence
/// </summary>
/// <param name="test">Test entity</param>
/// <returns>
/// 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
/// </returns>
public IList<Event> 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<Event> e = new List<Event>(); /// 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<Event> retList = new List<Event>(1);
retList.Add(Event.Done);
return retList;
stopTest:
/// Create a list with one item 'retVal' (default is Event.Done) and return it
IList<Event> retList2 = new List<Event>(1);
retList2.Add(Event.UiCmdStop);
return retList2;
}
}
}

View File

@ -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<IComponent> 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);
}
}
}

View File

@ -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<Event> Execute(Test test, int repetNr, bool isLastRepetition)
{
return (new ChangeOfFlowDirectionSeq()).Execute(test, repetNr, isLastRepetition, DebugLevel);
}
}
}

View File

@ -2859,6 +2859,15 @@ namespace TBF.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Press OK when you are done..
/// </summary>
internal static string Press_OK_when_done {
get {
return ResourceManager.GetString("Press_OK_when_done", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Pressure.
/// </summary>

View File

@ -1317,4 +1317,7 @@
<data name="Pressure" xml:space="preserve">
<value>Tlak</value>
</data>
<data name="Press_OK_when_done" xml:space="preserve">
<value>Po dokončení stiskněte tlačítko OK.</value>
</data>
</root>

View File

@ -1446,4 +1446,7 @@
<data name="Flow_adjustment_failed" xml:space="preserve">
<value>Durchfluss nicht erreicht</value>
</data>
<data name="Press_OK_when_done" xml:space="preserve">
<value>Drucken Sie OK, wenn Sie fertig sind.</value>
</data>
</root>

View File

@ -1852,4 +1852,7 @@
<data name="Remote_db_is_not_compatible" xml:space="preserve">
<value>Remote database is not compatible.</value>
</data>
<data name="Press_OK_when_done" xml:space="preserve">
<value>Press OK when you are done.</value>
</data>
</root>

View File

@ -918,6 +918,15 @@
<Compile Include="BenchControl\TestMethods\Adjustment\WMErrorsForm24.designer.cs">
<DependentUpon>WMErrorsForm24.cs</DependentUpon>
</Compile>
<Compile Include="BenchControl\TestMethods\ChangeOfFlowDirection\ChangeOfFlowDirectionSeq.cs" />
<Compile Include="BenchControl\TestMethods\ChangeOfFlowDirection\Factory.cs" />
<Compile Include="BenchControl\TestMethods\ChangeOfFlowDirection\TestMethod.cs" />
<Compile Include="BenchControl\TestMethods\ChangeOfFlowDirection\ChangeOfFlowDirectionForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="BenchControl\TestMethods\ChangeOfFlowDirection\ChangeOfFlowDirectionForm.designer.cs">
<DependentUpon>ChangeOfFlowDirectionForm.cs</DependentUpon>
</Compile>
<Compile Include="BenchControl\TestMethods\Endurance\Component.cs" />
<Compile Include="BenchControl\TestMethods\Endurance\CycleStep.cs" />
<Compile Include="BenchControl\TestMethods\Endurance\EnduranceSeq.cs" />
@ -2437,6 +2446,9 @@
<EmbeddedResource Include="BenchControl\TestMethods\Adjustment\WMErrorsForm24.resx">
<DependentUpon>WMErrorsForm24.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="BenchControl\TestMethods\ChangeOfFlowDirection\ChangeOfFlowDirectionForm.resx">
<DependentUpon>ChangeOfFlowDirectionForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="BenchControl\TestMethods\Endurance\CycleDlg.pl.resx">
<DependentUpon>CycleDlg.cs</DependentUpon>
</EmbeddedResource>