TBF.BenchControl... --> TBF.Rig...
This commit is contained in:
@@ -0,0 +1,229 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO.Ports;
|
||||
using log4net;
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
using TBF.Rig.Generic;
|
||||
using TBF.Boxes;
|
||||
|
||||
namespace TBF.Rig.Ambient.Comet
|
||||
{
|
||||
/// <summary>
|
||||
/// Ambient temperature / humidity / pressure meter 'Greco' connected via serial interface (RS232)
|
||||
/// Connection settings: 9600 Bd 8-bits No-parity 2-stop-bits Flow control: none.
|
||||
/// </summary>
|
||||
public class Ambient : ComponentBase, IDevice, IOperation, GenericDevices.IAmbient
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(Ambient));
|
||||
public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
|
||||
|
||||
private readonly AmbientCfg ambientCfg;
|
||||
|
||||
/// Private fields
|
||||
SerialPort serialPort;
|
||||
|
||||
/// Measured values when MsrmntState == MsrmntState.Valid
|
||||
float temperature; /// [°C]
|
||||
float pressure; /// [bar]
|
||||
float humidity; /// [R%]
|
||||
|
||||
/// <summary>Last valid measurement time stamp</summary>
|
||||
int msrmntTimeStamp;
|
||||
|
||||
|
||||
public Ambient() { }
|
||||
|
||||
/// <summary>
|
||||
/// Ambient temperature / humidity / pressure meter 'Comet' connected via serial interface (RS232)
|
||||
/// </summary>
|
||||
public Ambient(Generic.IComponentCfg cfg)
|
||||
: base(cfg)
|
||||
{
|
||||
ambientCfg = cfg as AmbientCfg;
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
temperature = 20.0f;
|
||||
humidity = 40.0f;
|
||||
pressure = 1.0f;
|
||||
msrmntTimeStamp = 0;
|
||||
|
||||
if (ambientCfg.DebugLevel == DebugMode.Normal)
|
||||
{
|
||||
string comPortName = "COM" + ambientCfg.ComPortNr.ToString();
|
||||
serialPort = new SerialPort(comPortName, ambientCfg.BaudRate, ambientCfg.Parity, ambientCfg.DataBits, ambientCfg.StopBits);
|
||||
serialPort.Handshake = ambientCfg.Handshake;
|
||||
serialPort.Open();
|
||||
if (ambientCfg.SetDtrToOne) serialPort.DtrEnable = true;
|
||||
log.FatalFormat("{0} initialized: {1}", Name, this);
|
||||
}
|
||||
else
|
||||
{
|
||||
serialPort = null;
|
||||
log.FatalFormat("{0} simulated: {1}", Name, this);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Run this device</summary>
|
||||
public void RunDeviceBefore()
|
||||
{
|
||||
if ((ambientCfg.DebugLevel == DebugMode.Normal) && (serialPort != null))
|
||||
{
|
||||
///
|
||||
/// Read response
|
||||
///
|
||||
try
|
||||
{
|
||||
int receivedBytes = serialPort.BytesToRead;
|
||||
|
||||
if (receivedBytes >= 13)
|
||||
{
|
||||
byte[] byteArr = new byte[receivedBytes];
|
||||
for (int i = 0; i < receivedBytes; i++) byteArr[i] = (byte)serialPort.ReadByte();
|
||||
log.Debug(Telegram.LogTelegram("Received ", byteArr));
|
||||
|
||||
if ((receivedBytes == 13) && (byteArr[0] == 1) && (byteArr[1] == 3) && (byteArr[2] == 8) && Telegram.VerifyTelegramCRC(byteArr))
|
||||
{
|
||||
int value = (int)byteArr[3] * 256 + (int)byteArr[4];
|
||||
temperature = (float)value / 10.0f;
|
||||
|
||||
value = (int)byteArr[5] * 256 + (int)byteArr[6];
|
||||
humidity = (float)value / 10.0f;
|
||||
|
||||
value = (int)byteArr[9] * 256 + (int)byteArr[10];
|
||||
pressure = (float)value / 10000.0f;
|
||||
|
||||
msrmntTimeStamp = StateMachine.Time;
|
||||
|
||||
UpdateProcessData(temperature, pressure, humidity);
|
||||
|
||||
log.InfoFormat("Ambient: temperature = {0:F1} C, humidity = {1:F1} %, pressure = {2:F0} mbar", temperature, humidity, 1000 * pressure);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
DebugLevel = DebugMode.FailureDuringOperation;
|
||||
//serialPort.Close(); /// ?
|
||||
serialPort = null;
|
||||
|
||||
log.FatalFormat("Ambient: Serial port read failure : {0}", e.Message);
|
||||
if (e.InnerException != null)
|
||||
{
|
||||
log.FatalFormat("InnerMessage : {0}", e.InnerException.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Run this device</summary>
|
||||
public void RunDeviceAfter()
|
||||
{
|
||||
if ((ambientCfg.DebugLevel == DebugMode.Normal) && (serialPort != null))
|
||||
{
|
||||
if ((StateMachine.Time % 10) == 0)
|
||||
{
|
||||
///
|
||||
/// Send request once per 10 seconds
|
||||
///
|
||||
try
|
||||
{
|
||||
/// Read four registers: 0x31, 0x32, 0x33, 0x34
|
||||
UInt16 regAddr = 0x0030; /// register addr. = 0x31 (Modbus!)
|
||||
UInt16 count = 4;
|
||||
|
||||
/// Prepare data to be sent
|
||||
byte[] msg = new byte[8];
|
||||
msg[0] = 1; /// (byte)ambientCfg.BusAddress;
|
||||
msg[1] = 3; /// CMD = Read registers
|
||||
msg[2] = (byte)(regAddr >> 8); /// Control Word Hi
|
||||
msg[3] = (byte)(regAddr & 0xFF); /// Control Word Lo
|
||||
msg[4] = (byte)(count >> 8); /// Serial Com Reference Hi
|
||||
msg[5] = (byte)(count & 0xFF); /// Serial Com Reference Lo
|
||||
Telegram.UpdateTelegramCRC(msg);
|
||||
|
||||
log.Debug(Telegram.LogTelegram("Sending ", msg));
|
||||
serialPort.Write(msg, 0, msg.Length);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
DebugLevel = DebugMode.FailureDuringOperation;
|
||||
//serialPort.Close(); /// ?
|
||||
serialPort = null;
|
||||
|
||||
log.FatalFormat("Ambient: Serail port read failure : {0}", e.Message);
|
||||
if (e.InnerException != null)
|
||||
{
|
||||
log.FatalFormat("InnerMessage : {0}", e.InnerException.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Stop this device</summary>
|
||||
public void StopDevice()
|
||||
{
|
||||
if ((ambientCfg.DebugLevel == DebugMode.Normal) && (serialPort != null))
|
||||
{
|
||||
serialPort.Close();
|
||||
serialPort = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void StopDevice2() { }
|
||||
|
||||
void UpdateProcessData(float temperature, float pressure, float humidity)
|
||||
{
|
||||
TBF.Rig.Sequences.ProcessData.AmbTemp.Val = temperature;
|
||||
TBF.Rig.Sequences.ProcessData.AmbPress.Val = pressure;
|
||||
TBF.Rig.Sequences.ProcessData.AmbHumi.Val = humidity;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Boxes for the operation result
|
||||
///
|
||||
FloatBox tempBox;
|
||||
FloatBox pressureBox;
|
||||
FloatBox humiBox;
|
||||
|
||||
public IOperation ReadAmbientOp(FloatBox temperature, FloatBox pressure, FloatBox humidity)
|
||||
{
|
||||
this.tempBox = temperature;
|
||||
this.pressureBox = pressure;
|
||||
this.humiBox = humidity;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
if (tempBox != null) tempBox.Val = temperature;
|
||||
if (pressureBox != null) pressureBox.Val = pressure;
|
||||
if (humiBox != null) humiBox.Val = humidity;
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
/// <returns>
|
||||
/// Event.FlowInDone or Event.FlowOutDone
|
||||
/// </returns>
|
||||
public Event Run()
|
||||
{
|
||||
if (tempBox != null) tempBox.Val = temperature;
|
||||
if (pressureBox != null) pressureBox.Val = pressure;
|
||||
if (humiBox != null) humiBox.Val = humidity;
|
||||
return Event.AmbientDone;
|
||||
}
|
||||
|
||||
/// <summary>Stop this operation</summary>
|
||||
public void Stop()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2016 Sensus Metering Systems
|
||||
///
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.IO.Ports;
|
||||
using System.Xml.Serialization;
|
||||
using TBF.Rig.Generic;
|
||||
|
||||
namespace TBF.Rig.Ambient.Comet
|
||||
{
|
||||
public class AmbientCfg : ComponentCfgBase, Generic.IComponentCfg
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(AmbientCfg) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
public IComponentCfgCtrl GetControl(IList<Config.Entities.Component> cmpntEntities) { return new AmbientCfgCtrl(); }
|
||||
|
||||
///
|
||||
/// Serialized parameters
|
||||
///
|
||||
public int ComPortNr;
|
||||
public int BaudRate;
|
||||
public Parity Parity;
|
||||
public int DataBits;
|
||||
public StopBits StopBits;
|
||||
public Handshake Handshake;
|
||||
public bool SetDtrToOne;
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
AmbientCfg()
|
||||
{
|
||||
Name = "Ambient";
|
||||
ParentName = string.Empty;
|
||||
ComPortNr = 6;
|
||||
BaudRate = 9600;
|
||||
Parity = System.IO.Ports.Parity.None;
|
||||
DataBits = 8;
|
||||
StopBits = System.IO.Ports.StopBits.Two;
|
||||
Handshake = System.IO.Ports.Handshake.None;
|
||||
SetDtrToOne = false;
|
||||
}
|
||||
|
||||
public AmbientCfg(IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
this.Factory = factory;
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("Name={0}, Com{1}, {2}Bd, {3}-bits, parity={4}, stopBits={5}, {6}",
|
||||
Name, ComPortNr, BaudRate, DataBits, Parity, StopBits, Handshake);
|
||||
}
|
||||
}
|
||||
}
|
||||
+243
@@ -0,0 +1,243 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
namespace TBF.Rig.Ambient.Comet
|
||||
{
|
||||
partial class AmbientCfgCtrl
|
||||
{
|
||||
/// <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 Component 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.comPortNrTextBox = new System.Windows.Forms.TextBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.baudRateLabel = new System.Windows.Forms.Label();
|
||||
this.baudRateTextBox = new System.Windows.Forms.TextBox();
|
||||
this.partityLabel = new System.Windows.Forms.Label();
|
||||
this.dataBitsLabel = new System.Windows.Forms.Label();
|
||||
this.dataBitsTextBox = new System.Windows.Forms.TextBox();
|
||||
this.stopBitsLabel = new System.Windows.Forms.Label();
|
||||
this.handshakeLabel = new System.Windows.Forms.Label();
|
||||
this.nameTextBox = new System.Windows.Forms.TextBox();
|
||||
this.nameLabel = new System.Windows.Forms.Label();
|
||||
this.classNameLabel = new System.Windows.Forms.Label();
|
||||
this.parityComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.stopBitsComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.handshakeComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.setDtrCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// comPortNrTextBox
|
||||
//
|
||||
this.comPortNrTextBox.Enabled = false;
|
||||
this.comPortNrTextBox.Location = new System.Drawing.Point(140, 52);
|
||||
this.comPortNrTextBox.Name = "comPortNrTextBox";
|
||||
this.comPortNrTextBox.Size = new System.Drawing.Size(34, 20);
|
||||
this.comPortNrTextBox.TabIndex = 4;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(29, 55);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(98, 13);
|
||||
this.label1.TabIndex = 3;
|
||||
this.label1.Text = "Serial Port Number:";
|
||||
//
|
||||
// baudRateLabel
|
||||
//
|
||||
this.baudRateLabel.AutoSize = true;
|
||||
this.baudRateLabel.Location = new System.Drawing.Point(29, 79);
|
||||
this.baudRateLabel.Name = "baudRateLabel";
|
||||
this.baudRateLabel.Size = new System.Drawing.Size(58, 13);
|
||||
this.baudRateLabel.TabIndex = 5;
|
||||
this.baudRateLabel.Text = "Baud Rate";
|
||||
//
|
||||
// baudRateTextBox
|
||||
//
|
||||
this.baudRateTextBox.Enabled = false;
|
||||
this.baudRateTextBox.Location = new System.Drawing.Point(140, 76);
|
||||
this.baudRateTextBox.Name = "baudRateTextBox";
|
||||
this.baudRateTextBox.Size = new System.Drawing.Size(130, 20);
|
||||
this.baudRateTextBox.TabIndex = 6;
|
||||
//
|
||||
// partityLabel
|
||||
//
|
||||
this.partityLabel.AutoSize = true;
|
||||
this.partityLabel.Location = new System.Drawing.Point(29, 103);
|
||||
this.partityLabel.Name = "partityLabel";
|
||||
this.partityLabel.Size = new System.Drawing.Size(33, 13);
|
||||
this.partityLabel.TabIndex = 7;
|
||||
this.partityLabel.Text = "Parity";
|
||||
//
|
||||
// dataBitsLabel
|
||||
//
|
||||
this.dataBitsLabel.AutoSize = true;
|
||||
this.dataBitsLabel.Location = new System.Drawing.Point(29, 127);
|
||||
this.dataBitsLabel.Name = "dataBitsLabel";
|
||||
this.dataBitsLabel.Size = new System.Drawing.Size(50, 13);
|
||||
this.dataBitsLabel.TabIndex = 9;
|
||||
this.dataBitsLabel.Text = "Data Bits";
|
||||
//
|
||||
// dataBitsTextBox
|
||||
//
|
||||
this.dataBitsTextBox.Enabled = false;
|
||||
this.dataBitsTextBox.Location = new System.Drawing.Point(140, 124);
|
||||
this.dataBitsTextBox.Name = "dataBitsTextBox";
|
||||
this.dataBitsTextBox.Size = new System.Drawing.Size(34, 20);
|
||||
this.dataBitsTextBox.TabIndex = 10;
|
||||
//
|
||||
// stopBitsLabel
|
||||
//
|
||||
this.stopBitsLabel.AutoSize = true;
|
||||
this.stopBitsLabel.Location = new System.Drawing.Point(29, 151);
|
||||
this.stopBitsLabel.Name = "stopBitsLabel";
|
||||
this.stopBitsLabel.Size = new System.Drawing.Size(49, 13);
|
||||
this.stopBitsLabel.TabIndex = 11;
|
||||
this.stopBitsLabel.Text = "Stop Bits";
|
||||
//
|
||||
// handshakeLabel
|
||||
//
|
||||
this.handshakeLabel.AutoSize = true;
|
||||
this.handshakeLabel.Location = new System.Drawing.Point(29, 175);
|
||||
this.handshakeLabel.Name = "handshakeLabel";
|
||||
this.handshakeLabel.Size = new System.Drawing.Size(62, 13);
|
||||
this.handshakeLabel.TabIndex = 13;
|
||||
this.handshakeLabel.Text = "Handshake";
|
||||
//
|
||||
// nameTextBox
|
||||
//
|
||||
this.nameTextBox.Enabled = false;
|
||||
this.nameTextBox.Location = new System.Drawing.Point(140, 28);
|
||||
this.nameTextBox.Name = "nameTextBox";
|
||||
this.nameTextBox.Size = new System.Drawing.Size(130, 20);
|
||||
this.nameTextBox.TabIndex = 2;
|
||||
//
|
||||
// nameLabel
|
||||
//
|
||||
this.nameLabel.AutoSize = true;
|
||||
this.nameLabel.Location = new System.Drawing.Point(30, 31);
|
||||
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(137, 7);
|
||||
this.classNameLabel.Name = "classNameLabel";
|
||||
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
|
||||
this.classNameLabel.TabIndex = 0;
|
||||
this.classNameLabel.Text = "ComonentName";
|
||||
//
|
||||
// parityComboBox
|
||||
//
|
||||
this.parityComboBox.Enabled = false;
|
||||
this.parityComboBox.FormattingEnabled = true;
|
||||
this.parityComboBox.Location = new System.Drawing.Point(140, 100);
|
||||
this.parityComboBox.Name = "parityComboBox";
|
||||
this.parityComboBox.Size = new System.Drawing.Size(130, 21);
|
||||
this.parityComboBox.TabIndex = 8;
|
||||
//
|
||||
// stopBitsComboBox
|
||||
//
|
||||
this.stopBitsComboBox.Enabled = false;
|
||||
this.stopBitsComboBox.FormattingEnabled = true;
|
||||
this.stopBitsComboBox.Location = new System.Drawing.Point(140, 148);
|
||||
this.stopBitsComboBox.Name = "stopBitsComboBox";
|
||||
this.stopBitsComboBox.Size = new System.Drawing.Size(130, 21);
|
||||
this.stopBitsComboBox.TabIndex = 12;
|
||||
//
|
||||
// handshakeComboBox
|
||||
//
|
||||
this.handshakeComboBox.Enabled = false;
|
||||
this.handshakeComboBox.FormattingEnabled = true;
|
||||
this.handshakeComboBox.Location = new System.Drawing.Point(140, 172);
|
||||
this.handshakeComboBox.Name = "handshakeComboBox";
|
||||
this.handshakeComboBox.Size = new System.Drawing.Size(130, 21);
|
||||
this.handshakeComboBox.TabIndex = 14;
|
||||
//
|
||||
// setDtrCheckBox
|
||||
//
|
||||
this.setDtrCheckBox.AutoSize = true;
|
||||
this.setDtrCheckBox.Enabled = false;
|
||||
this.setDtrCheckBox.Location = new System.Drawing.Point(140, 201);
|
||||
this.setDtrCheckBox.Name = "setDtrCheckBox";
|
||||
this.setDtrCheckBox.Size = new System.Drawing.Size(89, 17);
|
||||
this.setDtrCheckBox.TabIndex = 15;
|
||||
this.setDtrCheckBox.Text = "Set DTR to 1";
|
||||
this.setDtrCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// AmbientCfgCtrl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.SystemColors.Control;
|
||||
this.Controls.Add(this.setDtrCheckBox);
|
||||
this.Controls.Add(this.handshakeComboBox);
|
||||
this.Controls.Add(this.stopBitsComboBox);
|
||||
this.Controls.Add(this.parityComboBox);
|
||||
this.Controls.Add(this.nameTextBox);
|
||||
this.Controls.Add(this.nameLabel);
|
||||
this.Controls.Add(this.classNameLabel);
|
||||
this.Controls.Add(this.handshakeLabel);
|
||||
this.Controls.Add(this.stopBitsLabel);
|
||||
this.Controls.Add(this.dataBitsTextBox);
|
||||
this.Controls.Add(this.dataBitsLabel);
|
||||
this.Controls.Add(this.partityLabel);
|
||||
this.Controls.Add(this.baudRateTextBox);
|
||||
this.Controls.Add(this.baudRateLabel);
|
||||
this.Controls.Add(this.comPortNrTextBox);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Name = "AmbientCfgCtrl";
|
||||
this.Size = new System.Drawing.Size(300, 240);
|
||||
this.Load += new System.EventHandler(this.AbbientCfgCtrl_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TextBox comPortNrTextBox;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Label baudRateLabel;
|
||||
private System.Windows.Forms.TextBox baudRateTextBox;
|
||||
private System.Windows.Forms.Label partityLabel;
|
||||
private System.Windows.Forms.Label dataBitsLabel;
|
||||
private System.Windows.Forms.TextBox dataBitsTextBox;
|
||||
private System.Windows.Forms.Label stopBitsLabel;
|
||||
private System.Windows.Forms.Label handshakeLabel;
|
||||
private System.Windows.Forms.TextBox nameTextBox;
|
||||
private System.Windows.Forms.Label nameLabel;
|
||||
private System.Windows.Forms.Label classNameLabel;
|
||||
private System.Windows.Forms.ComboBox parityComboBox;
|
||||
private System.Windows.Forms.ComboBox stopBitsComboBox;
|
||||
private System.Windows.Forms.ComboBox handshakeComboBox;
|
||||
private System.Windows.Forms.CheckBox setDtrCheckBox;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using System.IO.Ports;
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
using TBF.Rig.Generic;
|
||||
|
||||
namespace TBF.Rig.Ambient.Comet
|
||||
{
|
||||
public partial class AmbientCfgCtrl : UserControl, IComponentCfgCtrl
|
||||
{
|
||||
public bool ShowMore { get { return false; } }
|
||||
|
||||
AmbientCfg config;
|
||||
public IComponentCfg Config
|
||||
{
|
||||
get { return config as IComponentCfg; }
|
||||
set
|
||||
{
|
||||
config = value as AmbientCfg;
|
||||
Redraw();
|
||||
}
|
||||
}
|
||||
|
||||
public AmbientCfgCtrl()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
parityComboBox.Items.Add(Parity.None.ToString());
|
||||
parityComboBox.Items.Add(Parity.Even.ToString());
|
||||
parityComboBox.Items.Add(Parity.Odd.ToString());
|
||||
|
||||
stopBitsComboBox.Items.Add(StopBits.None.ToString());
|
||||
stopBitsComboBox.Items.Add(StopBits.One.ToString());
|
||||
stopBitsComboBox.Items.Add(StopBits.OnePointFive.ToString());
|
||||
stopBitsComboBox.Items.Add(StopBits.Two.ToString());
|
||||
|
||||
handshakeComboBox.Items.Add(Handshake.None.ToString());
|
||||
handshakeComboBox.Items.Add(Handshake.RequestToSend.ToString());
|
||||
handshakeComboBox.Items.Add(Handshake.XOnXOff.ToString());
|
||||
}
|
||||
|
||||
private void AbbientCfgCtrl_Load(object sender, EventArgs e)
|
||||
{
|
||||
Redraw();
|
||||
}
|
||||
|
||||
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;
|
||||
comPortNrTextBox.Text = config.ComPortNr.ToString();
|
||||
baudRateTextBox.Text = config.BaudRate.ToString();
|
||||
parityComboBox.Text = config.Parity.ToString();
|
||||
dataBitsTextBox.Text = config.DataBits.ToString();
|
||||
stopBitsComboBox.Text = config.StopBits.ToString();
|
||||
handshakeComboBox.Text = config.Handshake.ToString();
|
||||
setDtrCheckBox.Checked = config.SetDtrToOne;
|
||||
}
|
||||
|
||||
public void Unlock()
|
||||
{
|
||||
nameTextBox.Enabled = true;
|
||||
comPortNrTextBox.Enabled = true;
|
||||
baudRateTextBox.Enabled = true;
|
||||
parityComboBox.Enabled = true;
|
||||
dataBitsTextBox.Enabled = true;
|
||||
stopBitsComboBox.Enabled = true;
|
||||
handshakeComboBox.Enabled = true;
|
||||
setDtrCheckBox.Enabled = true;
|
||||
}
|
||||
|
||||
public CfgUpdateFlags UpdateCfg()
|
||||
{
|
||||
CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd;
|
||||
|
||||
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
|
||||
|
||||
config.Name = nameTextBox.Text;
|
||||
config.ComPortNr = int.Parse(comPortNrTextBox.Text);
|
||||
config.BaudRate = int.Parse(baudRateTextBox.Text);
|
||||
config.Parity = Common.Utils.GetParity(parityComboBox.SelectedItem.ToString());
|
||||
config.DataBits = int.Parse(dataBitsTextBox.Text);
|
||||
config.StopBits = Common.Utils.GetStopBits(stopBitsComboBox.SelectedItem.ToString());
|
||||
config.Handshake = Common.Utils.GetHandshake(handshakeComboBox.SelectedItem.ToString());
|
||||
config.SetDtrToOne = setDtrCheckBox.Checked;
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
public CfgUpdateFlags VerifyCfg(ref string message)
|
||||
{
|
||||
CfgUpdateFlags flags = CfgUpdateFlags.None;
|
||||
|
||||
int dummy;
|
||||
if (!int.TryParse(comPortNrTextBox.Text, out dummy) || dummy < 1 || dummy > 999)
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "'Serial Port Number' is not valid";
|
||||
}
|
||||
|
||||
if (!int.TryParse(baudRateTextBox.Text, out dummy) || dummy < 150 || dummy > 115200)
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "'Baud Rate' is not valid";
|
||||
}
|
||||
|
||||
if (!int.TryParse(dataBitsTextBox.Text, out dummy) || dummy < 7 || dummy > 8)
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "'Data Bits' is not valid";
|
||||
}
|
||||
|
||||
return flags;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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>
|
||||
@@ -0,0 +1,24 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2016 Sensus Metering Systems
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using TBF.Rig.Generic;
|
||||
|
||||
namespace TBF.Rig.Ambient.Comet
|
||||
{
|
||||
public class Factory : IComponentFactory
|
||||
{
|
||||
public string ClassName { get { return "Comet-Ambient"; } }
|
||||
|
||||
public IComponent DummyComponent() { return new Ambient(); }
|
||||
|
||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new Ambient(cfg); }
|
||||
|
||||
public IComponentCfg DefaultConfig() { return new AmbientCfg(this); }
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
||||
{
|
||||
return ComponentCfgBase.CreateFromDbEntity(AmbientCfg.Serializer, component, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,211 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2016 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO.Ports;
|
||||
using System.Text;
|
||||
using log4net;
|
||||
using Common;
|
||||
using TBF.Rig.Generic;
|
||||
using TBF.Boxes;
|
||||
|
||||
namespace TBF.Rig.Ambient.Greco
|
||||
{
|
||||
/// <summary>
|
||||
/// Ambient temperature / humidity / pressure meter 'Greco' connected via serial interface (RS232)
|
||||
/// Connection settings: 19200 Bd 8-bits No-parity 1-stop-bit Flow control: none or hardware.
|
||||
/// </summary>
|
||||
public class Ambient : ComponentBase, IDevice, IOperation, GenericDevices.IAmbient
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(Ambient));
|
||||
public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
|
||||
|
||||
private readonly AmbientCfg ambientCfg;
|
||||
|
||||
/// Private fields
|
||||
SerialPort serialPort;
|
||||
StringBuilder measurementBuilder;
|
||||
|
||||
///
|
||||
/// Measured values when MsrmntState == MsrmntState.Valid
|
||||
///
|
||||
float temperature; /// [°C]
|
||||
float pressure; /// [bar]
|
||||
float humidity; /// [R%]
|
||||
|
||||
/// <summary>Last valid measurement time stamp</summary>
|
||||
int msrmntTimeStamp;
|
||||
|
||||
|
||||
public Ambient() { }
|
||||
|
||||
/// <summary>
|
||||
/// Ambient temperature / humidity / pressure meter 'Greco' connected via serial interface (RS232)
|
||||
/// Connection settings: 19200 Bd 8-bits No-parity 1-stop-bit Flow control: none or hardware.
|
||||
/// </summary>
|
||||
public Ambient(Generic.IComponentCfg cfg)
|
||||
: base(cfg)
|
||||
{
|
||||
ambientCfg = cfg as AmbientCfg;
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
temperature = 20.0f;
|
||||
humidity = 40.0f;
|
||||
pressure = 1.0f;
|
||||
msrmntTimeStamp = 0;
|
||||
|
||||
if (ambientCfg.DebugLevel == DebugMode.Normal)
|
||||
{
|
||||
string comPortName = "COM" + ambientCfg.ComPortNr.ToString();
|
||||
serialPort = new SerialPort(comPortName, ambientCfg.BaudRate, ambientCfg.Parity, ambientCfg.DataBits, ambientCfg.StopBits);
|
||||
serialPort.Handshake = ambientCfg.Handshake;
|
||||
serialPort.Open();
|
||||
measurementBuilder = new StringBuilder(40);
|
||||
log.FatalFormat("{0} initialized: {1}", Name, this);
|
||||
}
|
||||
else
|
||||
{
|
||||
serialPort = null;
|
||||
log.FatalFormat("{0} simulated: {1}", Name, this);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Run this device</summary>
|
||||
public void RunDeviceBefore()
|
||||
{
|
||||
if (ambientCfg.DebugLevel == DebugMode.Simulate ||
|
||||
ambientCfg.DebugLevel == DebugMode.FailureDuringOperation)
|
||||
{
|
||||
msrmntTimeStamp = StateMachine.Time;
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
measurementBuilder.Append(serialPort.ReadExisting());
|
||||
int len = measurementBuilder.Length;
|
||||
|
||||
///
|
||||
/// Device sends each 20 sec one line of ASCII text with data in the following format:
|
||||
/// (temp) 6 characters, two decimal digits, with leading spaces
|
||||
/// TAB 1 character
|
||||
/// (humi) 6 characters, two decimal digits, with leading spaces
|
||||
/// TAB 1 character
|
||||
/// (pressure) 6 characters, one decimal digits, with leading spaces is LT 1000
|
||||
/// CR + LF 2 characters
|
||||
/// Example:
|
||||
/// 23.42 38.08 1061.1
|
||||
/// 23.39 38.04 1060.8
|
||||
/// 23.39 38.08 1061.4
|
||||
///
|
||||
if (len >= 22)
|
||||
{
|
||||
string measurement = measurementBuilder.ToString();
|
||||
measurementBuilder.Clear();
|
||||
|
||||
float t = 0;
|
||||
float h = 0;
|
||||
float p = 0;
|
||||
if (float.TryParse(measurement.Substring(len - 22, 6), NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingWhite,
|
||||
CultureInfo.InvariantCulture, out t) &&
|
||||
measurement[len - 16] == '\t' &&
|
||||
float.TryParse(measurement.Substring(len - 15, 6), NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingWhite,
|
||||
CultureInfo.InvariantCulture, out h) &&
|
||||
measurement[len - 9] == '\t' &&
|
||||
float.TryParse(measurement.Substring(len - 8, 6), NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingWhite,
|
||||
CultureInfo.InvariantCulture, out p) &&
|
||||
measurement[len - 2] == '\r' &&
|
||||
measurement[len - 1] == '\n')
|
||||
{
|
||||
temperature = t;
|
||||
humidity = h;
|
||||
pressure = p / 1000.0F;
|
||||
|
||||
UpdateProcessData(temperature, pressure, humidity);
|
||||
msrmntTimeStamp = StateMachine.Time;
|
||||
log.InfoFormat("Ambient: temperature = {0:F1} C, humidity = {1:F1} %, pressure = {2:F0} mbar", temperature, humidity, 1000 * pressure);
|
||||
}
|
||||
else
|
||||
{
|
||||
log.Warn("Invalid string received: " + measurement);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
DebugLevel = DebugMode.FailureDuringOperation;
|
||||
serialPort = null;
|
||||
|
||||
log.FatalFormat("Ambient: Serail port read failure : {0}", e.Message);
|
||||
if (e.InnerException != null)
|
||||
{
|
||||
log.FatalFormat("InnerMessage : {0}", e.InnerException.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Run this device</summary>
|
||||
public void RunDeviceAfter()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Stop this device</summary>
|
||||
public void StopDevice()
|
||||
{
|
||||
if (serialPort != null) serialPort.Close();
|
||||
}
|
||||
|
||||
public void StopDevice2() { }
|
||||
|
||||
void UpdateProcessData(float temperature, float pressure, float humidity)
|
||||
{
|
||||
TBF.Rig.Sequences.ProcessData.AmbTemp.Val = temperature;
|
||||
TBF.Rig.Sequences.ProcessData.AmbPress.Val = pressure;
|
||||
TBF.Rig.Sequences.ProcessData.AmbHumi.Val = humidity;
|
||||
}
|
||||
|
||||
///
|
||||
/// Boxes for the operation result
|
||||
///
|
||||
FloatBox tempBox;
|
||||
FloatBox pressureBox;
|
||||
FloatBox humiBox;
|
||||
|
||||
public IOperation ReadAmbientOp(FloatBox temperature, FloatBox pressure, FloatBox humidity)
|
||||
{
|
||||
this.tempBox = temperature;
|
||||
this.pressureBox = pressure;
|
||||
this.humiBox = humidity;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
if (tempBox != null) tempBox.Val = temperature;
|
||||
if (pressureBox != null) pressureBox.Val = pressure;
|
||||
if (humiBox != null) humiBox.Val = humidity;
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
/// <returns>
|
||||
/// Event.FlowInDone or Event.FlowOutDone
|
||||
/// </returns>
|
||||
public Event Run()
|
||||
{
|
||||
if (tempBox != null) tempBox.Val = temperature;
|
||||
if (pressureBox != null) pressureBox.Val = pressure;
|
||||
if (humiBox != null) humiBox.Val = humidity;
|
||||
return Event.AmbientDone;
|
||||
}
|
||||
|
||||
/// <summary>Stop this operation</summary>
|
||||
public void Stop()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2016 Sensus Metering Systems
|
||||
///
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.IO.Ports;
|
||||
using System.Xml.Serialization;
|
||||
using TBF.Rig.Generic;
|
||||
|
||||
namespace TBF.Rig.Ambient.Greco
|
||||
{
|
||||
public class AmbientCfg : ComponentCfgBase, Generic.IComponentCfg
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(AmbientCfg) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
public IComponentCfgCtrl GetControl(IList<Config.Entities.Component> cmpntEntities) { return new AmbientCfgCtrl(); }
|
||||
|
||||
///
|
||||
/// Serialized parameters
|
||||
///
|
||||
public int ComPortNr;
|
||||
public int BaudRate;
|
||||
public Parity Parity;
|
||||
public int DataBits;
|
||||
public StopBits StopBits;
|
||||
public Handshake Handshake;
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
AmbientCfg()
|
||||
{
|
||||
Name = "Ambient";
|
||||
ParentName = string.Empty;
|
||||
ComPortNr = 6;
|
||||
BaudRate = 19200;
|
||||
Parity = System.IO.Ports.Parity.None;
|
||||
DataBits = 8;
|
||||
StopBits = System.IO.Ports.StopBits.One;
|
||||
Handshake = System.IO.Ports.Handshake.None;
|
||||
}
|
||||
|
||||
public AmbientCfg(IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
this.Factory = factory;
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("Name={0}, Com{1}, {2}Bd, {3}-bits, parity={4}, stopBits={5}, {6}",
|
||||
Name, ComPortNr, BaudRate, DataBits, Parity, StopBits, Handshake);
|
||||
}
|
||||
}
|
||||
}
|
||||
+229
@@ -0,0 +1,229 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
namespace TBF.Rig.Ambient.Greco
|
||||
{
|
||||
partial class AmbientCfgCtrl
|
||||
{
|
||||
/// <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 Component 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.comPortNrTextBox = new System.Windows.Forms.TextBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.baudRateLabel = new System.Windows.Forms.Label();
|
||||
this.baudRateTextBox = new System.Windows.Forms.TextBox();
|
||||
this.partityLabel = new System.Windows.Forms.Label();
|
||||
this.dataBitsLabel = new System.Windows.Forms.Label();
|
||||
this.dataBitsTextBox = new System.Windows.Forms.TextBox();
|
||||
this.stopBitsLabel = new System.Windows.Forms.Label();
|
||||
this.handshakeLabel = new System.Windows.Forms.Label();
|
||||
this.nameTextBox = new System.Windows.Forms.TextBox();
|
||||
this.nameLabel = new System.Windows.Forms.Label();
|
||||
this.classNameLabel = new System.Windows.Forms.Label();
|
||||
this.parityComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.stopBitsComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.handshakeComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// comPortNrTextBox
|
||||
//
|
||||
this.comPortNrTextBox.Enabled = false;
|
||||
this.comPortNrTextBox.Location = new System.Drawing.Point(140, 52);
|
||||
this.comPortNrTextBox.Name = "comPortNrTextBox";
|
||||
this.comPortNrTextBox.Size = new System.Drawing.Size(34, 20);
|
||||
this.comPortNrTextBox.TabIndex = 4;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(29, 55);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(98, 13);
|
||||
this.label1.TabIndex = 3;
|
||||
this.label1.Text = "Serial Port Number:";
|
||||
//
|
||||
// baudRateLabel
|
||||
//
|
||||
this.baudRateLabel.AutoSize = true;
|
||||
this.baudRateLabel.Location = new System.Drawing.Point(29, 79);
|
||||
this.baudRateLabel.Name = "baudRateLabel";
|
||||
this.baudRateLabel.Size = new System.Drawing.Size(58, 13);
|
||||
this.baudRateLabel.TabIndex = 5;
|
||||
this.baudRateLabel.Text = "Baud Rate";
|
||||
//
|
||||
// baudRateTextBox
|
||||
//
|
||||
this.baudRateTextBox.Enabled = false;
|
||||
this.baudRateTextBox.Location = new System.Drawing.Point(140, 76);
|
||||
this.baudRateTextBox.Name = "baudRateTextBox";
|
||||
this.baudRateTextBox.Size = new System.Drawing.Size(130, 20);
|
||||
this.baudRateTextBox.TabIndex = 6;
|
||||
//
|
||||
// partityLabel
|
||||
//
|
||||
this.partityLabel.AutoSize = true;
|
||||
this.partityLabel.Location = new System.Drawing.Point(29, 103);
|
||||
this.partityLabel.Name = "partityLabel";
|
||||
this.partityLabel.Size = new System.Drawing.Size(33, 13);
|
||||
this.partityLabel.TabIndex = 7;
|
||||
this.partityLabel.Text = "Parity";
|
||||
//
|
||||
// dataBitsLabel
|
||||
//
|
||||
this.dataBitsLabel.AutoSize = true;
|
||||
this.dataBitsLabel.Location = new System.Drawing.Point(29, 127);
|
||||
this.dataBitsLabel.Name = "dataBitsLabel";
|
||||
this.dataBitsLabel.Size = new System.Drawing.Size(50, 13);
|
||||
this.dataBitsLabel.TabIndex = 9;
|
||||
this.dataBitsLabel.Text = "Data Bits";
|
||||
//
|
||||
// dataBitsTextBox
|
||||
//
|
||||
this.dataBitsTextBox.Enabled = false;
|
||||
this.dataBitsTextBox.Location = new System.Drawing.Point(140, 124);
|
||||
this.dataBitsTextBox.Name = "dataBitsTextBox";
|
||||
this.dataBitsTextBox.Size = new System.Drawing.Size(34, 20);
|
||||
this.dataBitsTextBox.TabIndex = 10;
|
||||
//
|
||||
// stopBitsLabel
|
||||
//
|
||||
this.stopBitsLabel.AutoSize = true;
|
||||
this.stopBitsLabel.Location = new System.Drawing.Point(29, 151);
|
||||
this.stopBitsLabel.Name = "stopBitsLabel";
|
||||
this.stopBitsLabel.Size = new System.Drawing.Size(49, 13);
|
||||
this.stopBitsLabel.TabIndex = 11;
|
||||
this.stopBitsLabel.Text = "Stop Bits";
|
||||
//
|
||||
// handshakeLabel
|
||||
//
|
||||
this.handshakeLabel.AutoSize = true;
|
||||
this.handshakeLabel.Location = new System.Drawing.Point(29, 175);
|
||||
this.handshakeLabel.Name = "handshakeLabel";
|
||||
this.handshakeLabel.Size = new System.Drawing.Size(62, 13);
|
||||
this.handshakeLabel.TabIndex = 13;
|
||||
this.handshakeLabel.Text = "Handshake";
|
||||
//
|
||||
// nameTextBox
|
||||
//
|
||||
this.nameTextBox.Enabled = false;
|
||||
this.nameTextBox.Location = new System.Drawing.Point(140, 28);
|
||||
this.nameTextBox.Name = "nameTextBox";
|
||||
this.nameTextBox.Size = new System.Drawing.Size(130, 20);
|
||||
this.nameTextBox.TabIndex = 2;
|
||||
//
|
||||
// nameLabel
|
||||
//
|
||||
this.nameLabel.AutoSize = true;
|
||||
this.nameLabel.Location = new System.Drawing.Point(30, 31);
|
||||
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(137, 7);
|
||||
this.classNameLabel.Name = "classNameLabel";
|
||||
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
|
||||
this.classNameLabel.TabIndex = 0;
|
||||
this.classNameLabel.Text = "ComonentName";
|
||||
//
|
||||
// parityComboBox
|
||||
//
|
||||
this.parityComboBox.Enabled = false;
|
||||
this.parityComboBox.FormattingEnabled = true;
|
||||
this.parityComboBox.Location = new System.Drawing.Point(140, 100);
|
||||
this.parityComboBox.Name = "parityComboBox";
|
||||
this.parityComboBox.Size = new System.Drawing.Size(130, 21);
|
||||
this.parityComboBox.TabIndex = 8;
|
||||
//
|
||||
// stopBitsComboBox
|
||||
//
|
||||
this.stopBitsComboBox.Enabled = false;
|
||||
this.stopBitsComboBox.FormattingEnabled = true;
|
||||
this.stopBitsComboBox.Location = new System.Drawing.Point(140, 148);
|
||||
this.stopBitsComboBox.Name = "stopBitsComboBox";
|
||||
this.stopBitsComboBox.Size = new System.Drawing.Size(130, 21);
|
||||
this.stopBitsComboBox.TabIndex = 12;
|
||||
//
|
||||
// handshakeComboBox
|
||||
//
|
||||
this.handshakeComboBox.Enabled = false;
|
||||
this.handshakeComboBox.FormattingEnabled = true;
|
||||
this.handshakeComboBox.Location = new System.Drawing.Point(140, 172);
|
||||
this.handshakeComboBox.Name = "handshakeComboBox";
|
||||
this.handshakeComboBox.Size = new System.Drawing.Size(130, 21);
|
||||
this.handshakeComboBox.TabIndex = 14;
|
||||
//
|
||||
// AmbientCfgCtrl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.SystemColors.Control;
|
||||
this.Controls.Add(this.handshakeComboBox);
|
||||
this.Controls.Add(this.stopBitsComboBox);
|
||||
this.Controls.Add(this.parityComboBox);
|
||||
this.Controls.Add(this.nameTextBox);
|
||||
this.Controls.Add(this.nameLabel);
|
||||
this.Controls.Add(this.classNameLabel);
|
||||
this.Controls.Add(this.handshakeLabel);
|
||||
this.Controls.Add(this.stopBitsLabel);
|
||||
this.Controls.Add(this.dataBitsTextBox);
|
||||
this.Controls.Add(this.dataBitsLabel);
|
||||
this.Controls.Add(this.partityLabel);
|
||||
this.Controls.Add(this.baudRateTextBox);
|
||||
this.Controls.Add(this.baudRateLabel);
|
||||
this.Controls.Add(this.comPortNrTextBox);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Name = "AmbientCfgCtrl";
|
||||
this.Size = new System.Drawing.Size(300, 240);
|
||||
this.Load += new System.EventHandler(this.AbbientCfgCtrl_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TextBox comPortNrTextBox;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Label baudRateLabel;
|
||||
private System.Windows.Forms.TextBox baudRateTextBox;
|
||||
private System.Windows.Forms.Label partityLabel;
|
||||
private System.Windows.Forms.Label dataBitsLabel;
|
||||
private System.Windows.Forms.TextBox dataBitsTextBox;
|
||||
private System.Windows.Forms.Label stopBitsLabel;
|
||||
private System.Windows.Forms.Label handshakeLabel;
|
||||
private System.Windows.Forms.TextBox nameTextBox;
|
||||
private System.Windows.Forms.Label nameLabel;
|
||||
private System.Windows.Forms.Label classNameLabel;
|
||||
private System.Windows.Forms.ComboBox parityComboBox;
|
||||
private System.Windows.Forms.ComboBox stopBitsComboBox;
|
||||
private System.Windows.Forms.ComboBox handshakeComboBox;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using System.IO.Ports;
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
using TBF.Rig.Generic;
|
||||
|
||||
namespace TBF.Rig.Ambient.Greco
|
||||
{
|
||||
public partial class AmbientCfgCtrl : UserControl, IComponentCfgCtrl
|
||||
{
|
||||
public bool ShowMore { get { return false; } }
|
||||
|
||||
AmbientCfg config;
|
||||
public IComponentCfg Config
|
||||
{
|
||||
get { return config as IComponentCfg; }
|
||||
set
|
||||
{
|
||||
config = value as AmbientCfg;
|
||||
Redraw();
|
||||
}
|
||||
}
|
||||
|
||||
public AmbientCfgCtrl()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
parityComboBox.Items.Add(Parity.None.ToString());
|
||||
parityComboBox.Items.Add(Parity.Even.ToString());
|
||||
parityComboBox.Items.Add(Parity.Odd.ToString());
|
||||
|
||||
stopBitsComboBox.Items.Add(StopBits.None.ToString());
|
||||
stopBitsComboBox.Items.Add(StopBits.One.ToString());
|
||||
stopBitsComboBox.Items.Add(StopBits.OnePointFive.ToString());
|
||||
stopBitsComboBox.Items.Add(StopBits.Two.ToString());
|
||||
|
||||
handshakeComboBox.Items.Add(Handshake.None.ToString());
|
||||
handshakeComboBox.Items.Add(Handshake.RequestToSend.ToString());
|
||||
handshakeComboBox.Items.Add(Handshake.XOnXOff.ToString());
|
||||
}
|
||||
|
||||
private void AbbientCfgCtrl_Load(object sender, EventArgs e)
|
||||
{
|
||||
Redraw();
|
||||
}
|
||||
|
||||
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;
|
||||
comPortNrTextBox.Text = config.ComPortNr.ToString();
|
||||
baudRateTextBox.Text = config.BaudRate.ToString();
|
||||
parityComboBox.Text = config.Parity.ToString();
|
||||
dataBitsTextBox.Text = config.DataBits.ToString();
|
||||
stopBitsComboBox.Text = config.StopBits.ToString();
|
||||
handshakeComboBox.Text = config.Handshake.ToString();
|
||||
}
|
||||
|
||||
public void Unlock()
|
||||
{
|
||||
nameTextBox.Enabled = true;
|
||||
comPortNrTextBox.Enabled = true;
|
||||
baudRateTextBox.Enabled = true;
|
||||
parityComboBox.Enabled = true;
|
||||
dataBitsTextBox.Enabled = true;
|
||||
stopBitsComboBox.Enabled = true;
|
||||
handshakeComboBox.Enabled = true;
|
||||
}
|
||||
|
||||
public CfgUpdateFlags UpdateCfg()
|
||||
{
|
||||
CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd;
|
||||
|
||||
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
|
||||
|
||||
config.Name = nameTextBox.Text;
|
||||
config.ComPortNr = int.Parse(comPortNrTextBox.Text);
|
||||
config.BaudRate = int.Parse(baudRateTextBox.Text);
|
||||
config.Parity = Common.Utils.GetParity(parityComboBox.SelectedItem.ToString());
|
||||
config.DataBits = int.Parse(dataBitsTextBox.Text);
|
||||
config.StopBits = Common.Utils.GetStopBits(stopBitsComboBox.SelectedItem.ToString());
|
||||
config.Handshake = Common.Utils.GetHandshake(handshakeComboBox.SelectedItem.ToString());
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
public CfgUpdateFlags VerifyCfg(ref string message)
|
||||
{
|
||||
CfgUpdateFlags flags = CfgUpdateFlags.None;
|
||||
|
||||
int dummy;
|
||||
if (!int.TryParse(comPortNrTextBox.Text, out dummy) || dummy < 1 || dummy > 999)
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "'Serial Port Number' is not valid";
|
||||
}
|
||||
|
||||
if (!int.TryParse(baudRateTextBox.Text, out dummy) || dummy < 150 || dummy > 115200)
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "'Baud Rate' is not valid";
|
||||
}
|
||||
|
||||
if (!int.TryParse(dataBitsTextBox.Text, out dummy) || dummy < 7 || dummy > 8)
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "'Data Bits' is not valid";
|
||||
}
|
||||
|
||||
return flags;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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>
|
||||
@@ -0,0 +1,24 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2016 Sensus Metering Systems
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using TBF.Rig.Generic;
|
||||
|
||||
namespace TBF.Rig.Ambient.Greco
|
||||
{
|
||||
public class Factory : IComponentFactory
|
||||
{
|
||||
public string ClassName { get { return "Greco Ambient"; } }
|
||||
|
||||
public IComponent DummyComponent() { return new Ambient(); }
|
||||
|
||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new Ambient(cfg); }
|
||||
|
||||
public IComponentCfg DefaultConfig() { return new AmbientCfg(this); }
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
||||
{
|
||||
return ComponentCfgBase.CreateFromDbEntity(AmbientCfg.Serializer, component, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using TBF.Rig.GenericDevices;
|
||||
|
||||
namespace TBF.Rig
|
||||
{
|
||||
public class BenchPath
|
||||
{
|
||||
public int ItemNr;
|
||||
public string Name;
|
||||
public float Qfrom;
|
||||
public float Qto;
|
||||
public string Selector;
|
||||
public ITempMeter TempMtrUp;
|
||||
public ITempMeter TempMtrDown;
|
||||
public IPressureMeter PressMtrUp;
|
||||
public IPressureMeter PressMtrDown;
|
||||
public IPressureMeter PressMtrDelta;
|
||||
public IValve StopBFValve;
|
||||
public IList<IValve> ValvesOpen;
|
||||
public IList<IValve> ValvesClose;
|
||||
|
||||
/// Constructor from name, the rest is empty
|
||||
public BenchPath(string name, int itemNr)
|
||||
{
|
||||
ItemNr = itemNr;
|
||||
Name = name;
|
||||
ValvesOpen = new List<IValve>();
|
||||
ValvesClose = new List<IValve>();
|
||||
}
|
||||
|
||||
/// Constructor from data entity
|
||||
public BenchPath(Config.Entities.BenchPath entity, IList<Rig.Generic.IComponent> components)
|
||||
: this(entity.Name, entity.ItemNr)
|
||||
{
|
||||
Qfrom = entity.Qfrom;
|
||||
Qto = entity.Qto;
|
||||
Selector = entity.Selector;
|
||||
TempMtrUp = TbfComponents.FindComponent(entity.TempMtrUp, components) as ITempMeter;
|
||||
TempMtrDown = TbfComponents.FindComponent(entity.TempMtrDown, components) as ITempMeter;
|
||||
PressMtrUp = TbfComponents.FindComponent(entity.PressMtrUp, components) as IPressureMeter;
|
||||
PressMtrDown = TbfComponents.FindComponent(entity.PressMtrDown, components) as IPressureMeter;
|
||||
PressMtrDelta = TbfComponents.FindComponent(entity.PressMtrDelta, components) as IPressureMeter;
|
||||
StopBFValve = TbfComponents.FindComponent(entity.StopBFValve, components) as IValve;
|
||||
|
||||
string[] vOpen = entity.ValvesOpen.Split(new char[] { ';' });
|
||||
ValvesOpen = new List<IValve>();
|
||||
foreach (var vName in vOpen) ValvesOpen.Add((IValve)TbfComponents.FindComponent(vName, components));
|
||||
|
||||
string[] vClose = entity.ValvesClose.Split(new char[] { ';' });
|
||||
ValvesClose = new List<IValve>();
|
||||
foreach (var vName in vClose) ValvesClose.Add((IValve)TbfComponents.FindComponent(vName, components));
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("{0} StopBF={1}",
|
||||
Name,
|
||||
(StopBFValve != null) ? StopBFValve.Name : "---");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
|
||||
namespace TBF.Rig
|
||||
{
|
||||
public class CfgChangeArgs : EventArgs
|
||||
{
|
||||
public CfgChangeCmd Command;
|
||||
public Generic.IComponentCfg Cfg;
|
||||
|
||||
public CfgChangeArgs(CfgChangeCmd command, Generic.IComponentCfg cfg)
|
||||
{
|
||||
Command = command;
|
||||
Cfg = cfg;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
|
||||
namespace TBF.Rig
|
||||
{
|
||||
public class CmdResponseArgs : EventArgs
|
||||
{
|
||||
public CfgChangeCmd Command;
|
||||
public int Id; /// Either Idx1(RV) or BitPosition (Div) to identify the component
|
||||
public int Response;
|
||||
|
||||
public CmdResponseArgs(CfgChangeCmd command, int id, int response)
|
||||
{
|
||||
Command = command;
|
||||
Id = id;
|
||||
Response = response;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
using TBF.Rig.Generic;
|
||||
|
||||
namespace TBF.Rig
|
||||
{
|
||||
public abstract class ComponentBase : IComponent
|
||||
{
|
||||
readonly Generic.IComponentCfg cfg;
|
||||
public Generic.IComponentCfg Cfg { get { return cfg; } }
|
||||
|
||||
public string Name { get { return cfg.Name; } }
|
||||
public string ClassName { get { return cfg.Factory.ClassName; } }
|
||||
public string ParentName { get { return cfg.ParentName; } }
|
||||
public IComponentFactory Factory { get { return cfg.Factory; } }
|
||||
public int ItemNr { get { return cfg.ItemNr; } }
|
||||
public DebugMode DebugLevel { get { return cfg.DebugLevel; } set { cfg.DebugLevel = value; } }
|
||||
public LogLevel LogLevel { get { return cfg.LogLevel; } }
|
||||
|
||||
public IList<MeasurementCorrection> Corrections
|
||||
{
|
||||
get { return cfg.Corrections; }
|
||||
set { cfg.Corrections = value; }
|
||||
}
|
||||
|
||||
public IList<Uncertainty> Uncertainties
|
||||
{
|
||||
get { return cfg.Uncertainties; }
|
||||
set { cfg.Uncertainties = value; }
|
||||
}
|
||||
|
||||
|
||||
/// Constructor, components created in this way is used by
|
||||
/// IComponentFactory.DummyComponent() function. Such dummy component should be used
|
||||
/// only for runtime class type identification (e.g. object is iValve)
|
||||
public ComponentBase()
|
||||
{
|
||||
cfg = null;
|
||||
}
|
||||
|
||||
/// Constructor with configuration as an argument
|
||||
public ComponentBase(IComponentCfg cfg)
|
||||
{
|
||||
if (cfg == null) throw new ArgumentNullException("cfg");
|
||||
this.cfg = cfg;
|
||||
}
|
||||
|
||||
public abstract void Initialize();
|
||||
|
||||
/// <summary> Empty implementation, might be overriden in derived classes </summary>
|
||||
public virtual void StartChangeHandler() { }
|
||||
|
||||
/// <summary> Empty implementation, might be overriden in derived classes </summary>
|
||||
public virtual void StopChangeHandler() { }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,228 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Xml.Serialization;
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
using TBF.Rig.Generic;
|
||||
|
||||
namespace TBF.Rig
|
||||
{
|
||||
public class ComponentCfgBase
|
||||
{
|
||||
[XmlIgnore] public int Id { get; set; }
|
||||
[XmlIgnore] public Generic.IComponentFactory Factory { get; set; }
|
||||
[XmlIgnore] public string ClassName { get { return Factory.ToString(); } }
|
||||
[XmlIgnore] public string Name { get; set; }
|
||||
[XmlIgnore] public string ParentName { get; set; }
|
||||
[XmlIgnore] public int ItemNr { get; set; }
|
||||
[XmlIgnore] public DebugMode DebugLevel { get; set; }
|
||||
[XmlIgnore] public LogLevel LogLevel { get; set; }
|
||||
[XmlIgnore] public IList<MeasurementCorrection> Corrections { get; set; }
|
||||
[XmlIgnore] public IList<Uncertainty> Uncertainties { get; set; }
|
||||
|
||||
|
||||
protected ComponentCfgBase()
|
||||
{
|
||||
ItemNr = 0;
|
||||
DebugLevel = DebugMode.Normal;
|
||||
LogLevel = LogLevel.Off;
|
||||
}
|
||||
|
||||
protected ComponentCfgBase(Generic.IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
Factory = factory;
|
||||
}
|
||||
|
||||
protected ComponentCfgBase(Generic.IComponentFactory factory, string name)
|
||||
: this(factory)
|
||||
{
|
||||
Name = name;
|
||||
}
|
||||
|
||||
protected ComponentCfgBase(Generic.IComponentFactory factory, string name, string parentName)
|
||||
: this(factory, name)
|
||||
{
|
||||
ParentName = parentName;
|
||||
}
|
||||
|
||||
|
||||
public virtual XmlSerializer GetSerializer() { return new XmlSerializer(GetType()); }
|
||||
|
||||
public Component CreateDbEntity()
|
||||
{
|
||||
using (var writer = new StringWriter())
|
||||
{
|
||||
GetSerializer().Serialize(writer, this);
|
||||
return Component.CreateFromCfg(Name, Factory.ClassName, ParentName, ItemNr, DebugLevel, LogLevel, writer.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public static IComponentCfg CreateFromDbEntity(XmlSerializer s, Component cmpntEntity, IComponentFactory factory)
|
||||
{
|
||||
using (var reader = new StringReader(cmpntEntity.Parameters))
|
||||
{
|
||||
IComponentCfg config = s.Deserialize(reader) as IComponentCfg;
|
||||
if (config != null)
|
||||
{
|
||||
config.Id = cmpntEntity.Id;
|
||||
config.Name = cmpntEntity.Name;
|
||||
config.ParentName = cmpntEntity.ParentName;
|
||||
config.ItemNr = cmpntEntity.ItemNr;
|
||||
config.DebugLevel = cmpntEntity.Mode;
|
||||
config.LogLevel = cmpntEntity.Logging;
|
||||
config.Corrections = cmpntEntity.Corrections;
|
||||
config.Uncertainties = cmpntEntity.Uncertainties;
|
||||
config.Factory = factory;
|
||||
}
|
||||
return config;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void LoadTestParamsFromDB(Test test)
|
||||
{
|
||||
ITestParams tstPrms = (GetRuntimeTestParamsProvider() as ITestParams);
|
||||
if (tstPrms != null)
|
||||
{
|
||||
tstPrms.FromDbEntity(Name, test);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void LoadProcedureParamsFromDB(Procedure procedure)
|
||||
{
|
||||
IProcedureParams procPrms = (GetRuntimeProcParamsProvider() as IProcedureParams);
|
||||
if (procPrms != null)
|
||||
{
|
||||
procPrms.FromDbEntity(Name, procedure);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// If there are any procedure parameters, this function should be overriden
|
||||
/// by one returning a reference to a newly created object
|
||||
/// implementing IParamsProvider and IProcedureParams.
|
||||
///
|
||||
/// This default implementation returns null = no procedure parameters.
|
||||
/// </summary>
|
||||
/// <returns>Procedure parameters provider for this component or null</returns>
|
||||
public virtual IParamsProvider CreateProcParamsProvider()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If there are any procedure parameters, this function should be overriden
|
||||
/// by one returning a reference to an object
|
||||
/// implementing IParamsProvider and IProcedureParams used in runtime.
|
||||
///
|
||||
/// This default implementation returns null = no procedure parameters.
|
||||
/// </summary>
|
||||
/// <returns>Procedure parameters provider for this component or null</returns>
|
||||
public virtual IParamsProvider GetRuntimeProcParamsProvider()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public virtual IParamsProvider GetUIProcParamsProvider(Procedure procedure)
|
||||
{
|
||||
if (GetRuntimeProcParamsProvider() == null)
|
||||
{
|
||||
/// Component has no test parametes
|
||||
return null;
|
||||
}
|
||||
|
||||
ComponentProcedure procParamsEntity = procedure.GetProcedureParamsEntity(Name);
|
||||
|
||||
if (procParamsEntity != null)
|
||||
{
|
||||
if (procParamsEntity.GetParamsProvider() != null)
|
||||
{
|
||||
/// Parameters provider for this entity already fetched - return it
|
||||
return procParamsEntity.GetParamsProvider();
|
||||
}
|
||||
else
|
||||
{
|
||||
/// Parameters provider for this entity will be created and updated from the entity later on
|
||||
IParamsProvider paramsProvider = CreateProcParamsProvider();
|
||||
(paramsProvider as IProcedureParams).UpdateFromDbEntity(procParamsEntity);
|
||||
procParamsEntity.SetParamsProvider(paramsProvider);
|
||||
return paramsProvider;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
IParamsProvider paramsProvider = CreateProcParamsProvider();
|
||||
(paramsProvider as IProcedureParams).FromDbEntity(Name, procedure);
|
||||
return paramsProvider;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// If there are any procedure parameters, this function should be overriden
|
||||
/// by one returning a reference to a newly created object
|
||||
/// implementing IParamsProvider and ITestParams.
|
||||
///
|
||||
/// This default implementation returns null = no test parameters.
|
||||
/// </summary>
|
||||
/// <returns>Procedure parameters provider for this component or null</returns>
|
||||
public virtual IParamsProvider CreateTestParamsProvider()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If there are any test parameters, this function should be overriden
|
||||
/// by one returning a reference to an object
|
||||
/// implementing IParamsProvider and ITestParams used in runtime.
|
||||
///
|
||||
/// This default implementation returns null = no test parameters.
|
||||
/// </summary>
|
||||
/// <returns>Test parameters provider for this component or null</returns>
|
||||
public virtual IParamsProvider GetRuntimeTestParamsProvider()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public virtual IParamsProvider GetUITestParamsProvider(Test test)
|
||||
{
|
||||
if (GetRuntimeTestParamsProvider() == null)
|
||||
{
|
||||
/// Component has no test parametes
|
||||
return null;
|
||||
}
|
||||
|
||||
ComponentTest testParamsEntity = test.GetTestParamsEntity(Name);
|
||||
|
||||
if (testParamsEntity != null)
|
||||
{
|
||||
if (testParamsEntity.GetParamsProvider() != null)
|
||||
{
|
||||
/// Parameters provider for this entity already fetched - return it
|
||||
return testParamsEntity.GetParamsProvider();
|
||||
}
|
||||
else
|
||||
{
|
||||
/// Parameters provider for this entity will be created and updated from the entity later on
|
||||
IParamsProvider paramsProvider = CreateTestParamsProvider();
|
||||
(paramsProvider as ITestParams).UpdateFromDbEntity(testParamsEntity);
|
||||
testParamsEntity.SetParamsProvider(paramsProvider);
|
||||
return paramsProvider;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
IParamsProvider paramsProvider = CreateTestParamsProvider();
|
||||
(paramsProvider as ITestParams).FromDbEntity(Name, test);
|
||||
return paramsProvider;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
using TBF.Rig;
|
||||
|
||||
namespace TBF.Rig.Configs
|
||||
{
|
||||
public class ConfigCtrlUtils : UserControl
|
||||
{
|
||||
protected PageOrientation GetOrientation(string str)
|
||||
{
|
||||
if (str.Equals(PageOrientation.Landscape.ToString())) return PageOrientation.Landscape;
|
||||
if (str.Equals(PageOrientation.Portrait.ToString())) return PageOrientation.Portrait;
|
||||
return (PageOrientation)(-1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates destination variable when its value differes from the source value.
|
||||
/// Returns appropriate flags
|
||||
/// </summary>
|
||||
/// <param name="cfgVar">Reference to destination variable</param>
|
||||
/// <param name="intVal">Source value</param>
|
||||
/// <param name="flagsWhenUpdated">Flags returned when an update occurs</param>
|
||||
/// <returns>Flags or 0</returns>
|
||||
protected CfgUpdateFlags UpdateDifferent(ref int cfgVar, int intVal, CfgUpdateFlags flagsWhenUpdated)
|
||||
{
|
||||
if (cfgVar != intVal) { cfgVar = intVal; return flagsWhenUpdated; } else return 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates destination variable when its value differes from the source value.
|
||||
/// Returns appropriate flags
|
||||
/// </summary>
|
||||
/// <param name="cfgVar">Reference to destination variable</param>
|
||||
/// <param name="toBeParsedString">Source integer value is obtained by parsing this string</param>
|
||||
/// <param name="flagsWhenUpdated">Flags returned when an update occurs</param>
|
||||
/// <returns>Flags or 0</returns>
|
||||
protected CfgUpdateFlags UpdateDifferent(ref int cfgVar, string toBeParsedString, CfgUpdateFlags flagsWhenUpdated)
|
||||
{
|
||||
int itmp = int.Parse(toBeParsedString);
|
||||
if (cfgVar != itmp) { cfgVar = itmp; return flagsWhenUpdated; } else return 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates destination variable when its value differes from the source value.
|
||||
/// Returns appropriate flags
|
||||
/// </summary>
|
||||
/// <param name="cfgVar">Reference to destination variable</param>
|
||||
/// <param name="toBeParsedString">Source integer value is obtained by parsing this string</param>
|
||||
/// <param name="flagsWhenUpdated">Flags returned when an update occurs</param>
|
||||
/// <returns>Flags or 0</returns>
|
||||
protected CfgUpdateFlags UpdateDifferent(ref float cfgVar, string toBeParsedString, CfgUpdateFlags flagsWhenUpdated)
|
||||
{
|
||||
float ftmp = Utils.ParseSFloat(toBeParsedString);
|
||||
if (cfgVar != ftmp) { cfgVar = ftmp; return flagsWhenUpdated; } else return 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates destination variable when its value differes from the source value.
|
||||
/// Returns appropriate flags
|
||||
/// </summary>
|
||||
/// <param name="cfgVar">Reference to destination variable</param>
|
||||
/// <param name="toBeParsedString">Source integer value is obtained by parsing this string</param>
|
||||
/// <param name="flagsWhenUpdated">Flags returned when an update occurs</param>
|
||||
/// <returns>Flags or 0</returns>
|
||||
protected CfgUpdateFlags UpdateDifferent(ref double cfgVar, string toBeParsedString, CfgUpdateFlags flagsWhenUpdated)
|
||||
{
|
||||
double dtmp = Utils.ParseSDouble(toBeParsedString);
|
||||
if (cfgVar != dtmp) { cfgVar = dtmp; return flagsWhenUpdated; } else return 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates destination variable when its value differes from the source value.
|
||||
/// Returns appropriate flags
|
||||
/// </summary>
|
||||
/// <param name="cfgVar">Reference to destination variable</param>
|
||||
/// <param name="boolVal">Source value</param>
|
||||
/// <param name="flagsWhenUpdated">Flags returned when an update occurs</param>
|
||||
/// <returns>Flags or 0</returns>
|
||||
protected CfgUpdateFlags UpdateDifferent(ref bool cfgVar, bool boolVal, CfgUpdateFlags flagsWhenUpdated)
|
||||
{
|
||||
if (cfgVar != boolVal) { cfgVar = boolVal; return flagsWhenUpdated; } else return 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates destination variable when its value differes from the source value.
|
||||
/// Returns appropriate flags
|
||||
/// </summary>
|
||||
/// <param name="cfgVar">Reference to destination variable</param>
|
||||
/// <param name="stringVal">Source value</param>
|
||||
/// <param name="flagsWhenUpdated">Flags returned when an update occurs</param>
|
||||
/// <returns>Flags or 0</returns>
|
||||
protected CfgUpdateFlags UpdateDifferent(ref string cfgVar, string stringVal, CfgUpdateFlags flagsWhenUpdated)
|
||||
{
|
||||
if (cfgVar != stringVal) { cfgVar = stringVal; return flagsWhenUpdated; } else return 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates destination variable when its value differes from the source value.
|
||||
/// Returns appropriate flags
|
||||
/// </summary>
|
||||
/// <param name="cfgVar">Reference to destination array</param>
|
||||
/// <param name="stringArrVal">Source array of strings</param>
|
||||
/// <param name="flagsWhenUpdated">Flags returned when an update occurs</param>
|
||||
/// <returns>Flags or 0</returns>
|
||||
protected CfgUpdateFlags UpdateDifferent(ref string[] cfgVar, string[] stringArrVal, CfgUpdateFlags flagsWhenUpdated)
|
||||
{
|
||||
if (cfgVar == null && stringArrVal == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else if (cfgVar == null || stringArrVal == null || !cfgVar.SequenceEqual<string>(stringArrVal))
|
||||
{
|
||||
cfgVar = stringArrVal;
|
||||
return flagsWhenUpdated;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
///
|
||||
/// Copyright (c) 2016 Sensus Metering Systems
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using TBF.Rig.Generic;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace TBF.Rig.Configs.NameOnly
|
||||
{
|
||||
public class TestMethodCfg : ComponentCfgBase, Generic.IComponentCfg
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TestMethodCfg) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
public IComponentCfgCtrl GetControl(IList<Config.Entities.Component> cmpntEntities) { return new TestMethodCfgCtrl(); }
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
TestMethodCfg() { }
|
||||
|
||||
public TestMethodCfg(string name, IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
Name = name;
|
||||
Factory = factory;
|
||||
ParentName = string.Empty;
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("Name={0}", Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
///
|
||||
/// Copyright (c) 2016 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
using TBF.Rig.Generic;
|
||||
|
||||
namespace TBF.Rig.Configs.NameOnly
|
||||
{
|
||||
public partial class TestMethodCfgCtrl : UserControl, IComponentCfgCtrl
|
||||
{
|
||||
public bool ShowMore { get { return false; } }
|
||||
|
||||
TestMethodCfg config;
|
||||
public IComponentCfg Config
|
||||
{
|
||||
get { return config as IComponentCfg; }
|
||||
set
|
||||
{
|
||||
config = value as TestMethodCfg;
|
||||
Redraw();
|
||||
}
|
||||
}
|
||||
|
||||
public TestMethodCfgCtrl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void EntryFormCfgCtrl_Load(object sender, EventArgs e)
|
||||
{
|
||||
Redraw();
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public void Unlock()
|
||||
{
|
||||
nameTextBox.Enabled = true;
|
||||
}
|
||||
|
||||
public CfgUpdateFlags VerifyCfg(ref string message)
|
||||
{
|
||||
CfgUpdateFlags flags = CfgUpdateFlags.None;
|
||||
return flags;
|
||||
}
|
||||
|
||||
public CfgUpdateFlags UpdateCfg()
|
||||
{
|
||||
CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd;
|
||||
|
||||
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
|
||||
|
||||
config.Name = nameTextBox.Text;
|
||||
|
||||
return flags;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
///
|
||||
/// Copyright (c) 2016 Sensus Metering Systems
|
||||
///
|
||||
namespace TBF.Rig.Configs.NameOnly
|
||||
{
|
||||
partial class TestMethodCfgCtrl
|
||||
{
|
||||
/// <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 Component 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.nameTextBox = new System.Windows.Forms.TextBox();
|
||||
this.nameLabel = new System.Windows.Forms.Label();
|
||||
this.classNameLabel = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// nameTextBox
|
||||
//
|
||||
this.nameTextBox.Enabled = false;
|
||||
this.nameTextBox.Location = new System.Drawing.Point(137, 57);
|
||||
this.nameTextBox.Name = "nameTextBox";
|
||||
this.nameTextBox.Size = new System.Drawing.Size(130, 20);
|
||||
this.nameTextBox.TabIndex = 5;
|
||||
//
|
||||
// nameLabel
|
||||
//
|
||||
this.nameLabel.AutoSize = true;
|
||||
this.nameLabel.Location = new System.Drawing.Point(27, 60);
|
||||
this.nameLabel.Name = "nameLabel";
|
||||
this.nameLabel.Size = new System.Drawing.Size(35, 13);
|
||||
this.nameLabel.TabIndex = 4;
|
||||
this.nameLabel.Text = "Name";
|
||||
//
|
||||
// classNameLabel
|
||||
//
|
||||
this.classNameLabel.AutoSize = true;
|
||||
this.classNameLabel.Location = new System.Drawing.Point(134, 33);
|
||||
this.classNameLabel.Name = "classNameLabel";
|
||||
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
|
||||
this.classNameLabel.TabIndex = 3;
|
||||
this.classNameLabel.Text = "ComonentName";
|
||||
//
|
||||
// BasicPrinterCfgCtrl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.nameTextBox);
|
||||
this.Controls.Add(this.nameLabel);
|
||||
this.Controls.Add(this.classNameLabel);
|
||||
this.Name = "BasicPrinterCfgCtrl";
|
||||
this.Size = new System.Drawing.Size(300, 200);
|
||||
this.Load += new System.EventHandler(this.EntryFormCfgCtrl_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;
|
||||
}
|
||||
}
|
||||
@@ -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>
|
||||
@@ -0,0 +1,200 @@
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
using log4net;
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
using TBF.Rig.Generic;
|
||||
using TBF.Resources;
|
||||
|
||||
namespace TBF.Rig.Configs.ParamsProvider
|
||||
{
|
||||
public partial class ComponentCfgCtrl : UserControl, IComponentCfgCtrl
|
||||
{
|
||||
static readonly ILog log = LogManager.GetLogger(typeof(ComponentCfgCtrl));
|
||||
|
||||
public bool ShowMore { get { return false; } }
|
||||
|
||||
|
||||
IParamsProvider paramsProvider;
|
||||
///
|
||||
public IComponentCfg Config
|
||||
{
|
||||
get
|
||||
{
|
||||
return paramsProvider as IComponentCfg;
|
||||
}
|
||||
set
|
||||
{
|
||||
paramsProvider = value as IParamsProvider;
|
||||
Redraw();
|
||||
}
|
||||
}
|
||||
|
||||
IList<string> parents;
|
||||
Control[] editors;
|
||||
CfgUpdateFlags flags;
|
||||
|
||||
public ComponentCfgCtrl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="paramsProvider">Parameters provider implementing IComponentCfg and IParamsProvider</param>
|
||||
/// <param name="parents">A list of parents or null, null hides parentComboBox</param>
|
||||
public ComponentCfgCtrl(IParamsProvider paramsProvider, IList<string> parents)
|
||||
: this()
|
||||
{
|
||||
this.paramsProvider = paramsProvider;
|
||||
this.parents = parents;
|
||||
|
||||
if (parents == null)
|
||||
{
|
||||
parentLabel.Visible = false;
|
||||
parentComboBox.Visible = false;
|
||||
}
|
||||
|
||||
editors = new Control[paramsProvider.ParamsCount()];
|
||||
for (int i = 0; i < paramsProvider.ParamsCount(); i++)
|
||||
{
|
||||
ICollection<string> values = paramsProvider.ParamValues(i);
|
||||
if (values == null)
|
||||
{
|
||||
editors[i] = new TextBox();
|
||||
}
|
||||
else
|
||||
{
|
||||
ComboBox cb = new ComboBox();
|
||||
foreach (var v in values) cb.Items.Add(v);
|
||||
editors[i] = cb;
|
||||
}
|
||||
editors[i].Visible = false;
|
||||
this.Controls.Add(editors[i]);
|
||||
}
|
||||
|
||||
flags = CfgUpdateFlags.None;
|
||||
|
||||
paramsListViewEx.SubItemClicked += new Results.Forms.SubItemEventHandler(paramsListViewEx_SubItemClicked);
|
||||
paramsListViewEx.SubItemEndEditing += new Results.Forms.SubItemEndEditingEventHandler(paramsListViewEx_SubItemEndEditing);
|
||||
}
|
||||
|
||||
void Localize()
|
||||
{
|
||||
componentClassLabel.Text = Strings.Component_class;
|
||||
nameLabel.Text = Strings.Name;
|
||||
parentLabel.Text = Strings.Parent_name;
|
||||
}
|
||||
|
||||
private void EntryFormCfgCtrl_Load(object sender, EventArgs e)
|
||||
{
|
||||
Localize();
|
||||
paramsListViewEx.Columns.Add(Strings.Parameter, 210);
|
||||
paramsListViewEx.Columns.Add(Strings.Value, 210);
|
||||
if (parents != null)
|
||||
{
|
||||
foreach (var p in parents) parentComboBox.Items.Add(p);
|
||||
}
|
||||
Redraw();
|
||||
}
|
||||
|
||||
public void Closing()
|
||||
{
|
||||
/// Close CmdResponse handlers here
|
||||
}
|
||||
|
||||
void Redraw()
|
||||
{
|
||||
if (paramsProvider == null) return; /// Control was not loaded, settings were not changed
|
||||
|
||||
componentClassTextBox.Text = Config.Factory.ClassName;
|
||||
nameTextBox.Text = Config.Name;
|
||||
|
||||
if (parents != null) parentComboBox.Text = Config.ParentName;
|
||||
|
||||
paramsListViewEx.Items.Clear();
|
||||
for (int i = 0; i < paramsProvider.ParamsCount(); i++)
|
||||
{
|
||||
ListViewItem lvi = new ListViewItem(paramsProvider.ParamName(i));
|
||||
lvi.SubItems.Add(paramsProvider.ToString(i));
|
||||
lvi.Tag = i;
|
||||
paramsListViewEx.Items.Add(lvi);
|
||||
}
|
||||
}
|
||||
|
||||
public void Unlock()
|
||||
{
|
||||
nameTextBox.Enabled = true;
|
||||
if (parents != null) parentComboBox.Enabled = true;
|
||||
paramsListViewEx.Enabled = true;
|
||||
}
|
||||
|
||||
public CfgUpdateFlags VerifyCfg(ref string message)
|
||||
{
|
||||
if (parents == null) return CfgUpdateFlags.None;
|
||||
|
||||
/// Verify the parent
|
||||
foreach (var item in parentComboBox.Items)
|
||||
{
|
||||
if (parentComboBox.Text == item.ToString()) return CfgUpdateFlags.None;
|
||||
}
|
||||
|
||||
message += Environment.NewLine + string.Format(Strings.Invalid_0, parentLabel.Text);
|
||||
return CfgUpdateFlags.Error;
|
||||
}
|
||||
|
||||
public CfgUpdateFlags UpdateCfg()
|
||||
{
|
||||
if (paramsProvider == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
|
||||
|
||||
CfgUpdateFlags f = this.flags;
|
||||
|
||||
if (Config.Name != nameTextBox.Text)
|
||||
{
|
||||
Config.Name = nameTextBox.Text;
|
||||
f |= CfgUpdateFlags.RestartRqrd;
|
||||
}
|
||||
|
||||
if (parents != null)
|
||||
{
|
||||
if (Config.ParentName != parentComboBox.Text)
|
||||
{
|
||||
Config.ParentName = parentComboBox.Text;
|
||||
f |= CfgUpdateFlags.RestartRqrd;
|
||||
}
|
||||
}
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
private void paramsListViewEx_SubItemClicked(object sender, Results.Forms.SubItemEventArgs e)
|
||||
{
|
||||
if (e.SubItem != 1) return;
|
||||
int itemNr = (int)e.Item.Tag;
|
||||
paramsListViewEx.StartEditing(editors[itemNr], e.Item, e.SubItem);
|
||||
}
|
||||
|
||||
private void paramsListViewEx_SubItemEndEditing(object sender, Results.Forms.SubItemEndEditingEventArgs e)
|
||||
{
|
||||
if (e.SubItem != 1) return;
|
||||
int itemNr = (int)e.Item.Tag;
|
||||
|
||||
string message;
|
||||
if (paramsProvider.ValidateParam(itemNr, e.DisplayText, out message))
|
||||
{
|
||||
flags |= paramsProvider.UpdateParam(itemNr, e.DisplayText);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show(message);
|
||||
e.DisplayText = e.Item.SubItems[e.SubItem].Text;
|
||||
e.Cancel = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,171 @@
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
||||
///
|
||||
namespace TBF.Rig.Configs.ParamsProvider
|
||||
{
|
||||
partial class ComponentCfgCtrl
|
||||
{
|
||||
/// <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 Component 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.nameTextBox = new System.Windows.Forms.TextBox();
|
||||
this.nameLabel = new System.Windows.Forms.Label();
|
||||
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
|
||||
this.parentComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.parentLabel = new System.Windows.Forms.Label();
|
||||
this.componentClassLabel = new System.Windows.Forms.Label();
|
||||
this.componentClassTextBox = new System.Windows.Forms.TextBox();
|
||||
this.paramsListViewEx = new Results.Forms.ListViewEx();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
|
||||
this.splitContainer1.Panel1.SuspendLayout();
|
||||
this.splitContainer1.Panel2.SuspendLayout();
|
||||
this.splitContainer1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// nameTextBox
|
||||
//
|
||||
this.nameTextBox.Enabled = false;
|
||||
this.nameTextBox.Location = new System.Drawing.Point(161, 30);
|
||||
this.nameTextBox.Name = "nameTextBox";
|
||||
this.nameTextBox.Size = new System.Drawing.Size(262, 20);
|
||||
this.nameTextBox.TabIndex = 5;
|
||||
//
|
||||
// nameLabel
|
||||
//
|
||||
this.nameLabel.AutoSize = true;
|
||||
this.nameLabel.Location = new System.Drawing.Point(6, 33);
|
||||
this.nameLabel.Name = "nameLabel";
|
||||
this.nameLabel.Size = new System.Drawing.Size(35, 13);
|
||||
this.nameLabel.TabIndex = 4;
|
||||
this.nameLabel.Text = "Name";
|
||||
//
|
||||
// splitContainer1
|
||||
//
|
||||
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
|
||||
this.splitContainer1.IsSplitterFixed = true;
|
||||
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
|
||||
this.splitContainer1.Name = "splitContainer1";
|
||||
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
|
||||
//
|
||||
// splitContainer1.Panel1
|
||||
//
|
||||
this.splitContainer1.Panel1.Controls.Add(this.parentComboBox);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.parentLabel);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.componentClassLabel);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.componentClassTextBox);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.nameLabel);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.nameTextBox);
|
||||
//
|
||||
// splitContainer1.Panel2
|
||||
//
|
||||
this.splitContainer1.Panel2.Controls.Add(this.paramsListViewEx);
|
||||
this.splitContainer1.Size = new System.Drawing.Size(444, 353);
|
||||
this.splitContainer1.SplitterDistance = 80;
|
||||
this.splitContainer1.TabIndex = 6;
|
||||
//
|
||||
// parentComboBox
|
||||
//
|
||||
this.parentComboBox.Enabled = false;
|
||||
this.parentComboBox.FormattingEnabled = true;
|
||||
this.parentComboBox.Location = new System.Drawing.Point(161, 52);
|
||||
this.parentComboBox.Name = "parentComboBox";
|
||||
this.parentComboBox.Size = new System.Drawing.Size(262, 21);
|
||||
this.parentComboBox.TabIndex = 9;
|
||||
//
|
||||
// parentLabel
|
||||
//
|
||||
this.parentLabel.AutoSize = true;
|
||||
this.parentLabel.Location = new System.Drawing.Point(6, 55);
|
||||
this.parentLabel.Name = "parentLabel";
|
||||
this.parentLabel.Size = new System.Drawing.Size(38, 13);
|
||||
this.parentLabel.TabIndex = 8;
|
||||
this.parentLabel.Text = "Parent";
|
||||
//
|
||||
// componentClassLabel
|
||||
//
|
||||
this.componentClassLabel.AutoSize = true;
|
||||
this.componentClassLabel.Location = new System.Drawing.Point(6, 11);
|
||||
this.componentClassLabel.Name = "componentClassLabel";
|
||||
this.componentClassLabel.Size = new System.Drawing.Size(89, 13);
|
||||
this.componentClassLabel.TabIndex = 7;
|
||||
this.componentClassLabel.Text = "Component Class";
|
||||
//
|
||||
// componentClassTextBox
|
||||
//
|
||||
this.componentClassTextBox.Enabled = false;
|
||||
this.componentClassTextBox.Location = new System.Drawing.Point(161, 8);
|
||||
this.componentClassTextBox.Name = "componentClassTextBox";
|
||||
this.componentClassTextBox.Size = new System.Drawing.Size(262, 20);
|
||||
this.componentClassTextBox.TabIndex = 6;
|
||||
//
|
||||
// paramsListViewEx
|
||||
//
|
||||
this.paramsListViewEx.AllowColumnReorder = true;
|
||||
this.paramsListViewEx.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.paramsListViewEx.DoubleClickActivation = false;
|
||||
this.paramsListViewEx.Enabled = false;
|
||||
this.paramsListViewEx.FullRowSelect = true;
|
||||
this.paramsListViewEx.GridLines = true;
|
||||
this.paramsListViewEx.LabelWrap = false;
|
||||
this.paramsListViewEx.Location = new System.Drawing.Point(0, 0);
|
||||
this.paramsListViewEx.Name = "paramsListViewEx";
|
||||
this.paramsListViewEx.Size = new System.Drawing.Size(444, 269);
|
||||
this.paramsListViewEx.TabIndex = 0;
|
||||
this.paramsListViewEx.UseCompatibleStateImageBehavior = false;
|
||||
this.paramsListViewEx.View = System.Windows.Forms.View.Details;
|
||||
this.paramsListViewEx.SubItemClicked += new Results.Forms.SubItemEventHandler(this.paramsListViewEx_SubItemClicked);
|
||||
this.paramsListViewEx.SubItemEndEditing += new Results.Forms.SubItemEndEditingEventHandler(this.paramsListViewEx_SubItemEndEditing);
|
||||
//
|
||||
// ComponentCfgCtrl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.splitContainer1);
|
||||
this.Name = "ComponentCfgCtrl";
|
||||
this.Size = new System.Drawing.Size(444, 353);
|
||||
this.Load += new System.EventHandler(this.EntryFormCfgCtrl_Load);
|
||||
this.splitContainer1.Panel1.ResumeLayout(false);
|
||||
this.splitContainer1.Panel1.PerformLayout();
|
||||
this.splitContainer1.Panel2.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
|
||||
this.splitContainer1.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TextBox nameTextBox;
|
||||
private System.Windows.Forms.Label nameLabel;
|
||||
private System.Windows.Forms.SplitContainer splitContainer1;
|
||||
private System.Windows.Forms.ComboBox parentComboBox;
|
||||
private System.Windows.Forms.Label parentLabel;
|
||||
private System.Windows.Forms.Label componentClassLabel;
|
||||
private System.Windows.Forms.TextBox componentClassTextBox;
|
||||
private Results.Forms.ListViewEx paramsListViewEx;
|
||||
}
|
||||
}
|
||||
@@ -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>
|
||||
@@ -0,0 +1,14 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2017 Sensus Metering Systems
|
||||
///
|
||||
namespace TBF.Rig
|
||||
{
|
||||
public static class Constants
|
||||
{
|
||||
/// <summary>
|
||||
/// A fraction of the tank volume that is considered to be safe.
|
||||
/// When the estimated test end tank volume exceeds this fraction, tank emptying is forced.
|
||||
/// </summary>
|
||||
public const float TankFullFactor = 0.95f;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,364 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO.Ports;
|
||||
using System.Text;
|
||||
using log4net;
|
||||
using Common;
|
||||
using TBF.Rig.Generic;
|
||||
using TBF.Boxes;
|
||||
using Dirichlet.Numerics;
|
||||
|
||||
namespace TBF.Rig.Danfoss.VLT2800
|
||||
{
|
||||
/// <summary>
|
||||
/// See page 20 of MG10S202 Operational Instructions Modbus RTU
|
||||
/// </summary>
|
||||
public enum CW : ushort
|
||||
{
|
||||
PresetRefLsb = (1 << 0),
|
||||
PresetRefMsb = (1 << 1),
|
||||
Not_DcBraking = (1 << 2),
|
||||
Not_CoastingStop = (1 << 3),
|
||||
Not_QuickStop = (1 << 4),
|
||||
Not_FreezeFreq = (1 << 5),
|
||||
Start_NotRampStop = (1 << 6),
|
||||
Reset = (1 << 7),
|
||||
Jog = (1 << 8),
|
||||
Ramp2_NotRamp1 = (1 << 9),
|
||||
DataValid = (1 << 10),
|
||||
Relay01Activ = (1 << 11),
|
||||
DOut46Activ = (1 << 12),
|
||||
SelectSetupLsb = (1 << 13),
|
||||
SelectSetupMsb = (1 << 14),
|
||||
Reversing = (1 << 15),
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// See page 22 of MG10S202 Operational Instructions Modbus RTU
|
||||
/// </summary>
|
||||
public enum SW : ushort
|
||||
{
|
||||
ControlReady = (1 << 0),
|
||||
DriveReady = (1 << 1),
|
||||
CoastingStop = (1 << 2),
|
||||
Trip = (1 << 3),
|
||||
TripLock = (1 << 6),
|
||||
Warning = (1 << 7),
|
||||
SpeedEqRef = (1 << 8),
|
||||
RemoteCtrl = (1 << 9),
|
||||
FreqLimitOK = (1 << 10),
|
||||
MotorRunning = (1 << 11),
|
||||
VoltageWarn = (1 << 13),
|
||||
CurrentLimit = (1 << 14),
|
||||
ThermalWarn = (1 << 15),
|
||||
}
|
||||
|
||||
public enum Function : byte
|
||||
{
|
||||
ReadCoilStatus = 0x01,
|
||||
ForceSingleCoil = 0x05,
|
||||
ForceMultipleCoils = 0x0F,
|
||||
ReadHoldingRegisters = 0x03,
|
||||
PresetSingleRegister = 0x06,
|
||||
PresetMultipleRegisters = 0x10,
|
||||
}
|
||||
|
||||
|
||||
public class Pump : ComponentBase, IDevice, IOperation, GenericDevices.IPumpFM, GenericDevices.IValve
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(Pump));
|
||||
public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
|
||||
|
||||
private readonly PumpCfg pumpCfg;
|
||||
|
||||
public int Delay { get { return pumpCfg.Delay; } }
|
||||
public ValveCategory Category { get { return ValveCategory.Feeding; } } /// Pump category is Feeding
|
||||
public GenericDevices.IValve CoupledTo { get { return null; } }
|
||||
public bool InvertCouple { get { return false; } }
|
||||
public int LagOpening { get { return 0; } }
|
||||
public int LagClosing { get { return 0; } }
|
||||
|
||||
/// <summary>
|
||||
/// Pump power in [%] in range 0 .. 100.0f
|
||||
/// </summary>
|
||||
private float power;
|
||||
public float Power { get { return power; } }
|
||||
|
||||
|
||||
readonly Elde.ControlBoardDev controlBoard;
|
||||
|
||||
int bitNr; /// 0 .. 127
|
||||
public UInt128 Mask; /// derived from bitPosition in the constructor
|
||||
|
||||
public bool State { get { return (controlBoard.Route & Mask) != 0; } }
|
||||
|
||||
/// Private fields
|
||||
SerialPort serialPort;
|
||||
bool dataToSendReady;
|
||||
byte[] dataToSend;
|
||||
StringBuilder responseBuilder;
|
||||
|
||||
|
||||
public Pump() { }
|
||||
|
||||
/// <summary>
|
||||
/// Ambient temperature / humidity / pressure meter 'Greco' connected via serial interface (RS232)
|
||||
/// Connection settings: 19200 Bd 8-bits No-parity 1-stop-bit Flow control: none or hardware.
|
||||
/// </summary>
|
||||
public Pump(Generic.IComponentCfg cfg, IList<Generic.IComponent> components)
|
||||
: base(cfg)
|
||||
{
|
||||
pumpCfg = cfg as PumpCfg;
|
||||
|
||||
controlBoard = (Elde.ControlBoardDev)TbfComponents.FindComponent("CB", components); /// TODO: replace "CB"
|
||||
if (controlBoard == null) throw new Exception("Cannot find " + Name + " parent");
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
bitNr = pumpCfg.BitPosition;
|
||||
Mask = (((UInt128)1) << bitNr);
|
||||
#if MUNICH
|
||||
Mask |= (((UInt128)1) << (bitNr + 1));
|
||||
#endif
|
||||
|
||||
if (pumpCfg.DebugLevel == DebugMode.Normal)
|
||||
{
|
||||
string comPortName = "COM" + pumpCfg.ComPortNr.ToString();
|
||||
serialPort = new SerialPort(comPortName, pumpCfg.BaudRate, pumpCfg.Parity, pumpCfg.DataBits, pumpCfg.StopBits);
|
||||
serialPort.Handshake = Handshake.None;
|
||||
serialPort.Open();
|
||||
responseBuilder = new StringBuilder(40);
|
||||
log.FatalFormat("{0} initialized: {1}", Name, this);
|
||||
}
|
||||
else
|
||||
{
|
||||
serialPort = null;
|
||||
log.FatalFormat("{0} simulated: {1}", Name, this);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Run this device</summary>
|
||||
public void RunDeviceBefore()
|
||||
{
|
||||
if (pumpCfg.DebugLevel == DebugMode.Simulate) return;
|
||||
|
||||
responseBuilder.Append(serialPort.ReadExisting());
|
||||
|
||||
/// Check if the response is complete
|
||||
if (responseBuilder.Length >= 8)
|
||||
{
|
||||
string response = responseBuilder.ToString();
|
||||
responseBuilder.Clear();
|
||||
|
||||
log.Info(Telegram.LogTelegram("Received ", response));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Prepares data to be sent in RunDeviceAfter() function
|
||||
/// </summary>
|
||||
bool SendData(byte[] data)
|
||||
{
|
||||
if (dataToSendReady) return false;
|
||||
dataToSend = data;
|
||||
dataToSendReady = true;
|
||||
|
||||
log.Info(Telegram.LogTelegram("Sending ", data));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>Run this device</summary>
|
||||
public void RunDeviceAfter()
|
||||
{
|
||||
if (dataToSendReady)
|
||||
{
|
||||
if (pumpCfg.DebugLevel != DebugMode.Simulate)
|
||||
{
|
||||
serialPort.Write(dataToSend, 0, dataToSend.Length);
|
||||
}
|
||||
dataToSendReady = false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Stop this device</summary>
|
||||
public void StopDevice()
|
||||
{
|
||||
if (serialPort != null) serialPort.Close();
|
||||
}
|
||||
|
||||
public void StopDevice2() { }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Turn the pmp on using Modbus commad, use the variable frequency
|
||||
/// </summary>
|
||||
/// <param name="powerArg">Frequency in percent (-200.0 .. 200.0)</param>
|
||||
public void TurnOn(float powerArg)
|
||||
{
|
||||
log.DebugFormat("{0}.TurnOn({1})", Name, powerArg);
|
||||
|
||||
this.power = powerArg;
|
||||
|
||||
//UInt16 controlWord = 0x047C;
|
||||
UInt16 controlWord = (UInt16)(CW.Not_DcBraking |
|
||||
CW.Not_CoastingStop |
|
||||
CW.Not_QuickStop |
|
||||
CW.Not_FreezeFreq |
|
||||
CW.Start_NotRampStop |
|
||||
CW.DataValid);
|
||||
|
||||
UInt16 serialComReference = (UInt16)(Int16)((float)0x4000 * powerArg / 100.0f + 0.5f);
|
||||
|
||||
byte[] msg;
|
||||
if (pumpCfg.Protocol == PumpProtocol.Modbus)
|
||||
{
|
||||
msg = new byte[13];
|
||||
msg[0] = (byte)pumpCfg.BusAddress;
|
||||
msg[1] = (byte)Function.ForceMultipleCoils;
|
||||
msg[2] = 0; /// Data Hi
|
||||
msg[3] = 0; /// Data Lo
|
||||
msg[4] = 0; /// Nr. of coils Hi
|
||||
msg[5] = 0x20; /// Nr. of coils Lo
|
||||
msg[6] = 4; /// Byte count
|
||||
msg[7] = (byte)(controlWord & 0xFF); /// Control Word Lo
|
||||
msg[8] = (byte)(controlWord >> 8); /// Control Word Hi
|
||||
msg[9] = (byte)(serialComReference & 0xFF); /// Serial Com Reference Lo
|
||||
msg[10] = (byte)(serialComReference >> 8); /// Serial Com Reference Hi
|
||||
Telegram.UpdateTelegramCRC(msg);
|
||||
}
|
||||
else /// if (pumpCfg.Protocol == PumpProtocol.FC)
|
||||
{
|
||||
msg = new byte[8];
|
||||
msg[0] = 0x02; /// STX
|
||||
msg[1] = 6; /// lenght (6 bytes following this one)
|
||||
msg[2] = (byte)pumpCfg.BusAddress;
|
||||
msg[3] = (byte)(controlWord >> 8); /// Control Word Hi
|
||||
msg[4] = (byte)(controlWord & 0xFF); /// Control Word Lo
|
||||
msg[5] = (byte)(serialComReference >> 8); /// Serial Com Reference Hi
|
||||
msg[6] = (byte)(serialComReference & 0xFF); /// Serial Com Reference Lo
|
||||
Telegram.UpdateTelegramChecksum(msg);
|
||||
}
|
||||
SendData(msg);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Turn the pmp off using Modbus command
|
||||
/// </summary>
|
||||
public void TurnOff()
|
||||
{
|
||||
log.DebugFormat("{0}.TurnOff()", Name);
|
||||
|
||||
this.power = 0;
|
||||
|
||||
UInt16 controlWord = (UInt16)(CW.Not_DcBraking |
|
||||
CW.Not_CoastingStop |
|
||||
CW.Not_QuickStop |
|
||||
CW.Not_FreezeFreq |
|
||||
//CW.Start_NotRampStop |
|
||||
CW.DataValid);
|
||||
|
||||
UInt16 serialComReference = 0;
|
||||
|
||||
byte[] msg;
|
||||
if (pumpCfg.Protocol == PumpProtocol.Modbus)
|
||||
{
|
||||
msg = new byte[13];
|
||||
msg[0] = (byte)pumpCfg.BusAddress;
|
||||
msg[1] = (byte)Function.ForceMultipleCoils;
|
||||
msg[2] = 0; /// Data Hi
|
||||
msg[3] = 0; /// Data Lo
|
||||
msg[4] = 0; /// Nr. of coils Hi
|
||||
msg[5] = 0x20; /// Nr. of coils Lo
|
||||
msg[6] = 4; /// Byte count
|
||||
msg[7] = (byte)(controlWord & 0xFF); /// Control Word Lo
|
||||
msg[8] = (byte)(controlWord >> 8); /// Control Word Hi
|
||||
msg[9] = (byte)(serialComReference & 0xFF); /// Serial Com Reference Lo
|
||||
msg[10] = (byte)(serialComReference >> 8); /// Serial Com Reference Hi
|
||||
Telegram.UpdateTelegramCRC(msg);
|
||||
}
|
||||
else /// if (pumpCfg.Protocol == PumpProtocol.FC)
|
||||
{
|
||||
msg = new byte[8];
|
||||
msg[0] = 0x02; /// STX
|
||||
msg[1] = 6; /// lenght (6 bytes following this one)
|
||||
msg[2] = (byte)pumpCfg.BusAddress;
|
||||
msg[3] = (byte)(controlWord >> 8); /// Control Word Hi
|
||||
msg[4] = (byte)(controlWord & 0xFF); /// Control Word Lo
|
||||
msg[5] = (byte)(serialComReference >> 8); /// Serial Com Reference Hi
|
||||
msg[6] = (byte)(serialComReference & 0xFF); /// Serial Com Reference Lo
|
||||
Telegram.UpdateTelegramChecksum(msg);
|
||||
}
|
||||
SendData(msg);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// The currently running operation.
|
||||
/// </summary>
|
||||
public enum CurrentOp
|
||||
{
|
||||
None,
|
||||
TurnOn,
|
||||
TurnOff,
|
||||
}
|
||||
///
|
||||
CurrentOp currentOp;
|
||||
|
||||
float powerForOp;
|
||||
|
||||
/// <summary>
|
||||
/// Turn the pump frequency inverter on.
|
||||
/// </summary>
|
||||
public IOperation TurnOnOp(float powerArg)
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
currentOp = CurrentOp.TurnOn;
|
||||
powerForOp = powerArg;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Turn the pump frequency inverter on.
|
||||
/// </summary>
|
||||
public IOperation TurnOffOp()
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
currentOp = CurrentOp.TurnOff;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>Start the operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
switch (currentOp)
|
||||
{
|
||||
case CurrentOp.TurnOn:
|
||||
TurnOn(powerForOp);
|
||||
return;
|
||||
case CurrentOp.TurnOff:
|
||||
default:
|
||||
TurnOff();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Run the operation</summary>
|
||||
public Event Run()
|
||||
{
|
||||
return Event.TurnPumpOnOffDone;
|
||||
}
|
||||
|
||||
/// <summary>Stop the operation</summary>
|
||||
public void Stop()
|
||||
{
|
||||
currentOp = CurrentOp.None;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2016 Sensus Metering Systems
|
||||
///
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.IO.Ports;
|
||||
using System.Xml.Serialization;
|
||||
using TBF.Rig.Generic;
|
||||
|
||||
namespace TBF.Rig.Danfoss.VLT2800
|
||||
{
|
||||
public class PumpCfg : ComponentCfgBase, Generic.IComponentCfg
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(PumpCfg) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
public IComponentCfgCtrl GetControl(IList<Config.Entities.Component> cmpntEntities) { return new PumpCfgCtrl(); }
|
||||
|
||||
///
|
||||
/// Serialized parameters
|
||||
///
|
||||
public int Delay; // Delay of the pump function in [s] (affects the duration of transition sequence steps)
|
||||
public PumpProtocol Protocol; // Modbus or FC with Siemens address
|
||||
public int BitPosition;
|
||||
public int BusAddress; // Modbus or FC address in range 1..247 (Modbus) or 1..31 (FC with Siemens address)
|
||||
public int ComPortNr;
|
||||
public int BaudRate;
|
||||
public Parity Parity;
|
||||
public int DataBits;
|
||||
public StopBits StopBits;
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
PumpCfg()
|
||||
{
|
||||
Name = "Pump-Danfoss";
|
||||
ParentName = string.Empty;
|
||||
Delay = 1;
|
||||
ComPortNr = 3;
|
||||
|
||||
/// Default protocol settings (the same as Danfoss VLT2800 factory settings)
|
||||
Protocol = PumpProtocol.FC;
|
||||
BusAddress = 1;
|
||||
BaudRate = 9600;
|
||||
DataBits = 8;
|
||||
Parity = System.IO.Ports.Parity.Even; /// 'Parity.None' is the default value for Protocol = PumpProtocol.Modbus
|
||||
StopBits = System.IO.Ports.StopBits.One;
|
||||
}
|
||||
|
||||
public PumpCfg(IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
this.Factory = factory;
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("Name={0}, Delay={1}s, Protocol={2}, BusAddress={3}, Com{4}, {5}Bd, {6}-bits, parity={7}, stopBits={8}",
|
||||
Name, Delay, Protocol, BusAddress, ComPortNr, BaudRate, DataBits, Parity, StopBits);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2016 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using System.IO.Ports;
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
using TBF.Rig.Generic;
|
||||
|
||||
namespace TBF.Rig.Danfoss.VLT2800
|
||||
{
|
||||
public partial class PumpCfgCtrl : UserControl, IComponentCfgCtrl
|
||||
{
|
||||
public bool ShowMore { get { return false; } }
|
||||
|
||||
PumpCfg config;
|
||||
public IComponentCfg Config
|
||||
{
|
||||
get { return config as IComponentCfg; }
|
||||
set
|
||||
{
|
||||
config = value as PumpCfg;
|
||||
Redraw();
|
||||
}
|
||||
}
|
||||
|
||||
public PumpCfgCtrl()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
protocolComboBox.Items.Add(PumpProtocol.Modbus.ToString());
|
||||
protocolComboBox.Items.Add(PumpProtocol.FC.ToString());
|
||||
|
||||
parityComboBox.Items.Add(Parity.None.ToString());
|
||||
parityComboBox.Items.Add(Parity.Even.ToString());
|
||||
parityComboBox.Items.Add(Parity.Odd.ToString());
|
||||
|
||||
stopBitsComboBox.Items.Add(StopBits.None.ToString());
|
||||
stopBitsComboBox.Items.Add(StopBits.One.ToString());
|
||||
stopBitsComboBox.Items.Add(StopBits.OnePointFive.ToString());
|
||||
stopBitsComboBox.Items.Add(StopBits.Two.ToString());
|
||||
}
|
||||
|
||||
|
||||
private void AbbientCfgCtrl_Load(object sender, EventArgs e)
|
||||
{
|
||||
Redraw();
|
||||
}
|
||||
|
||||
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;
|
||||
delayTextBox.Text = config.Delay.ToString();
|
||||
bitPositionTextBox.Text = config.BitPosition.ToString();
|
||||
protocolComboBox.Text = config.Protocol.ToString();
|
||||
busAddressTextBox.Text = config.BusAddress.ToString();
|
||||
comPortNrTextBox.Text = config.ComPortNr.ToString();
|
||||
baudRateTextBox.Text = config.BaudRate.ToString();
|
||||
parityComboBox.Text = config.Parity.ToString();
|
||||
dataBitsTextBox.Text = config.DataBits.ToString();
|
||||
stopBitsComboBox.Text = config.StopBits.ToString();
|
||||
}
|
||||
|
||||
public void Unlock()
|
||||
{
|
||||
nameTextBox.Enabled = true;
|
||||
delayTextBox.Enabled = true;
|
||||
bitPositionTextBox.Enabled = true;
|
||||
protocolComboBox.Enabled = true;
|
||||
busAddressTextBox.Enabled = true;
|
||||
comPortNrTextBox.Enabled = true;
|
||||
baudRateTextBox.Enabled = true;
|
||||
parityComboBox.Enabled = true;
|
||||
dataBitsTextBox.Enabled = true;
|
||||
stopBitsComboBox.Enabled = true;
|
||||
}
|
||||
|
||||
public CfgUpdateFlags UpdateCfg()
|
||||
{
|
||||
CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd;
|
||||
|
||||
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
|
||||
|
||||
config.Name = nameTextBox.Text;
|
||||
config.Delay = int.Parse(delayTextBox.Text);
|
||||
config.BitPosition = int.Parse(bitPositionTextBox.Text);
|
||||
config.Protocol = protocolComboBox.Text.Equals(PumpProtocol.Modbus.ToString()) ? PumpProtocol.Modbus : PumpProtocol.FC;
|
||||
config.BusAddress = int.Parse(busAddressTextBox.Text);
|
||||
config.ComPortNr = int.Parse(comPortNrTextBox.Text);
|
||||
config.BaudRate = int.Parse(baudRateTextBox.Text);
|
||||
config.Parity = Common.Utils.GetParity(parityComboBox.SelectedItem.ToString());
|
||||
config.DataBits = int.Parse(dataBitsTextBox.Text);
|
||||
config.StopBits = Common.Utils.GetStopBits(stopBitsComboBox.SelectedItem.ToString());
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
public CfgUpdateFlags VerifyCfg(ref string message)
|
||||
{
|
||||
CfgUpdateFlags flags = CfgUpdateFlags.None;
|
||||
|
||||
int dummy;
|
||||
if (!int.TryParse(delayTextBox.Text, out dummy) || dummy < 0 || dummy > 300)
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "'Delay' is not valid";
|
||||
}
|
||||
|
||||
if (!int.TryParse(bitPositionTextBox.Text, out dummy) || dummy < 0 || dummy >= 128)
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "'Bit Position' should be between 0 and 127";
|
||||
}
|
||||
|
||||
if (!protocolComboBox.Items.Contains(protocolComboBox.Text))
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "'Protocol' should Modbus or FC";
|
||||
}
|
||||
|
||||
if (!int.TryParse(busAddressTextBox.Text, out dummy) || dummy < 1 || dummy > 247)
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "'Bus Address' should be in range 1..247";
|
||||
}
|
||||
|
||||
if (!int.TryParse(comPortNrTextBox.Text, out dummy) || dummy < 1 || dummy > 999)
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "'Serial Port Number' is not valid";
|
||||
}
|
||||
|
||||
if (!int.TryParse(baudRateTextBox.Text, out dummy) || dummy < 150 || dummy > 115200)
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "'Baud Rate' is not valid";
|
||||
}
|
||||
|
||||
if (!int.TryParse(dataBitsTextBox.Text, out dummy) || dummy < 7 || dummy > 8)
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "'Data Bits' is not valid";
|
||||
}
|
||||
|
||||
return flags;
|
||||
}
|
||||
}
|
||||
}
|
||||
+298
@@ -0,0 +1,298 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
namespace TBF.Rig.Danfoss.VLT2800
|
||||
{
|
||||
partial class PumpCfgCtrl
|
||||
{
|
||||
/// <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 Component 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.comPortNrTextBox = new System.Windows.Forms.TextBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.baudRateLabel = new System.Windows.Forms.Label();
|
||||
this.baudRateTextBox = new System.Windows.Forms.TextBox();
|
||||
this.partityLabel = new System.Windows.Forms.Label();
|
||||
this.dataBitsLabel = new System.Windows.Forms.Label();
|
||||
this.dataBitsTextBox = new System.Windows.Forms.TextBox();
|
||||
this.stopBitsLabel = new System.Windows.Forms.Label();
|
||||
this.busAddressLabel = new System.Windows.Forms.Label();
|
||||
this.nameTextBox = new System.Windows.Forms.TextBox();
|
||||
this.nameLabel = new System.Windows.Forms.Label();
|
||||
this.classNameLabel = new System.Windows.Forms.Label();
|
||||
this.parityComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.stopBitsComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.busAddressTextBox = new System.Windows.Forms.TextBox();
|
||||
this.delayTextBox = new System.Windows.Forms.TextBox();
|
||||
this.delayLabel = new System.Windows.Forms.Label();
|
||||
this.protocolLabel = new System.Windows.Forms.Label();
|
||||
this.protocolComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.bitPositionTextBox = new System.Windows.Forms.TextBox();
|
||||
this.bitPositionLabel = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// comPortNrTextBox
|
||||
//
|
||||
this.comPortNrTextBox.Enabled = false;
|
||||
this.comPortNrTextBox.Location = new System.Drawing.Point(140, 129);
|
||||
this.comPortNrTextBox.Name = "comPortNrTextBox";
|
||||
this.comPortNrTextBox.Size = new System.Drawing.Size(34, 20);
|
||||
this.comPortNrTextBox.TabIndex = 6;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(29, 132);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(98, 13);
|
||||
this.label1.TabIndex = 5;
|
||||
this.label1.Text = "Serial Port Number:";
|
||||
//
|
||||
// baudRateLabel
|
||||
//
|
||||
this.baudRateLabel.AutoSize = true;
|
||||
this.baudRateLabel.Location = new System.Drawing.Point(29, 153);
|
||||
this.baudRateLabel.Name = "baudRateLabel";
|
||||
this.baudRateLabel.Size = new System.Drawing.Size(58, 13);
|
||||
this.baudRateLabel.TabIndex = 7;
|
||||
this.baudRateLabel.Text = "Baud Rate";
|
||||
//
|
||||
// baudRateTextBox
|
||||
//
|
||||
this.baudRateTextBox.Enabled = false;
|
||||
this.baudRateTextBox.Location = new System.Drawing.Point(140, 150);
|
||||
this.baudRateTextBox.Name = "baudRateTextBox";
|
||||
this.baudRateTextBox.Size = new System.Drawing.Size(130, 20);
|
||||
this.baudRateTextBox.TabIndex = 8;
|
||||
//
|
||||
// partityLabel
|
||||
//
|
||||
this.partityLabel.AutoSize = true;
|
||||
this.partityLabel.Location = new System.Drawing.Point(29, 174);
|
||||
this.partityLabel.Name = "partityLabel";
|
||||
this.partityLabel.Size = new System.Drawing.Size(33, 13);
|
||||
this.partityLabel.TabIndex = 9;
|
||||
this.partityLabel.Text = "Parity";
|
||||
//
|
||||
// dataBitsLabel
|
||||
//
|
||||
this.dataBitsLabel.AutoSize = true;
|
||||
this.dataBitsLabel.Location = new System.Drawing.Point(29, 196);
|
||||
this.dataBitsLabel.Name = "dataBitsLabel";
|
||||
this.dataBitsLabel.Size = new System.Drawing.Size(50, 13);
|
||||
this.dataBitsLabel.TabIndex = 11;
|
||||
this.dataBitsLabel.Text = "Data Bits";
|
||||
//
|
||||
// dataBitsTextBox
|
||||
//
|
||||
this.dataBitsTextBox.Enabled = false;
|
||||
this.dataBitsTextBox.Location = new System.Drawing.Point(140, 193);
|
||||
this.dataBitsTextBox.Name = "dataBitsTextBox";
|
||||
this.dataBitsTextBox.Size = new System.Drawing.Size(34, 20);
|
||||
this.dataBitsTextBox.TabIndex = 12;
|
||||
//
|
||||
// stopBitsLabel
|
||||
//
|
||||
this.stopBitsLabel.AutoSize = true;
|
||||
this.stopBitsLabel.Location = new System.Drawing.Point(29, 217);
|
||||
this.stopBitsLabel.Name = "stopBitsLabel";
|
||||
this.stopBitsLabel.Size = new System.Drawing.Size(49, 13);
|
||||
this.stopBitsLabel.TabIndex = 13;
|
||||
this.stopBitsLabel.Text = "Stop Bits";
|
||||
//
|
||||
// busAddressLabel
|
||||
//
|
||||
this.busAddressLabel.AutoSize = true;
|
||||
this.busAddressLabel.Location = new System.Drawing.Point(29, 110);
|
||||
this.busAddressLabel.Name = "busAddressLabel";
|
||||
this.busAddressLabel.Size = new System.Drawing.Size(66, 13);
|
||||
this.busAddressLabel.TabIndex = 3;
|
||||
this.busAddressLabel.Text = "Bus Address";
|
||||
//
|
||||
// nameTextBox
|
||||
//
|
||||
this.nameTextBox.Enabled = false;
|
||||
this.nameTextBox.Location = new System.Drawing.Point(140, 23);
|
||||
this.nameTextBox.Name = "nameTextBox";
|
||||
this.nameTextBox.Size = new System.Drawing.Size(130, 20);
|
||||
this.nameTextBox.TabIndex = 2;
|
||||
//
|
||||
// nameLabel
|
||||
//
|
||||
this.nameLabel.AutoSize = true;
|
||||
this.nameLabel.Location = new System.Drawing.Point(30, 26);
|
||||
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(137, 5);
|
||||
this.classNameLabel.Name = "classNameLabel";
|
||||
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
|
||||
this.classNameLabel.TabIndex = 0;
|
||||
this.classNameLabel.Text = "ComonentName";
|
||||
//
|
||||
// parityComboBox
|
||||
//
|
||||
this.parityComboBox.Enabled = false;
|
||||
this.parityComboBox.FormattingEnabled = true;
|
||||
this.parityComboBox.Location = new System.Drawing.Point(140, 171);
|
||||
this.parityComboBox.Name = "parityComboBox";
|
||||
this.parityComboBox.Size = new System.Drawing.Size(130, 21);
|
||||
this.parityComboBox.TabIndex = 10;
|
||||
//
|
||||
// stopBitsComboBox
|
||||
//
|
||||
this.stopBitsComboBox.Enabled = false;
|
||||
this.stopBitsComboBox.FormattingEnabled = true;
|
||||
this.stopBitsComboBox.Location = new System.Drawing.Point(140, 214);
|
||||
this.stopBitsComboBox.Name = "stopBitsComboBox";
|
||||
this.stopBitsComboBox.Size = new System.Drawing.Size(130, 21);
|
||||
this.stopBitsComboBox.TabIndex = 14;
|
||||
//
|
||||
// busAddressTextBox
|
||||
//
|
||||
this.busAddressTextBox.Enabled = false;
|
||||
this.busAddressTextBox.Location = new System.Drawing.Point(140, 108);
|
||||
this.busAddressTextBox.Name = "busAddressTextBox";
|
||||
this.busAddressTextBox.Size = new System.Drawing.Size(34, 20);
|
||||
this.busAddressTextBox.TabIndex = 4;
|
||||
//
|
||||
// delayTextBox
|
||||
//
|
||||
this.delayTextBox.Enabled = false;
|
||||
this.delayTextBox.Location = new System.Drawing.Point(140, 44);
|
||||
this.delayTextBox.Name = "delayTextBox";
|
||||
this.delayTextBox.Size = new System.Drawing.Size(34, 20);
|
||||
this.delayTextBox.TabIndex = 16;
|
||||
//
|
||||
// delayLabel
|
||||
//
|
||||
this.delayLabel.AutoSize = true;
|
||||
this.delayLabel.Location = new System.Drawing.Point(29, 46);
|
||||
this.delayLabel.Name = "delayLabel";
|
||||
this.delayLabel.Size = new System.Drawing.Size(45, 13);
|
||||
this.delayLabel.TabIndex = 15;
|
||||
this.delayLabel.Text = "Delay[s]";
|
||||
//
|
||||
// protocolLabel
|
||||
//
|
||||
this.protocolLabel.AutoSize = true;
|
||||
this.protocolLabel.Location = new System.Drawing.Point(29, 89);
|
||||
this.protocolLabel.Name = "protocolLabel";
|
||||
this.protocolLabel.Size = new System.Drawing.Size(46, 13);
|
||||
this.protocolLabel.TabIndex = 17;
|
||||
this.protocolLabel.Text = "Protocol";
|
||||
//
|
||||
// protocolComboBox
|
||||
//
|
||||
this.protocolComboBox.Enabled = false;
|
||||
this.protocolComboBox.FormattingEnabled = true;
|
||||
this.protocolComboBox.Location = new System.Drawing.Point(140, 86);
|
||||
this.protocolComboBox.Name = "protocolComboBox";
|
||||
this.protocolComboBox.Size = new System.Drawing.Size(130, 21);
|
||||
this.protocolComboBox.TabIndex = 18;
|
||||
//
|
||||
// bitPositionTextBox
|
||||
//
|
||||
this.bitPositionTextBox.Enabled = false;
|
||||
this.bitPositionTextBox.Location = new System.Drawing.Point(140, 65);
|
||||
this.bitPositionTextBox.Name = "bitPositionTextBox";
|
||||
this.bitPositionTextBox.Size = new System.Drawing.Size(34, 20);
|
||||
this.bitPositionTextBox.TabIndex = 20;
|
||||
//
|
||||
// bitPositionLabel
|
||||
//
|
||||
this.bitPositionLabel.AutoSize = true;
|
||||
this.bitPositionLabel.Location = new System.Drawing.Point(30, 68);
|
||||
this.bitPositionLabel.Name = "bitPositionLabel";
|
||||
this.bitPositionLabel.Size = new System.Drawing.Size(89, 13);
|
||||
this.bitPositionLabel.TabIndex = 19;
|
||||
this.bitPositionLabel.Text = "Valve Bit Position";
|
||||
//
|
||||
// PumpCfgCtrl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.SystemColors.Control;
|
||||
this.Controls.Add(this.bitPositionTextBox);
|
||||
this.Controls.Add(this.bitPositionLabel);
|
||||
this.Controls.Add(this.protocolComboBox);
|
||||
this.Controls.Add(this.protocolLabel);
|
||||
this.Controls.Add(this.delayTextBox);
|
||||
this.Controls.Add(this.delayLabel);
|
||||
this.Controls.Add(this.busAddressTextBox);
|
||||
this.Controls.Add(this.stopBitsComboBox);
|
||||
this.Controls.Add(this.parityComboBox);
|
||||
this.Controls.Add(this.nameTextBox);
|
||||
this.Controls.Add(this.nameLabel);
|
||||
this.Controls.Add(this.classNameLabel);
|
||||
this.Controls.Add(this.busAddressLabel);
|
||||
this.Controls.Add(this.stopBitsLabel);
|
||||
this.Controls.Add(this.dataBitsTextBox);
|
||||
this.Controls.Add(this.dataBitsLabel);
|
||||
this.Controls.Add(this.partityLabel);
|
||||
this.Controls.Add(this.baudRateTextBox);
|
||||
this.Controls.Add(this.baudRateLabel);
|
||||
this.Controls.Add(this.comPortNrTextBox);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Name = "PumpCfgCtrl";
|
||||
this.Size = new System.Drawing.Size(300, 240);
|
||||
this.Load += new System.EventHandler(this.AbbientCfgCtrl_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TextBox comPortNrTextBox;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Label baudRateLabel;
|
||||
private System.Windows.Forms.TextBox baudRateTextBox;
|
||||
private System.Windows.Forms.Label partityLabel;
|
||||
private System.Windows.Forms.Label dataBitsLabel;
|
||||
private System.Windows.Forms.TextBox dataBitsTextBox;
|
||||
private System.Windows.Forms.Label stopBitsLabel;
|
||||
private System.Windows.Forms.Label busAddressLabel;
|
||||
private System.Windows.Forms.TextBox nameTextBox;
|
||||
private System.Windows.Forms.Label nameLabel;
|
||||
private System.Windows.Forms.Label classNameLabel;
|
||||
private System.Windows.Forms.ComboBox parityComboBox;
|
||||
private System.Windows.Forms.ComboBox stopBitsComboBox;
|
||||
private System.Windows.Forms.TextBox busAddressTextBox;
|
||||
private System.Windows.Forms.TextBox delayTextBox;
|
||||
private System.Windows.Forms.Label delayLabel;
|
||||
private System.Windows.Forms.Label protocolLabel;
|
||||
private System.Windows.Forms.ComboBox protocolComboBox;
|
||||
private System.Windows.Forms.TextBox bitPositionTextBox;
|
||||
private System.Windows.Forms.Label bitPositionLabel;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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>
|
||||
@@ -0,0 +1,24 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2016 Sensus Metering Systems
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using TBF.Rig.Generic;
|
||||
|
||||
namespace TBF.Rig.Danfoss.VLT2800
|
||||
{
|
||||
public class PumpFactory : IComponentFactory
|
||||
{
|
||||
public string ClassName { get { return "Pump-Danfoss-VLT2800"; } }
|
||||
|
||||
public IComponent DummyComponent() { return new Pump(); }
|
||||
|
||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new Pump(cfg, components); }
|
||||
|
||||
public IComponentCfg DefaultConfig() { return new PumpCfg(this); }
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
||||
{
|
||||
return ComponentCfgBase.CreateFromDbEntity(PumpCfg.Serializer, component, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using log4net;
|
||||
|
||||
namespace TBF.Rig.DataContainers.BackupAndSecurityOptions
|
||||
{
|
||||
/// <summary>
|
||||
/// Holds backup and security options.
|
||||
/// </summary>
|
||||
public class Component : ComponentBase
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(Component));
|
||||
public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
|
||||
|
||||
readonly ComponentCfg myCfg;
|
||||
|
||||
public int MinPasswdLength { get { return myCfg.MinPasswdLength; } }
|
||||
public int PasswdExpirationPeriodDays { get { return myCfg.PasswdExpirationPeriodDays; } }
|
||||
|
||||
public Component() { }
|
||||
|
||||
public Component(Generic.IComponentCfg cfg)
|
||||
: base(cfg)
|
||||
{
|
||||
myCfg = cfg as ComponentCfg;
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
Users.GlobalData.MinPasswdLength = myCfg.MinPasswdLength;
|
||||
Users.GlobalData.PasswdExpirationPeriodDays = myCfg.PasswdExpirationPeriodDays;
|
||||
log.FatalFormat("{0} initialized: {1}", Name, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
using TBF.Rig.Generic;
|
||||
|
||||
namespace TBF.Rig.DataContainers.BackupAndSecurityOptions
|
||||
{
|
||||
/// <summary>
|
||||
/// Holds backup and security options - serializable configuration.
|
||||
/// </summary>
|
||||
public class ComponentCfg : ComponentCfgBase, Generic.IComponentCfg, Config.Entities.IParamsProvider
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(ComponentCfg) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
public IComponentCfgCtrl GetControl(IList<Config.Entities.Component> cmpntEntities) { return new Configs.ParamsProvider.ComponentCfgCtrl(this, null); }
|
||||
|
||||
///
|
||||
/// Serialized parameters
|
||||
///
|
||||
public int MinPasswdLength;
|
||||
public int PasswdExpirationPeriodDays; /// 0 = validity is not limited
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
ComponentCfg() {}
|
||||
|
||||
public ComponentCfg(IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
Factory = factory;
|
||||
Name = "BackupAndSecurity";
|
||||
ParentName = string.Empty;
|
||||
InitializeAll();
|
||||
}
|
||||
|
||||
public string ComponentName { get { return Name; } }
|
||||
|
||||
public void InitializeAll()
|
||||
{
|
||||
MinPasswdLength = 6;
|
||||
PasswdExpirationPeriodDays = 0;
|
||||
}
|
||||
|
||||
string[] paramNames = new string[]
|
||||
{
|
||||
"Minimum password length (characters)",
|
||||
"Password expiration period (days)",
|
||||
};
|
||||
public string ParamName(int i) { return paramNames[i]; }
|
||||
public int ParamsCount() { return paramNames.Length; }
|
||||
|
||||
public ICollection<string> ParamValues(int i)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
if (i == -1)
|
||||
{
|
||||
return string.Format("{0}: Min. password length = {1} characters, Password expiration period = {2} days", Name, MinPasswdLength, PasswdExpirationPeriodDays);
|
||||
}
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 0: return MinPasswdLength.ToString();
|
||||
case 1: return PasswdExpirationPeriodDays.ToString();;
|
||||
default: return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
public CfgUpdateFlags UpdateParam(int i, string strValue)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: MinPasswdLength = int.Parse(strValue); return CfgUpdateFlags.RestartRqrd;
|
||||
case 1: PasswdExpirationPeriodDays = int.Parse(strValue); return CfgUpdateFlags.RestartRqrd;
|
||||
default: return CfgUpdateFlags.None;
|
||||
}
|
||||
}
|
||||
|
||||
public bool ValidateParam(int i, string strValue, out string message)
|
||||
{
|
||||
message = string.Empty;
|
||||
int idummy;
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
/// Positive integers and zero are allowed
|
||||
if (int.TryParse(strValue, out idummy) && (idummy >= 0)) return true;
|
||||
break;
|
||||
default:
|
||||
message = "Invalid index";
|
||||
return false;
|
||||
}
|
||||
|
||||
message = ParamName(i) + " is invalid";
|
||||
return false;
|
||||
}
|
||||
|
||||
void CopyContentTo(ComponentCfg prms)
|
||||
{
|
||||
prms.MinPasswdLength = this.MinPasswdLength;
|
||||
prms.PasswdExpirationPeriodDays = this.PasswdExpirationPeriodDays;
|
||||
}
|
||||
|
||||
public Config.Entities.IParamsProvider Clone()
|
||||
{
|
||||
ComponentCfg pars = new ComponentCfg();
|
||||
CopyContentTo(pars);
|
||||
return pars;
|
||||
}
|
||||
|
||||
public bool UpdateEmbeddedDbEntity()
|
||||
{
|
||||
return true; /// =OK, do nothing
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using TBF.Rig.Generic;
|
||||
|
||||
namespace TBF.Rig.DataContainers.BackupAndSecurityOptions
|
||||
{
|
||||
public class ComponentFactory : IComponentFactory
|
||||
{
|
||||
public string ClassName { get { return GetType().Namespace.Substring(8); } }
|
||||
|
||||
public IComponent DummyComponent() { return new Component(); }
|
||||
|
||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new Component(cfg); }
|
||||
|
||||
public IComponentCfg DefaultConfig() { return new ComponentCfg(this); }
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
||||
{
|
||||
return ComponentCfgBase.CreateFromDbEntity(ComponentCfg.Serializer, component, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
///
|
||||
/// Copyright (c) 2018-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
using log4net;
|
||||
using Common;
|
||||
using TBF.Rig.Generic;
|
||||
|
||||
namespace TBF.Rig.DataContainers.BenchInfo.Extended
|
||||
{
|
||||
/// <summary>
|
||||
/// Holds information identifying the test bench.
|
||||
/// </summary>
|
||||
public class Component : ComponentBase, GenericDevices.IBenchInfo
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(Component));
|
||||
public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
|
||||
|
||||
readonly ComponentCfg myCfg;
|
||||
|
||||
public string TestBenchName { get { return myCfg.TestBenchName; } }
|
||||
public int TestBenchId { get { return myCfg.TestBenchId; } }
|
||||
public string Address1 { get { return myCfg.Address1; } }
|
||||
public string Address2 { get { return myCfg.Address2; } }
|
||||
public string Address3 { get { return myCfg.Address3; } }
|
||||
public string Address4 { get { return myCfg.Address4; } }
|
||||
public string Address5 { get { return myCfg.Address5; } }
|
||||
public RemoteDBUse RemoteDBUse { get { return myCfg.RemoteDBUse; } }
|
||||
|
||||
|
||||
public Component() { }
|
||||
|
||||
public Component(Generic.IComponentCfg cfg)
|
||||
: base(cfg)
|
||||
{
|
||||
myCfg = cfg as ComponentCfg;
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
Events.DB.SetBenchName(myCfg.TestBenchName);
|
||||
log.FatalFormat("{0} initialized: {1}", Name, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,224 @@
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
using TBF.Rig.Generic;
|
||||
|
||||
namespace TBF.Rig.DataContainers.BenchInfo.Extended
|
||||
{
|
||||
/// <summary>
|
||||
/// Holds information identifying the test bench - serializable configuration.
|
||||
/// </summary>
|
||||
public class ComponentCfg : ComponentCfgBase, Generic.IComponentCfg, Config.Entities.IParamsProvider
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(ComponentCfg) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
public IComponentCfgCtrl GetControl(IList<Config.Entities.Component> cmpntEntities) { return new Configs.ParamsProvider.ComponentCfgCtrl(this, null); }
|
||||
|
||||
///
|
||||
/// Serialized parameters
|
||||
///
|
||||
public string TestBenchName;
|
||||
public int TestBenchId;
|
||||
public string Address1;
|
||||
public string Address2;
|
||||
public string Address3;
|
||||
public string Address4;
|
||||
public string Address5;
|
||||
public string ApprovalId;
|
||||
public string ApprovalDate;
|
||||
public string ApprovedBy;
|
||||
public RemoteDBUse RemoteDBUse;
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
ComponentCfg() {}
|
||||
|
||||
public ComponentCfg(IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
Factory = factory;
|
||||
Name = "BenchInfoEx";
|
||||
ParentName = string.Empty;
|
||||
InitializeAll();
|
||||
}
|
||||
|
||||
public string ComponentName { get { return Name; } }
|
||||
|
||||
public void InitializeAll()
|
||||
{
|
||||
TestBenchName = "1";
|
||||
TestBenchId = 1;
|
||||
|
||||
Address1 = string.Empty;
|
||||
Address2 = string.Empty;
|
||||
Address3 = string.Empty;
|
||||
Address4 = string.Empty;
|
||||
Address5 = string.Empty;
|
||||
|
||||
ApprovalId = string.Empty;
|
||||
ApprovalDate = string.Empty;
|
||||
ApprovedBy = string.Empty;
|
||||
|
||||
RemoteDBUse = RemoteDBUse.LocalDBOnly;
|
||||
}
|
||||
|
||||
string[] paramNames = new string[]
|
||||
{
|
||||
"Test bench name",
|
||||
"Test bench ID",
|
||||
"Address 1",
|
||||
"Address 2",
|
||||
"Address 3",
|
||||
"Address 4",
|
||||
"Address 5",
|
||||
"Approval",
|
||||
"Approval date",
|
||||
"Approved by",
|
||||
"Remote DB use",
|
||||
};
|
||||
public string ParamName(int i) { return paramNames[i]; }
|
||||
public int ParamsCount() { return paramNames.Length; }
|
||||
|
||||
public ICollection<string> ParamValues(int i)
|
||||
{
|
||||
if (i == 10)
|
||||
{
|
||||
IList<string> list = new List<string>();
|
||||
for (RemoteDBUse rdbu = 0; rdbu < RemoteDBUse.Count; rdbu++) list.Add(rdbu.ToDescription());
|
||||
return list;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
if (i == -1)
|
||||
{
|
||||
return string.Format("{0}: Bench name={1}, Bench Id={2}, Procedures={3}", Name, TestBenchName, TestBenchId, RemoteDBUse.ToDescription());
|
||||
}
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 0: return TestBenchName;
|
||||
case 1: return TestBenchId.ToString();
|
||||
case 2: return Address1;
|
||||
case 3: return Address2;
|
||||
case 4: return Address3;
|
||||
case 5: return Address4;
|
||||
case 6: return Address5;
|
||||
case 7: return ApprovalId;
|
||||
case 8: return ApprovalDate;
|
||||
case 9: return ApprovedBy;
|
||||
case 10: return RemoteDBUse.ToDescription();
|
||||
default: return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
public CfgUpdateFlags UpdateParam(int i, string strValue)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: TestBenchName = strValue; return CfgUpdateFlags.RestartRqrd;
|
||||
case 1: TestBenchId = int.Parse(strValue); return CfgUpdateFlags.RestartRqrd;
|
||||
case 2: Address1 = strValue; return CfgUpdateFlags.RestartRqrd;
|
||||
case 3: Address2 = strValue; return CfgUpdateFlags.RestartRqrd;
|
||||
case 4: Address3 = strValue; return CfgUpdateFlags.RestartRqrd;
|
||||
case 5: Address4 = strValue; return CfgUpdateFlags.RestartRqrd;
|
||||
case 6: Address5 = strValue; return CfgUpdateFlags.RestartRqrd;
|
||||
case 7: ApprovalId = strValue; return CfgUpdateFlags.RestartRqrd;
|
||||
case 8: ApprovalDate = strValue; return CfgUpdateFlags.RestartRqrd;
|
||||
case 9: ApprovedBy = strValue; return CfgUpdateFlags.RestartRqrd;
|
||||
|
||||
case 10:
|
||||
for (RemoteDBUse rdbu = 0; rdbu < RemoteDBUse.Count; rdbu++)
|
||||
{
|
||||
if (strValue == rdbu.ToDescription())
|
||||
{
|
||||
if (RemoteDBUse != rdbu)
|
||||
{
|
||||
RemoteDBUse = rdbu;
|
||||
return CfgUpdateFlags.RestartRqrd;
|
||||
}
|
||||
else
|
||||
{
|
||||
return CfgUpdateFlags.None;
|
||||
}
|
||||
}
|
||||
}
|
||||
return CfgUpdateFlags.Error;
|
||||
|
||||
default: return CfgUpdateFlags.None;
|
||||
}
|
||||
}
|
||||
|
||||
public bool ValidateParam(int i, string strValue, out string message)
|
||||
{
|
||||
message = string.Empty;
|
||||
int idummy;
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
case 7:
|
||||
case 8:
|
||||
case 9:
|
||||
return true;
|
||||
case 1:
|
||||
if (int.TryParse(strValue, out idummy) && (idummy >= 0)) return true;
|
||||
break;
|
||||
case 10:
|
||||
for (RemoteDBUse rdbu = 0; rdbu < RemoteDBUse.Count; rdbu++)
|
||||
{
|
||||
if (strValue == rdbu.ToDescription()) return true;
|
||||
}
|
||||
return false;
|
||||
default:
|
||||
message = "Invalid index";
|
||||
return false;
|
||||
}
|
||||
|
||||
message = ParamName(i) + " is invalid";
|
||||
return false;
|
||||
}
|
||||
|
||||
void CopyContentTo(ComponentCfg prms)
|
||||
{
|
||||
prms.TestBenchName = this.TestBenchName;
|
||||
prms.TestBenchId = this.TestBenchId;
|
||||
prms.Address1 = this.Address1;
|
||||
prms.Address2 = this.Address2;
|
||||
prms.Address3 = this.Address3;
|
||||
prms.Address4 = this.Address4;
|
||||
prms.Address5 = this.Address5;
|
||||
prms.ApprovalId = this.ApprovalId;
|
||||
prms.ApprovalDate = this.ApprovalDate;
|
||||
prms.ApprovedBy = this.ApprovedBy;
|
||||
prms.RemoteDBUse = this.RemoteDBUse;
|
||||
}
|
||||
|
||||
public Config.Entities.IParamsProvider Clone()
|
||||
{
|
||||
ComponentCfg pars = new ComponentCfg();
|
||||
CopyContentTo(pars);
|
||||
return pars;
|
||||
}
|
||||
|
||||
public bool UpdateEmbeddedDbEntity()
|
||||
{
|
||||
return true; /// =OK, do nothing
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using TBF.Rig.Generic;
|
||||
|
||||
namespace TBF.Rig.DataContainers.BenchInfo.Extended
|
||||
{
|
||||
public class ComponentFactory : IComponentFactory
|
||||
{
|
||||
public string ClassName { get { return "BenchInfoEx"; } }
|
||||
|
||||
public IComponent DummyComponent() { return new Component(); }
|
||||
|
||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new Component(cfg); }
|
||||
|
||||
public IComponentCfg DefaultConfig() { return new ComponentCfg(this); }
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
||||
{
|
||||
return ComponentCfgBase.CreateFromDbEntity(ComponentCfg.Serializer, component, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
///
|
||||
/// Copyright (c) 2018-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
using log4net;
|
||||
using Common;
|
||||
using TBF.Rig;
|
||||
using TBF.Rig.Generic;
|
||||
using TBF.Resources;
|
||||
|
||||
namespace TBF.Rig.DataContainers.BenchInfo.iPerl
|
||||
{
|
||||
/// <summary>
|
||||
/// Holds information identifying the test bench.
|
||||
/// </summary>
|
||||
public class Component : ComponentBase, GenericDevices.IBenchInfo, GenericDevices.IHasCalendarEvents
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(Component));
|
||||
public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
|
||||
|
||||
readonly ComponentCfg myCfg;
|
||||
|
||||
public string TestBenchName { get { return myCfg.TestBenchName; } }
|
||||
public int TestBenchId { get { return myCfg.TestBenchId; } }
|
||||
public string Address1 { get { return myCfg.Address1; } }
|
||||
public string Address2 { get { return myCfg.Address2; } }
|
||||
public string Address3 { get { return myCfg.Address3; } }
|
||||
public string Address4 { get { return myCfg.Address4; } }
|
||||
public string Address5 { get { return myCfg.Address5; } }
|
||||
public RemoteDBUse RemoteDBUse { get { return myCfg.RemoteDBUse; } }
|
||||
public Side Side { get { return myCfg.Side; } }
|
||||
public int MaxTestIndex { get { return myCfg.MaxTestIndex; } } /// (MaxPruefindex % 100) value when to reject water meters completely if they are NOK
|
||||
|
||||
|
||||
public Component() { }
|
||||
|
||||
public Component(Generic.IComponentCfg cfg)
|
||||
: base(cfg)
|
||||
{
|
||||
myCfg = cfg as ComponentCfg;
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
Events.DB.SetBenchName(myCfg.TestBenchName);
|
||||
log.FatalFormat("{0} initialized: {1}", Name, this);
|
||||
}
|
||||
|
||||
|
||||
public IList<Config.CalendarEvent.ICalendarEvent> GetCalendarEvents()
|
||||
{
|
||||
DateTime calibrationDue = myCfg.CalibValidDate;
|
||||
IList<Config.CalendarEvent.ICalendarEvent> calendarEvents = new List<Config.CalendarEvent.ICalendarEvent>();
|
||||
|
||||
if (calibrationDue > TBF.UI.Constants.MinDate)
|
||||
{
|
||||
/// Calibration due date calendar event
|
||||
calendarEvents.Add(new TBF.UI.Calendar.CalibrationDueDateEvent(calibrationDue.Date, Name,
|
||||
string.Format(Strings.Calibration_due_date_is_0,
|
||||
calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat))));
|
||||
if (DateTime.Now.Date <= calibrationDue.AddDays(-7))
|
||||
{
|
||||
/// Weekly reminders (last 5 weeks)
|
||||
calendarEvents.Add(new TBF.UI.Calendar.CalibrationReminderEvent(calibrationDue.Date.AddDays(-35), Name,
|
||||
string.Format(Strings.Calibration_due_date_is_0,
|
||||
calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)),
|
||||
false));
|
||||
}
|
||||
if (DateTime.Now.Date <= calibrationDue.Date)
|
||||
{
|
||||
/// Daily reminders (last 5 days)
|
||||
calendarEvents.Add(new TBF.UI.Calendar.CalibrationReminderEvent(calibrationDue.AddDays(-5), Name,
|
||||
string.Format(Strings.Calibration_due_date_is_0,
|
||||
calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)),
|
||||
true));
|
||||
}
|
||||
}
|
||||
return calendarEvents;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,274 @@
|
||||
///
|
||||
/// Copyright (c) 2018-2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
using TBF.Rig.Generic;
|
||||
using TBF.Resources;
|
||||
|
||||
namespace TBF.Rig.DataContainers.BenchInfo.iPerl
|
||||
{
|
||||
/// <summary>
|
||||
/// Holds information identifying the test bench - serializable configuration.
|
||||
/// </summary>
|
||||
public class ComponentCfg : ComponentCfgBase, Generic.IComponentCfg, Config.Entities.IParamsProvider, TBF.Rig.GenericDevices.ICalibInfoCfg
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(ComponentCfg) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
public IComponentCfgCtrl GetControl(IList<Config.Entities.Component> cmpntEntities) { return new Configs.ParamsProvider.ComponentCfgCtrl(this, null); }
|
||||
|
||||
///
|
||||
/// Serialized parameters
|
||||
///
|
||||
public string TestBenchName;
|
||||
public int TestBenchId;
|
||||
public string Address1;
|
||||
public string Address2;
|
||||
public string Address3;
|
||||
public string Address4;
|
||||
public string Address5;
|
||||
public string ApprovalId;
|
||||
public string ApprovalDate;
|
||||
public string ApprovedBy;
|
||||
public RemoteDBUse RemoteDBUse;
|
||||
public Side Side;
|
||||
public int MaxTestIndex; /// (MaxPruefindex % 100) value when to reject water meters completely if they are NOK
|
||||
|
||||
/// Calibration info serialized parameters displayed in Metrology tab page
|
||||
public string CalibCertificateNr { get; set; }
|
||||
public DateTime CalibDate { get; set; }
|
||||
public DateTime CalibValidDate { get; set; }
|
||||
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
ComponentCfg() {}
|
||||
|
||||
public ComponentCfg(string name, IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
Factory = factory;
|
||||
Name = name;
|
||||
ParentName = string.Empty;
|
||||
InitializeAll();
|
||||
}
|
||||
|
||||
public string ComponentName { get { return Name; } }
|
||||
|
||||
public void InitializeAll()
|
||||
{
|
||||
TestBenchName = "1";
|
||||
TestBenchId = 1;
|
||||
Address1 = string.Empty;
|
||||
Address2 = string.Empty;
|
||||
Address3 = string.Empty;
|
||||
Address4 = string.Empty;
|
||||
Address5 = string.Empty;
|
||||
ApprovalId = string.Empty;
|
||||
ApprovalDate = string.Empty;
|
||||
ApprovedBy = string.Empty;
|
||||
RemoteDBUse = RemoteDBUse.LocalDBOnly;
|
||||
Side = Side.Left;
|
||||
MaxTestIndex = 4;
|
||||
|
||||
CalibCertificateNr = string.Empty;
|
||||
CalibDate = TBF.UI.Constants.MinDate;
|
||||
CalibValidDate = TBF.UI.Constants.MaxDate;
|
||||
}
|
||||
|
||||
string[] paramNames = new string[]
|
||||
{
|
||||
"Test bench name",
|
||||
"Test bench ID",
|
||||
"Address 1",
|
||||
"Address 2",
|
||||
"Address 3",
|
||||
"Address 4",
|
||||
"Address 5",
|
||||
"Approval",
|
||||
"Approval date",
|
||||
"Approved by",
|
||||
"Remote DB use",
|
||||
Strings.Side,
|
||||
"Max.test index",
|
||||
};
|
||||
public string ParamName(int i) { return paramNames[i]; }
|
||||
public int ParamsCount() { return paramNames.Length; }
|
||||
|
||||
public ICollection<string> ParamValues(int i)
|
||||
{
|
||||
if (i == 10)
|
||||
{
|
||||
IList<string> list = new List<string>();
|
||||
for (RemoteDBUse rdbu = 0; rdbu < RemoteDBUse.Count; rdbu++) list.Add(rdbu.ToDescription());
|
||||
return list;
|
||||
}
|
||||
else if (i == 11)
|
||||
{
|
||||
IList<string> list = new List<string>();
|
||||
for (Side side = 0; side < Side.Count; side++) list.Add(side.ToDescription());
|
||||
return list;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
if (i == -1)
|
||||
{
|
||||
return string.Format("{0}: Bench name={1}, Bench Id={2}, Procedures={3}", Name, TestBenchName, TestBenchId, RemoteDBUse.ToDescription());
|
||||
}
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 0: return TestBenchName;
|
||||
case 1: return TestBenchId.ToString();
|
||||
case 2: return Address1;
|
||||
case 3: return Address2;
|
||||
case 4: return Address3;
|
||||
case 5: return Address4;
|
||||
case 6: return Address5;
|
||||
case 7: return ApprovalId;
|
||||
case 8: return ApprovalDate;
|
||||
case 9: return ApprovedBy;
|
||||
case 10: return RemoteDBUse.ToDescription();
|
||||
case 11: return Side.ToDescription();
|
||||
case 12: return MaxTestIndex.ToString();
|
||||
default: return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
public CfgUpdateFlags UpdateParam(int i, string strValue)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: TestBenchName = strValue; return CfgUpdateFlags.RestartRqrd;
|
||||
case 1: TestBenchId = int.Parse(strValue); return CfgUpdateFlags.RestartRqrd;
|
||||
case 2: Address1 = strValue; return CfgUpdateFlags.RestartRqrd;
|
||||
case 3: Address2 = strValue; return CfgUpdateFlags.RestartRqrd;
|
||||
case 4: Address3 = strValue; return CfgUpdateFlags.RestartRqrd;
|
||||
case 5: Address4 = strValue; return CfgUpdateFlags.RestartRqrd;
|
||||
case 6: Address5 = strValue; return CfgUpdateFlags.RestartRqrd;
|
||||
case 7: ApprovalId = strValue; return CfgUpdateFlags.RestartRqrd;
|
||||
case 8: ApprovalDate = strValue; return CfgUpdateFlags.RestartRqrd;
|
||||
case 9: ApprovedBy = strValue; return CfgUpdateFlags.RestartRqrd;
|
||||
|
||||
case 10:
|
||||
for (RemoteDBUse rdbu = 0; rdbu < RemoteDBUse.Count; rdbu++)
|
||||
{
|
||||
if (strValue == rdbu.ToDescription())
|
||||
{
|
||||
if (RemoteDBUse != rdbu)
|
||||
{
|
||||
RemoteDBUse = rdbu;
|
||||
return CfgUpdateFlags.RestartRqrd;
|
||||
}
|
||||
else
|
||||
{
|
||||
return CfgUpdateFlags.None;
|
||||
}
|
||||
}
|
||||
}
|
||||
return CfgUpdateFlags.Error;
|
||||
|
||||
case 11:
|
||||
for (Side side = 0; side < Side.Count; side++)
|
||||
{
|
||||
if (strValue == side.ToDescription())
|
||||
{
|
||||
if (Side != side)
|
||||
{
|
||||
Side = side;
|
||||
return CfgUpdateFlags.RestartRqrd;
|
||||
}
|
||||
else
|
||||
{
|
||||
return CfgUpdateFlags.None;
|
||||
}
|
||||
}
|
||||
}
|
||||
return CfgUpdateFlags.Error;
|
||||
|
||||
case 12: MaxTestIndex = int.Parse(strValue); return CfgUpdateFlags.RestartRqrd;
|
||||
default: return CfgUpdateFlags.None;
|
||||
}
|
||||
}
|
||||
|
||||
public bool ValidateParam(int i, string strValue, out string message)
|
||||
{
|
||||
message = string.Empty;
|
||||
int idummy;
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
case 7:
|
||||
case 8:
|
||||
case 9:
|
||||
return true;
|
||||
case 1:
|
||||
case 12:
|
||||
if (int.TryParse(strValue, out idummy) && (idummy >= 0)) return true;
|
||||
break;
|
||||
case 10:
|
||||
for (RemoteDBUse rdbu = 0; rdbu < RemoteDBUse.Count; rdbu++)
|
||||
{
|
||||
if (strValue == rdbu.ToDescription()) return true;
|
||||
}
|
||||
break;
|
||||
case 11:
|
||||
for (Side side = 0; side < Side.Count; side++)
|
||||
{
|
||||
if (strValue == side.ToDescription()) return true;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
message = "Invalid index";
|
||||
return false;
|
||||
}
|
||||
|
||||
message = ParamName(i) + " is invalid";
|
||||
return false;
|
||||
}
|
||||
|
||||
void CopyContentTo(ComponentCfg prms)
|
||||
{
|
||||
prms.TestBenchName = this.TestBenchName;
|
||||
prms.TestBenchId = this.TestBenchId;
|
||||
prms.Address1 = this.Address1;
|
||||
prms.Address2 = this.Address2;
|
||||
prms.Address3 = this.Address3;
|
||||
prms.Address4 = this.Address4;
|
||||
prms.Address5 = this.Address5;
|
||||
prms.ApprovalId = this.ApprovalId;
|
||||
prms.ApprovalDate = this.ApprovalDate;
|
||||
prms.ApprovedBy = this.ApprovedBy;
|
||||
prms.RemoteDBUse = this.RemoteDBUse;
|
||||
prms.Side = this.Side;
|
||||
prms.MaxTestIndex = this.MaxTestIndex;
|
||||
}
|
||||
|
||||
public Config.Entities.IParamsProvider Clone()
|
||||
{
|
||||
ComponentCfg pars = new ComponentCfg();
|
||||
CopyContentTo(pars);
|
||||
return pars;
|
||||
}
|
||||
|
||||
public bool UpdateEmbeddedDbEntity()
|
||||
{
|
||||
return true; /// =OK, do nothing
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using TBF.Rig.Generic;
|
||||
|
||||
namespace TBF.Rig.DataContainers.BenchInfo.iPerl
|
||||
{
|
||||
public class ComponentFactory : IComponentFactory
|
||||
{
|
||||
public string ClassName { get { return "BenchInfo.iPerl"; } }
|
||||
|
||||
public IComponent DummyComponent() { return new Component(); }
|
||||
|
||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new Component(cfg); }
|
||||
|
||||
public IComponentCfg DefaultConfig() { return new ComponentCfg("BenchInfo.iPerl", this); }
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
||||
{
|
||||
return ComponentCfgBase.CreateFromDbEntity(ComponentCfg.Serializer, component, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
///
|
||||
/// Copyright (c) 2019-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using TBF.Resources;
|
||||
|
||||
namespace TBF.Rig.DataContainers.Buoyancy
|
||||
{
|
||||
/// <summary>
|
||||
/// Holds measured (true) buoyancy value.
|
||||
/// </summary>
|
||||
public class Component : ComponentBase, GenericDevices.IHasCalendarEvents
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(Component));
|
||||
public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
|
||||
|
||||
readonly ComponentCfg myCfg;
|
||||
|
||||
public double Buoyancy { get { return myCfg.Buoyancy; } }
|
||||
|
||||
|
||||
public Component() { }
|
||||
|
||||
public Component(Generic.IComponentCfg cfg)
|
||||
: base(cfg)
|
||||
{
|
||||
myCfg = cfg as ComponentCfg;
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
Config.Data.Buoyancy = Buoyancy; /// This is to use Buoyancy from this component in formulas
|
||||
log.FatalFormat("{0} initialized: {1}", Name, this);
|
||||
}
|
||||
|
||||
|
||||
public IList<Config.CalendarEvent.ICalendarEvent> GetCalendarEvents()
|
||||
{
|
||||
DateTime calibrationDue = myCfg.CalibValidDate;
|
||||
IList<Config.CalendarEvent.ICalendarEvent> calendarEvents = new List<Config.CalendarEvent.ICalendarEvent>();
|
||||
|
||||
if (calibrationDue > TBF.UI.Constants.MinDate)
|
||||
{
|
||||
/// Calibration due date calendar event
|
||||
calendarEvents.Add(new TBF.UI.Calendar.CalibrationDueDateEvent(calibrationDue.Date, Name,
|
||||
string.Format(Strings.Calibration_due_date_is_0,
|
||||
calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat))));
|
||||
if (DateTime.Now.Date <= calibrationDue.AddDays(-7))
|
||||
{
|
||||
/// Weekly reminders (last 5 weeks)
|
||||
calendarEvents.Add(new TBF.UI.Calendar.CalibrationReminderEvent(calibrationDue.Date.AddDays(-35), Name,
|
||||
string.Format(Strings.Calibration_due_date_is_0,
|
||||
calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)),
|
||||
false));
|
||||
}
|
||||
if (DateTime.Now.Date <= calibrationDue.Date)
|
||||
{
|
||||
/// Daily reminders (last 5 days)
|
||||
calendarEvents.Add(new TBF.UI.Calendar.CalibrationReminderEvent(calibrationDue.AddDays(-5), Name,
|
||||
string.Format(Strings.Calibration_due_date_is_0,
|
||||
calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)),
|
||||
true));
|
||||
}
|
||||
}
|
||||
return calendarEvents;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
///
|
||||
/// Copyright (c) 2019-2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
using TBF.Rig.Generic;
|
||||
|
||||
namespace TBF.Rig.DataContainers.Buoyancy
|
||||
{
|
||||
/// <summary>
|
||||
/// Holds backup and security options - serializable configuration.
|
||||
/// </summary>
|
||||
public class ComponentCfg : ComponentCfgBase, Generic.IComponentCfg, Config.Entities.IParamsProvider, TBF.Rig.GenericDevices.ICalibInfoCfg
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(ComponentCfg) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
public IComponentCfgCtrl GetControl(IList<Config.Entities.Component> cmpntEntities) { return new Configs.ParamsProvider.ComponentCfgCtrl(this, null); }
|
||||
|
||||
///
|
||||
/// Serialized parameters
|
||||
///
|
||||
public double Buoyancy;
|
||||
|
||||
/// Calibration info serialized parameters displayed in Metrology tab page
|
||||
public string CalibCertificateNr { get; set; }
|
||||
public DateTime CalibDate { get; set; }
|
||||
public DateTime CalibValidDate { get; set; }
|
||||
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
ComponentCfg() {}
|
||||
|
||||
public ComponentCfg(string name, IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
Name = name;
|
||||
Factory = factory;
|
||||
ParentName = string.Empty;
|
||||
InitializeAll();
|
||||
}
|
||||
|
||||
public string ComponentName { get { return Name; } }
|
||||
|
||||
public void InitializeAll()
|
||||
{
|
||||
Buoyancy = 1.00103;
|
||||
|
||||
CalibCertificateNr = string.Empty;
|
||||
CalibDate = TBF.UI.Constants.MinDate;
|
||||
CalibValidDate = TBF.UI.Constants.MaxDate;
|
||||
}
|
||||
|
||||
string[] paramNames = new string[]
|
||||
{
|
||||
"Buoyancy",
|
||||
};
|
||||
public string ParamName(int i) { return paramNames[i]; }
|
||||
public int ParamsCount() { return paramNames.Length; }
|
||||
|
||||
public ICollection<string> ParamValues(int i)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
if (i == -1)
|
||||
{
|
||||
return string.Format("{0}: Buoyancy = {1}", Name, Buoyancy);
|
||||
}
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 0: return Buoyancy.ToString();
|
||||
default: return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
public CfgUpdateFlags UpdateParam(int i, string strValue)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: Buoyancy = Utils.ParseUDouble(strValue); return CfgUpdateFlags.RestartRqrd;
|
||||
default: return CfgUpdateFlags.None;
|
||||
}
|
||||
}
|
||||
|
||||
public bool ValidateParam(int i, string strValue, out string message)
|
||||
{
|
||||
message = string.Empty;
|
||||
double dummy;
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
/// Real number between 0.8 and 1.2 expected
|
||||
if (Utils.TryParseUDouble(strValue, out dummy) && (dummy >= 0.8) && (dummy <= 1.2)) return true;
|
||||
break;
|
||||
default:
|
||||
message = "Invalid index";
|
||||
return false;
|
||||
}
|
||||
|
||||
message = ParamName(i) + " is invalid";
|
||||
return false;
|
||||
}
|
||||
|
||||
void CopyContentTo(ComponentCfg prms)
|
||||
{
|
||||
prms.Buoyancy = this.Buoyancy;
|
||||
}
|
||||
|
||||
public Config.Entities.IParamsProvider Clone()
|
||||
{
|
||||
ComponentCfg pars = new ComponentCfg();
|
||||
CopyContentTo(pars);
|
||||
return pars;
|
||||
}
|
||||
|
||||
public bool UpdateEmbeddedDbEntity()
|
||||
{
|
||||
return true; /// =OK, do nothing
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using TBF.Rig.Generic;
|
||||
|
||||
namespace TBF.Rig.DataContainers.Buoyancy
|
||||
{
|
||||
public class ComponentFactory : IComponentFactory
|
||||
{
|
||||
public string ClassName { get { return GetType().Namespace.Substring(8); } }
|
||||
|
||||
public IComponent DummyComponent() { return new Component(); }
|
||||
|
||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new Component(cfg); }
|
||||
|
||||
public IComponentCfg DefaultConfig() { return new ComponentCfg(this.GetType().Namespace.Substring(32), this); }
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
||||
{
|
||||
return ComponentCfgBase.CreateFromDbEntity(ComponentCfg.Serializer, component, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
///
|
||||
/// Copyright (c) 2019-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using TBF.Resources;
|
||||
|
||||
namespace TBF.Rig.DataContainers.Density
|
||||
{
|
||||
/// <summary>
|
||||
/// Holds measured (true) density value.
|
||||
/// </summary>
|
||||
public class Component : ComponentBase, GenericDevices.IHasCalendarEvents
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(Component));
|
||||
public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
|
||||
|
||||
readonly ComponentCfg myCfg;
|
||||
|
||||
public double RealDensity { get { return myCfg.RealDensity; } }
|
||||
public double AtTemperature { get { return myCfg.AtTemperature; } }
|
||||
|
||||
|
||||
public Component() { }
|
||||
|
||||
public Component(Generic.IComponentCfg cfg)
|
||||
: base(cfg)
|
||||
{
|
||||
myCfg = cfg as ComponentCfg;
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
/// This is to use sample density and temp. from this component in formulas
|
||||
Config.Data.RealDensity = RealDensity;
|
||||
Config.Data.AtTemperature = AtTemperature;
|
||||
log.FatalFormat("{0} initialized: {1}", Name, this);
|
||||
}
|
||||
|
||||
|
||||
public IList<Config.CalendarEvent.ICalendarEvent> GetCalendarEvents()
|
||||
{
|
||||
DateTime calibrationDue = myCfg.CalibValidDate;
|
||||
IList<Config.CalendarEvent.ICalendarEvent> calendarEvents = new List<Config.CalendarEvent.ICalendarEvent>();
|
||||
|
||||
if (calibrationDue > TBF.UI.Constants.MinDate)
|
||||
{
|
||||
/// Calibration due date calendar event
|
||||
calendarEvents.Add(new TBF.UI.Calendar.CalibrationDueDateEvent(calibrationDue.Date, Name,
|
||||
string.Format(Strings.Calibration_due_date_is_0,
|
||||
calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat))));
|
||||
if (DateTime.Now.Date <= calibrationDue.AddDays(-7))
|
||||
{
|
||||
/// Weekly reminders (last 5 weeks)
|
||||
calendarEvents.Add(new TBF.UI.Calendar.CalibrationReminderEvent(calibrationDue.Date.AddDays(-35), Name,
|
||||
string.Format(Strings.Calibration_due_date_is_0,
|
||||
calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)),
|
||||
false));
|
||||
}
|
||||
if (DateTime.Now.Date <= calibrationDue.Date)
|
||||
{
|
||||
/// Daily reminders (last 5 days)
|
||||
calendarEvents.Add(new TBF.UI.Calendar.CalibrationReminderEvent(calibrationDue.AddDays(-5), Name,
|
||||
string.Format(Strings.Calibration_due_date_is_0,
|
||||
calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)),
|
||||
true));
|
||||
}
|
||||
}
|
||||
return calendarEvents;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
///
|
||||
/// Copyright (c) 2019-2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
using TBF.Rig.Generic;
|
||||
|
||||
namespace TBF.Rig.DataContainers.Density
|
||||
{
|
||||
/// <summary>
|
||||
/// Holds backup and security options - serializable configuration.
|
||||
/// </summary>
|
||||
public class ComponentCfg : ComponentCfgBase, Generic.IComponentCfg, Config.Entities.IParamsProvider, TBF.Rig.GenericDevices.ICalibInfoCfg
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(ComponentCfg) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
public IComponentCfgCtrl GetControl(IList<Config.Entities.Component> cmpntEntities) { return new Configs.ParamsProvider.ComponentCfgCtrl(this, null); }
|
||||
|
||||
///
|
||||
/// Serialized parameters
|
||||
///
|
||||
public double RealDensity;
|
||||
public double AtTemperature;
|
||||
|
||||
/// Calibration info serialized parameters displayed in Metrology tab page
|
||||
public string CalibCertificateNr { get; set; }
|
||||
public DateTime CalibDate { get; set; }
|
||||
public DateTime CalibValidDate { get; set; }
|
||||
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
ComponentCfg() {}
|
||||
|
||||
public ComponentCfg(string name, IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
Name = name;
|
||||
Factory = factory;
|
||||
ParentName = string.Empty;
|
||||
InitializeAll();
|
||||
}
|
||||
|
||||
public string ComponentName { get { return Name; } }
|
||||
|
||||
public void InitializeAll()
|
||||
{
|
||||
RealDensity = 998.2008; /// kg/m3
|
||||
AtTemperature = 20.0; /// °C
|
||||
|
||||
CalibCertificateNr = string.Empty;
|
||||
CalibDate = TBF.UI.Constants.MinDate;
|
||||
CalibValidDate = TBF.UI.Constants.MaxDate;
|
||||
}
|
||||
|
||||
string[] paramNames = new string[]
|
||||
{
|
||||
"True density [kg/m3]",
|
||||
"@temperature [°C]",
|
||||
};
|
||||
public string ParamName(int i) { return paramNames[i]; }
|
||||
public int ParamsCount() { return paramNames.Length; }
|
||||
|
||||
public ICollection<string> ParamValues(int i)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
if (i == -1)
|
||||
{
|
||||
return string.Format("{0}: True density = {1} kg/m3 measured @temperature {2} °C", Name, RealDensity, AtTemperature);
|
||||
}
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 0: return RealDensity.ToString();
|
||||
case 1: return AtTemperature.ToString();
|
||||
default: return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
public CfgUpdateFlags UpdateParam(int i, string strValue)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: RealDensity = Utils.ParseUDouble(strValue); return CfgUpdateFlags.RestartRqrd;
|
||||
case 1: AtTemperature = Utils.ParseUDouble(strValue); return CfgUpdateFlags.RestartRqrd;
|
||||
default: return CfgUpdateFlags.None;
|
||||
}
|
||||
}
|
||||
|
||||
public bool ValidateParam(int i, string strValue, out string message)
|
||||
{
|
||||
message = string.Empty;
|
||||
double dummy;
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
/// Real number between 800 and 1200 kg/m3 expected
|
||||
if (Utils.TryParseUDouble(strValue, out dummy) && (dummy >= 800) && (dummy <= 1200)) return true;
|
||||
break;
|
||||
case 1:
|
||||
/// Real number above 0 expected
|
||||
if (Utils.TryParseUDouble(strValue, out dummy) && (dummy >= 0)) return true;
|
||||
break;
|
||||
default:
|
||||
message = "Invalid index";
|
||||
return false;
|
||||
}
|
||||
|
||||
message = ParamName(i) + " is invalid";
|
||||
return false;
|
||||
}
|
||||
|
||||
void CopyContentTo(ComponentCfg prms)
|
||||
{
|
||||
prms.RealDensity = this.RealDensity;
|
||||
prms.AtTemperature = this.AtTemperature;
|
||||
}
|
||||
|
||||
public Config.Entities.IParamsProvider Clone()
|
||||
{
|
||||
ComponentCfg pars = new ComponentCfg();
|
||||
CopyContentTo(pars);
|
||||
return pars;
|
||||
}
|
||||
|
||||
public bool UpdateEmbeddedDbEntity()
|
||||
{
|
||||
return true; /// =OK, do nothing
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using TBF.Rig.Generic;
|
||||
|
||||
namespace TBF.Rig.DataContainers.Density
|
||||
{
|
||||
public class ComponentFactory : IComponentFactory
|
||||
{
|
||||
public string ClassName { get { return GetType().Namespace.Substring(8); } }
|
||||
|
||||
public IComponent DummyComponent() { return new Component(); }
|
||||
|
||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new Component(cfg); }
|
||||
|
||||
public IComponentCfg DefaultConfig() { return new ComponentCfg(this.GetType().Namespace.Substring(32), this); }
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
||||
{
|
||||
return ComponentCfgBase.CreateFromDbEntity(ComponentCfg.Serializer, component, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
///
|
||||
/// Copyright (c) 2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using Config.Entities;
|
||||
using TBF.Rig.GenericDevices;
|
||||
using TBF.Resources;
|
||||
|
||||
namespace TBF.Rig.DataContainers.Evaporation
|
||||
{
|
||||
public class Component : ComponentBase, IEvaporation, GenericDevices.IHasCalendarEvents
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(Component));
|
||||
public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
|
||||
|
||||
readonly EvaporationCfg myCfg;
|
||||
|
||||
/// <summary>
|
||||
/// For a given temperature in [°C] returns an evaporation rate in [kg/s]
|
||||
/// </summary>
|
||||
public double EvaporationRate(double temperature)
|
||||
{
|
||||
return Config.Formulas.GetCorrection(temperature, Corrections) / 3600.0; /// Converted from kg/h to kg/s
|
||||
}
|
||||
|
||||
|
||||
public Component() { }
|
||||
|
||||
public Component(Generic.IComponentCfg cfg)
|
||||
: base(cfg)
|
||||
{
|
||||
myCfg = cfg as EvaporationCfg;
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
log.FatalFormat("{0} initialized: {1}", Name, this);
|
||||
}
|
||||
|
||||
|
||||
public IList<Config.CalendarEvent.ICalendarEvent> GetCalendarEvents()
|
||||
{
|
||||
DateTime calibrationDue = myCfg.CalibValidDate;
|
||||
IList<Config.CalendarEvent.ICalendarEvent> calendarEvents = new List<Config.CalendarEvent.ICalendarEvent>();
|
||||
|
||||
if (calibrationDue > TBF.UI.Constants.MinDate)
|
||||
{
|
||||
/// Calibration due date calendar event
|
||||
calendarEvents.Add(new TBF.UI.Calendar.CalibrationDueDateEvent(calibrationDue.Date, Name,
|
||||
string.Format(Strings.Calibration_due_date_is_0,
|
||||
calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat))));
|
||||
if (DateTime.Now.Date <= calibrationDue.AddDays(-7))
|
||||
{
|
||||
/// Weekly reminders (last 5 weeks)
|
||||
calendarEvents.Add(new TBF.UI.Calendar.CalibrationReminderEvent(calibrationDue.Date.AddDays(-35), Name,
|
||||
string.Format(Strings.Calibration_due_date_is_0,
|
||||
calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)),
|
||||
false));
|
||||
}
|
||||
if (DateTime.Now.Date <= calibrationDue.Date)
|
||||
{
|
||||
/// Daily reminders (last 5 days)
|
||||
calendarEvents.Add(new TBF.UI.Calendar.CalibrationReminderEvent(calibrationDue.AddDays(-5), Name,
|
||||
string.Format(Strings.Calibration_due_date_is_0,
|
||||
calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)),
|
||||
true));
|
||||
}
|
||||
}
|
||||
return calendarEvents;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
///
|
||||
/// Copyright (c) 2020-2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
using Config.Entities;
|
||||
using TBF.Rig.Generic;
|
||||
|
||||
namespace TBF.Rig.DataContainers.Evaporation
|
||||
{
|
||||
/// <summary>
|
||||
/// Holds backup and security options - serializable configuration.
|
||||
/// </summary>
|
||||
public class EvaporationCfg : ComponentCfgBase, Generic.IComponentCfg, TBF.Rig.GenericDevices.ICalibInfoCfg
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(EvaporationCfg) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
public IComponentCfgCtrl GetControl(IList<Config.Entities.Component> cmpntEntities) { return new EvaporationCfgCtrl(); }
|
||||
|
||||
/// Calibration info serialized parameters displayed in Metrology tab page
|
||||
public string CalibCertificateNr { get; set; }
|
||||
public DateTime CalibDate { get; set; }
|
||||
public DateTime CalibValidDate { get; set; }
|
||||
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
EvaporationCfg() {}
|
||||
|
||||
public EvaporationCfg(string name, IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
Name = name;
|
||||
Factory = factory;
|
||||
ParentName = string.Empty;
|
||||
InitializeAll();
|
||||
}
|
||||
|
||||
public string ComponentName { get { return Name; } }
|
||||
|
||||
public void InitializeAll()
|
||||
{
|
||||
CalibCertificateNr = string.Empty;
|
||||
CalibDate = TBF.UI.Constants.MinDate;
|
||||
CalibValidDate = TBF.UI.Constants.MaxDate;
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return Name;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
///
|
||||
/// Copyright (c) 2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
using TBF.Rig.Generic;
|
||||
|
||||
namespace TBF.Rig.DataContainers.Evaporation
|
||||
{
|
||||
public partial class EvaporationCfgCtrl : UserControl, IComponentCfgCtrl
|
||||
{
|
||||
public bool ShowMore { get { return false; } }
|
||||
|
||||
EvaporationCfg config;
|
||||
public IComponentCfg Config
|
||||
{
|
||||
get { return config as IComponentCfg; }
|
||||
set
|
||||
{
|
||||
config = value as EvaporationCfg;
|
||||
Redraw();
|
||||
}
|
||||
}
|
||||
|
||||
public EvaporationCfgCtrl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void EntryFormCfgCtrl_Load(object sender, EventArgs e)
|
||||
{
|
||||
Redraw();
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public void Unlock()
|
||||
{
|
||||
nameTextBox.Enabled = true;
|
||||
}
|
||||
|
||||
public CfgUpdateFlags VerifyCfg(ref string message)
|
||||
{
|
||||
CfgUpdateFlags flags = CfgUpdateFlags.None;
|
||||
return flags;
|
||||
}
|
||||
|
||||
public CfgUpdateFlags UpdateCfg()
|
||||
{
|
||||
CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd;
|
||||
|
||||
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
|
||||
|
||||
config.Name = nameTextBox.Text;
|
||||
|
||||
return flags;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
///
|
||||
/// Copyright (c) 2020 Sensus Slovensko a.s.
|
||||
///
|
||||
namespace TBF.Rig.DataContainers.Evaporation
|
||||
{
|
||||
partial class EvaporationCfgCtrl
|
||||
{
|
||||
/// <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 Component 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.nameTextBox = new System.Windows.Forms.TextBox();
|
||||
this.nameLabel = new System.Windows.Forms.Label();
|
||||
this.classNameLabel = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// nameTextBox
|
||||
//
|
||||
this.nameTextBox.Enabled = false;
|
||||
this.nameTextBox.Location = new System.Drawing.Point(137, 57);
|
||||
this.nameTextBox.Name = "nameTextBox";
|
||||
this.nameTextBox.Size = new System.Drawing.Size(130, 20);
|
||||
this.nameTextBox.TabIndex = 5;
|
||||
//
|
||||
// nameLabel
|
||||
//
|
||||
this.nameLabel.AutoSize = true;
|
||||
this.nameLabel.Location = new System.Drawing.Point(27, 60);
|
||||
this.nameLabel.Name = "nameLabel";
|
||||
this.nameLabel.Size = new System.Drawing.Size(35, 13);
|
||||
this.nameLabel.TabIndex = 4;
|
||||
this.nameLabel.Text = "Name";
|
||||
//
|
||||
// classNameLabel
|
||||
//
|
||||
this.classNameLabel.AutoSize = true;
|
||||
this.classNameLabel.Location = new System.Drawing.Point(134, 33);
|
||||
this.classNameLabel.Name = "classNameLabel";
|
||||
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
|
||||
this.classNameLabel.TabIndex = 3;
|
||||
this.classNameLabel.Text = "ComonentName";
|
||||
//
|
||||
// BasicPrinterCfgCtrl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.nameTextBox);
|
||||
this.Controls.Add(this.nameLabel);
|
||||
this.Controls.Add(this.classNameLabel);
|
||||
this.Name = "BasicPrinterCfgCtrl";
|
||||
this.Size = new System.Drawing.Size(300, 200);
|
||||
this.Load += new System.EventHandler(this.EntryFormCfgCtrl_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;
|
||||
}
|
||||
}
|
||||
@@ -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>
|
||||
@@ -0,0 +1,26 @@
|
||||
///
|
||||
/// Copyright (c) 2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using TBF.Rig.Generic;
|
||||
|
||||
namespace TBF.Rig.DataContainers.Evaporation
|
||||
{
|
||||
public class Factory : IComponentFactory
|
||||
{
|
||||
public string ClassName { get { return GetType().Namespace.Substring(8); } }
|
||||
|
||||
public void ResetStaticProperties() { }
|
||||
|
||||
public IComponent DummyComponent() { return new Component(); }
|
||||
|
||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new Component(cfg); }
|
||||
|
||||
public IComponentCfg DefaultConfig() { return new EvaporationCfg(this.GetType().Namespace.Substring(32), this); }
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
||||
{
|
||||
return ComponentCfgBase.CreateFromDbEntity(EvaporationCfg.Serializer, component, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,420 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
namespace TBF.Rig.DataEntry.Combined
|
||||
{
|
||||
partial class CycleBeginningForm
|
||||
{
|
||||
/// <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.okButton = new System.Windows.Forms.Button();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.aux1ComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.main1ComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.checkBox1 = new System.Windows.Forms.CheckBox();
|
||||
this.auxSN1Label = new System.Windows.Forms.Label();
|
||||
this.mainSN1Label = new System.Windows.Forms.Label();
|
||||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||
this.aux2ComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.main2ComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.checkBox2 = new System.Windows.Forms.CheckBox();
|
||||
this.auxSN2Label = new System.Windows.Forms.Label();
|
||||
this.mainSN2Label = new System.Windows.Forms.Label();
|
||||
this.groupBox3 = new System.Windows.Forms.GroupBox();
|
||||
this.aux3ComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.main3ComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.checkBox3 = new System.Windows.Forms.CheckBox();
|
||||
this.auxSN3Label = new System.Windows.Forms.Label();
|
||||
this.mainSN3Label = new System.Windows.Forms.Label();
|
||||
this.clearButton = new System.Windows.Forms.Button();
|
||||
this.orderGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.orderComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.remarkComboBox1 = new System.Windows.Forms.ComboBox();
|
||||
this.remarkComboBox2 = new System.Windows.Forms.ComboBox();
|
||||
this.remarkComboBox3 = new System.Windows.Forms.ComboBox();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.groupBox2.SuspendLayout();
|
||||
this.groupBox3.SuspendLayout();
|
||||
this.orderGroupBox.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// 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(589, 33);
|
||||
this.okButton.Name = "okButton";
|
||||
this.okButton.Size = new System.Drawing.Size(117, 63);
|
||||
this.okButton.TabIndex = 0;
|
||||
this.okButton.Text = "OK";
|
||||
this.okButton.UseVisualStyleBackColor = true;
|
||||
this.okButton.Click += new System.EventHandler(this.okButton_Click);
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
this.groupBox1.Controls.Add(this.remarkComboBox1);
|
||||
this.groupBox1.Controls.Add(this.aux1ComboBox);
|
||||
this.groupBox1.Controls.Add(this.main1ComboBox);
|
||||
this.groupBox1.Controls.Add(this.checkBox1);
|
||||
this.groupBox1.Controls.Add(this.auxSN1Label);
|
||||
this.groupBox1.Controls.Add(this.mainSN1Label);
|
||||
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(28, 118);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Size = new System.Drawing.Size(533, 143);
|
||||
this.groupBox1.TabIndex = 1;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "Water Meter 1";
|
||||
this.groupBox1.Visible = false;
|
||||
//
|
||||
// aux1ComboBox
|
||||
//
|
||||
this.aux1ComboBox.FormattingEnabled = true;
|
||||
this.aux1ComboBox.Location = new System.Drawing.Point(318, 64);
|
||||
this.aux1ComboBox.Name = "aux1ComboBox";
|
||||
this.aux1ComboBox.Size = new System.Drawing.Size(175, 31);
|
||||
this.aux1ComboBox.TabIndex = 6;
|
||||
this.aux1ComboBox.Visible = false;
|
||||
this.aux1ComboBox.SelectedIndexChanged += new System.EventHandler(this.aux1ComboBox_SelectedIndexChanged);
|
||||
this.aux1ComboBox.TextChanged += new System.EventHandler(this.aux1ComboBox_TextChanged);
|
||||
this.aux1ComboBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.aux1ComboBox_KeyPress);
|
||||
//
|
||||
// main1ComboBox
|
||||
//
|
||||
this.main1ComboBox.FormattingEnabled = true;
|
||||
this.main1ComboBox.Location = new System.Drawing.Point(318, 27);
|
||||
this.main1ComboBox.Name = "main1ComboBox";
|
||||
this.main1ComboBox.Size = new System.Drawing.Size(175, 31);
|
||||
this.main1ComboBox.TabIndex = 5;
|
||||
this.main1ComboBox.Visible = false;
|
||||
this.main1ComboBox.SelectedIndexChanged += new System.EventHandler(this.main1ComboBox_SelectedIndexChanged);
|
||||
this.main1ComboBox.TextChanged += new System.EventHandler(this.main1ComboBox_TextChanged);
|
||||
this.main1ComboBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.main1ComboBox_KeyPress);
|
||||
//
|
||||
// checkBox1
|
||||
//
|
||||
this.checkBox1.AutoSize = true;
|
||||
this.checkBox1.Font = new System.Drawing.Font("Verdana", 27.75F);
|
||||
this.checkBox1.ImeMode = System.Windows.Forms.ImeMode.NoControl;
|
||||
this.checkBox1.Location = new System.Drawing.Point(506, 28);
|
||||
this.checkBox1.Name = "checkBox1";
|
||||
this.checkBox1.Size = new System.Drawing.Size(15, 14);
|
||||
this.checkBox1.TabIndex = 4;
|
||||
this.checkBox1.UseVisualStyleBackColor = true;
|
||||
this.checkBox1.Visible = false;
|
||||
//
|
||||
// auxSN1Label
|
||||
//
|
||||
this.auxSN1Label.AutoSize = true;
|
||||
this.auxSN1Label.Location = new System.Drawing.Point(21, 67);
|
||||
this.auxSN1Label.Name = "auxSN1Label";
|
||||
this.auxSN1Label.Size = new System.Drawing.Size(193, 23);
|
||||
this.auxSN1Label.TabIndex = 2;
|
||||
this.auxSN1Label.Text = "Aux. WM Serial Nr.";
|
||||
this.auxSN1Label.Visible = false;
|
||||
//
|
||||
// mainSN1Label
|
||||
//
|
||||
this.mainSN1Label.AutoSize = true;
|
||||
this.mainSN1Label.Location = new System.Drawing.Point(21, 33);
|
||||
this.mainSN1Label.Name = "mainSN1Label";
|
||||
this.mainSN1Label.Size = new System.Drawing.Size(195, 23);
|
||||
this.mainSN1Label.TabIndex = 0;
|
||||
this.mainSN1Label.Text = "Main WM Serial Nr.";
|
||||
this.mainSN1Label.Visible = false;
|
||||
//
|
||||
// groupBox2
|
||||
//
|
||||
this.groupBox2.Controls.Add(this.remarkComboBox2);
|
||||
this.groupBox2.Controls.Add(this.aux2ComboBox);
|
||||
this.groupBox2.Controls.Add(this.main2ComboBox);
|
||||
this.groupBox2.Controls.Add(this.checkBox2);
|
||||
this.groupBox2.Controls.Add(this.auxSN2Label);
|
||||
this.groupBox2.Controls.Add(this.mainSN2Label);
|
||||
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(28, 275);
|
||||
this.groupBox2.Name = "groupBox2";
|
||||
this.groupBox2.Size = new System.Drawing.Size(533, 143);
|
||||
this.groupBox2.TabIndex = 2;
|
||||
this.groupBox2.TabStop = false;
|
||||
this.groupBox2.Text = "Water Meter 2";
|
||||
this.groupBox2.Visible = false;
|
||||
//
|
||||
// aux2ComboBox
|
||||
//
|
||||
this.aux2ComboBox.FormattingEnabled = true;
|
||||
this.aux2ComboBox.Location = new System.Drawing.Point(318, 64);
|
||||
this.aux2ComboBox.Name = "aux2ComboBox";
|
||||
this.aux2ComboBox.Size = new System.Drawing.Size(175, 31);
|
||||
this.aux2ComboBox.TabIndex = 10;
|
||||
this.aux2ComboBox.Visible = false;
|
||||
this.aux2ComboBox.SelectedIndexChanged += new System.EventHandler(this.aux2ComboBox_SelectedIndexChanged);
|
||||
this.aux2ComboBox.TextChanged += new System.EventHandler(this.aux2ComboBox_TextChanged);
|
||||
this.aux2ComboBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.aux2ComboBox_KeyPress);
|
||||
//
|
||||
// main2ComboBox
|
||||
//
|
||||
this.main2ComboBox.FormattingEnabled = true;
|
||||
this.main2ComboBox.Location = new System.Drawing.Point(318, 27);
|
||||
this.main2ComboBox.Name = "main2ComboBox";
|
||||
this.main2ComboBox.Size = new System.Drawing.Size(175, 31);
|
||||
this.main2ComboBox.TabIndex = 9;
|
||||
this.main2ComboBox.Visible = false;
|
||||
this.main2ComboBox.SelectedIndexChanged += new System.EventHandler(this.main2ComboBox_SelectedIndexChanged);
|
||||
this.main2ComboBox.TextChanged += new System.EventHandler(this.main2ComboBox_TextChanged);
|
||||
this.main2ComboBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.main2ComboBox_KeyPress);
|
||||
//
|
||||
// checkBox2
|
||||
//
|
||||
this.checkBox2.AutoSize = true;
|
||||
this.checkBox2.Font = new System.Drawing.Font("Verdana", 27.75F);
|
||||
this.checkBox2.ImeMode = System.Windows.Forms.ImeMode.NoControl;
|
||||
this.checkBox2.Location = new System.Drawing.Point(506, 28);
|
||||
this.checkBox2.Name = "checkBox2";
|
||||
this.checkBox2.Size = new System.Drawing.Size(15, 14);
|
||||
this.checkBox2.TabIndex = 8;
|
||||
this.checkBox2.UseVisualStyleBackColor = true;
|
||||
this.checkBox2.Visible = false;
|
||||
//
|
||||
// auxSN2Label
|
||||
//
|
||||
this.auxSN2Label.AutoSize = true;
|
||||
this.auxSN2Label.Location = new System.Drawing.Point(21, 67);
|
||||
this.auxSN2Label.Name = "auxSN2Label";
|
||||
this.auxSN2Label.Size = new System.Drawing.Size(193, 23);
|
||||
this.auxSN2Label.TabIndex = 2;
|
||||
this.auxSN2Label.Text = "Aux. WM Serial Nr.";
|
||||
this.auxSN2Label.Visible = false;
|
||||
//
|
||||
// mainSN2Label
|
||||
//
|
||||
this.mainSN2Label.AutoSize = true;
|
||||
this.mainSN2Label.Location = new System.Drawing.Point(21, 33);
|
||||
this.mainSN2Label.Name = "mainSN2Label";
|
||||
this.mainSN2Label.Size = new System.Drawing.Size(195, 23);
|
||||
this.mainSN2Label.TabIndex = 0;
|
||||
this.mainSN2Label.Text = "Main WM Serial Nr.";
|
||||
this.mainSN2Label.Visible = false;
|
||||
//
|
||||
// groupBox3
|
||||
//
|
||||
this.groupBox3.Controls.Add(this.remarkComboBox3);
|
||||
this.groupBox3.Controls.Add(this.aux3ComboBox);
|
||||
this.groupBox3.Controls.Add(this.main3ComboBox);
|
||||
this.groupBox3.Controls.Add(this.checkBox3);
|
||||
this.groupBox3.Controls.Add(this.auxSN3Label);
|
||||
this.groupBox3.Controls.Add(this.mainSN3Label);
|
||||
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(28, 430);
|
||||
this.groupBox3.Name = "groupBox3";
|
||||
this.groupBox3.Size = new System.Drawing.Size(533, 143);
|
||||
this.groupBox3.TabIndex = 3;
|
||||
this.groupBox3.TabStop = false;
|
||||
this.groupBox3.Text = "Water Meter 3";
|
||||
this.groupBox3.Visible = false;
|
||||
//
|
||||
// aux3ComboBox
|
||||
//
|
||||
this.aux3ComboBox.FormattingEnabled = true;
|
||||
this.aux3ComboBox.Location = new System.Drawing.Point(318, 64);
|
||||
this.aux3ComboBox.Name = "aux3ComboBox";
|
||||
this.aux3ComboBox.Size = new System.Drawing.Size(175, 31);
|
||||
this.aux3ComboBox.TabIndex = 10;
|
||||
this.aux3ComboBox.Visible = false;
|
||||
this.aux3ComboBox.SelectedIndexChanged += new System.EventHandler(this.aux3ComboBox_SelectedIndexChanged);
|
||||
this.aux3ComboBox.TextChanged += new System.EventHandler(this.aux3ComboBox_TextChanged);
|
||||
this.aux3ComboBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.aux3ComboBox_KeyPress);
|
||||
//
|
||||
// main3ComboBox
|
||||
//
|
||||
this.main3ComboBox.FormattingEnabled = true;
|
||||
this.main3ComboBox.Location = new System.Drawing.Point(318, 27);
|
||||
this.main3ComboBox.Name = "main3ComboBox";
|
||||
this.main3ComboBox.Size = new System.Drawing.Size(175, 31);
|
||||
this.main3ComboBox.TabIndex = 9;
|
||||
this.main3ComboBox.Visible = false;
|
||||
this.main3ComboBox.SelectedIndexChanged += new System.EventHandler(this.main3ComboBox_SelectedIndexChanged);
|
||||
this.main3ComboBox.TextChanged += new System.EventHandler(this.main3ComboBox_TextChanged);
|
||||
this.main3ComboBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.main3ComboBox_KeyPress);
|
||||
//
|
||||
// checkBox3
|
||||
//
|
||||
this.checkBox3.AutoSize = true;
|
||||
this.checkBox3.Font = new System.Drawing.Font("Verdana", 27.75F);
|
||||
this.checkBox3.ImeMode = System.Windows.Forms.ImeMode.NoControl;
|
||||
this.checkBox3.Location = new System.Drawing.Point(506, 27);
|
||||
this.checkBox3.Name = "checkBox3";
|
||||
this.checkBox3.Size = new System.Drawing.Size(15, 14);
|
||||
this.checkBox3.TabIndex = 8;
|
||||
this.checkBox3.UseVisualStyleBackColor = true;
|
||||
this.checkBox3.Visible = false;
|
||||
//
|
||||
// auxSN3Label
|
||||
//
|
||||
this.auxSN3Label.AutoSize = true;
|
||||
this.auxSN3Label.Location = new System.Drawing.Point(21, 67);
|
||||
this.auxSN3Label.Name = "auxSN3Label";
|
||||
this.auxSN3Label.Size = new System.Drawing.Size(193, 23);
|
||||
this.auxSN3Label.TabIndex = 2;
|
||||
this.auxSN3Label.Text = "Aux. WM Serial Nr.";
|
||||
this.auxSN3Label.Visible = false;
|
||||
//
|
||||
// mainSN3Label
|
||||
//
|
||||
this.mainSN3Label.AutoSize = true;
|
||||
this.mainSN3Label.Location = new System.Drawing.Point(21, 33);
|
||||
this.mainSN3Label.Name = "mainSN3Label";
|
||||
this.mainSN3Label.Size = new System.Drawing.Size(195, 23);
|
||||
this.mainSN3Label.TabIndex = 0;
|
||||
this.mainSN3Label.Text = "Main WM Serial Nr.";
|
||||
this.mainSN3Label.Visible = false;
|
||||
//
|
||||
// clearButton
|
||||
//
|
||||
this.clearButton.Font = new System.Drawing.Font("Verdana", 14.25F);
|
||||
this.clearButton.ForeColor = System.Drawing.Color.Black;
|
||||
this.clearButton.ImeMode = System.Windows.Forms.ImeMode.NoControl;
|
||||
this.clearButton.Location = new System.Drawing.Point(589, 116);
|
||||
this.clearButton.Name = "clearButton";
|
||||
this.clearButton.Size = new System.Drawing.Size(117, 63);
|
||||
this.clearButton.TabIndex = 9;
|
||||
this.clearButton.Text = "Clear";
|
||||
this.clearButton.UseVisualStyleBackColor = true;
|
||||
this.clearButton.Click += new System.EventHandler(this.clearButton_Click);
|
||||
//
|
||||
// orderGroupBox
|
||||
//
|
||||
this.orderGroupBox.Controls.Add(this.orderComboBox);
|
||||
this.orderGroupBox.Font = new System.Drawing.Font("Verdana", 14.25F);
|
||||
this.orderGroupBox.ForeColor = System.Drawing.Color.Black;
|
||||
this.orderGroupBox.Location = new System.Drawing.Point(28, 16);
|
||||
this.orderGroupBox.Name = "orderGroupBox";
|
||||
this.orderGroupBox.Size = new System.Drawing.Size(533, 82);
|
||||
this.orderGroupBox.TabIndex = 10;
|
||||
this.orderGroupBox.TabStop = false;
|
||||
this.orderGroupBox.Text = "Order";
|
||||
//
|
||||
// orderComboBox
|
||||
//
|
||||
this.orderComboBox.FormattingEnabled = true;
|
||||
this.orderComboBox.Location = new System.Drawing.Point(196, 31);
|
||||
this.orderComboBox.Name = "orderComboBox";
|
||||
this.orderComboBox.Size = new System.Drawing.Size(297, 31);
|
||||
this.orderComboBox.TabIndex = 0;
|
||||
//
|
||||
// remarkComboBox1
|
||||
//
|
||||
this.remarkComboBox1.Font = new System.Drawing.Font("Verdana", 14.25F);
|
||||
this.remarkComboBox1.FormattingEnabled = true;
|
||||
this.remarkComboBox1.Location = new System.Drawing.Point(56, 101);
|
||||
this.remarkComboBox1.Name = "remarkComboBox1";
|
||||
this.remarkComboBox1.Size = new System.Drawing.Size(437, 31);
|
||||
this.remarkComboBox1.TabIndex = 35;
|
||||
this.remarkComboBox1.Visible = false;
|
||||
//
|
||||
// remarkComboBox2
|
||||
//
|
||||
this.remarkComboBox2.Font = new System.Drawing.Font("Verdana", 14.25F);
|
||||
this.remarkComboBox2.FormattingEnabled = true;
|
||||
this.remarkComboBox2.Location = new System.Drawing.Point(56, 101);
|
||||
this.remarkComboBox2.Name = "remarkComboBox2";
|
||||
this.remarkComboBox2.Size = new System.Drawing.Size(437, 31);
|
||||
this.remarkComboBox2.TabIndex = 36;
|
||||
this.remarkComboBox2.Visible = false;
|
||||
//
|
||||
// remarkComboBox3
|
||||
//
|
||||
this.remarkComboBox3.Font = new System.Drawing.Font("Verdana", 14.25F);
|
||||
this.remarkComboBox3.FormattingEnabled = true;
|
||||
this.remarkComboBox3.Location = new System.Drawing.Point(56, 101);
|
||||
this.remarkComboBox3.Name = "remarkComboBox3";
|
||||
this.remarkComboBox3.Size = new System.Drawing.Size(437, 31);
|
||||
this.remarkComboBox3.TabIndex = 37;
|
||||
this.remarkComboBox3.Visible = false;
|
||||
//
|
||||
// CycleBeginningForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.AutoSize = true;
|
||||
this.BackColor = System.Drawing.Color.DarkGray;
|
||||
this.ClientSize = new System.Drawing.Size(732, 593);
|
||||
this.Controls.Add(this.orderGroupBox);
|
||||
this.Controls.Add(this.clearButton);
|
||||
this.Controls.Add(this.groupBox3);
|
||||
this.Controls.Add(this.groupBox2);
|
||||
this.Controls.Add(this.groupBox1);
|
||||
this.Controls.Add(this.okButton);
|
||||
this.ForeColor = System.Drawing.Color.Black;
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
|
||||
this.Name = "CycleBeginningForm";
|
||||
this.Text = "Daten";
|
||||
this.TopMost = true;
|
||||
this.Load += new System.EventHandler(this.CycleBeginningForm_Load);
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
this.groupBox1.PerformLayout();
|
||||
this.groupBox2.ResumeLayout(false);
|
||||
this.groupBox2.PerformLayout();
|
||||
this.groupBox3.ResumeLayout(false);
|
||||
this.groupBox3.PerformLayout();
|
||||
this.orderGroupBox.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button okButton;
|
||||
private System.Windows.Forms.GroupBox groupBox1;
|
||||
private System.Windows.Forms.Label mainSN1Label;
|
||||
private System.Windows.Forms.Label auxSN1Label;
|
||||
private System.Windows.Forms.GroupBox groupBox2;
|
||||
private System.Windows.Forms.Label auxSN2Label;
|
||||
private System.Windows.Forms.Label mainSN2Label;
|
||||
private System.Windows.Forms.GroupBox groupBox3;
|
||||
private System.Windows.Forms.Label auxSN3Label;
|
||||
private System.Windows.Forms.Label mainSN3Label;
|
||||
private System.Windows.Forms.Button clearButton;
|
||||
private System.Windows.Forms.CheckBox checkBox1;
|
||||
private System.Windows.Forms.CheckBox checkBox2;
|
||||
private System.Windows.Forms.CheckBox checkBox3;
|
||||
private System.Windows.Forms.GroupBox orderGroupBox;
|
||||
private System.Windows.Forms.ComboBox orderComboBox;
|
||||
private System.Windows.Forms.ComboBox aux1ComboBox;
|
||||
private System.Windows.Forms.ComboBox main1ComboBox;
|
||||
private System.Windows.Forms.ComboBox aux2ComboBox;
|
||||
private System.Windows.Forms.ComboBox main2ComboBox;
|
||||
private System.Windows.Forms.ComboBox aux3ComboBox;
|
||||
private System.Windows.Forms.ComboBox main3ComboBox;
|
||||
private System.Windows.Forms.ComboBox remarkComboBox1;
|
||||
private System.Windows.Forms.ComboBox remarkComboBox2;
|
||||
private System.Windows.Forms.ComboBox remarkComboBox3;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,317 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
using log4net;
|
||||
using TBF.Resources;
|
||||
|
||||
#pragma warning disable 162 /// Disables 'Unreachable code detected' warning
|
||||
|
||||
namespace TBF.Rig.DataEntry.Combined
|
||||
{
|
||||
public partial class CycleBeginningForm : Form, GenericDevices.IHasCompleted
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(CycleBeginningForm));
|
||||
|
||||
/// <summary> Number of water meters </summary>
|
||||
public readonly int WaterMetersCount;
|
||||
public readonly bool RemarksEnabled;
|
||||
|
||||
// To be retrieved after the form closes
|
||||
public string PurchaseOrder;
|
||||
public string[] MainSNText;
|
||||
public string[] AuxSNText;
|
||||
public bool[] Disabled;
|
||||
public string[] Remark;
|
||||
|
||||
// Set to 'true' when the form closes
|
||||
public bool Completed { get { return completed; } }
|
||||
bool completed;
|
||||
|
||||
/// <summary> Number of text boxes for serial numbers </summary>
|
||||
int TextBoxesCount;
|
||||
Label[] mainLabels;
|
||||
Label[] auxLabels;
|
||||
ComboBox[] mainComboBoxes;
|
||||
ComboBox[] auxComboBoxes;
|
||||
CheckBox[] checkBoxes;
|
||||
ComboBox[] remarkBoxes;
|
||||
IList<ComboBox> enabledComboBoxes;
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor - Default number of compound water meters
|
||||
/// </summary>
|
||||
public CycleBeginningForm()
|
||||
: this (TBF.Data.CompoundWMsCount, false)
|
||||
{
|
||||
this.WaterMetersCount = TBF.Data.CompoundWMsCount;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="compoundWaterMetersCount">Number of text boxes for serial numbers</param>
|
||||
/// <param name="remarksEnabled">Enable </param>
|
||||
public CycleBeginningForm(int compoundWaterMetersCount, bool remarksEnabled)
|
||||
{
|
||||
InitializeComponent();
|
||||
ControlBox = false;
|
||||
|
||||
TextBoxesCount = 3;
|
||||
mainLabels = new Label[] { mainSN1Label, mainSN2Label, mainSN3Label };
|
||||
auxLabels = new Label[] { auxSN1Label, auxSN2Label, auxSN3Label };
|
||||
mainComboBoxes = new ComboBox[] { main1ComboBox, main2ComboBox, main3ComboBox };
|
||||
auxComboBoxes = new ComboBox[] { aux1ComboBox, aux2ComboBox, aux3ComboBox };
|
||||
checkBoxes = new CheckBox[] { checkBox1, checkBox2, checkBox3 };
|
||||
remarkBoxes = new ComboBox[] { remarkComboBox1, remarkComboBox2, remarkComboBox3 };
|
||||
|
||||
this.WaterMetersCount = compoundWaterMetersCount; /// = Program.CompondWMsCount
|
||||
this.RemarksEnabled = remarksEnabled;
|
||||
|
||||
MainSNText = new string[compoundWaterMetersCount];
|
||||
AuxSNText = new string[compoundWaterMetersCount];
|
||||
Disabled = new bool[compoundWaterMetersCount];
|
||||
Remark = new string[compoundWaterMetersCount];
|
||||
enabledComboBoxes = new List<ComboBox>();
|
||||
|
||||
ShuffleTextBoxes(compoundWaterMetersCount);
|
||||
|
||||
Height = 115 + WaterMetersCount * 157;
|
||||
|
||||
completed = false;
|
||||
StartForceCloseHandler();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Make sure the layout of labels/text boxes on the screen
|
||||
/// corresponds to the layout of watermeters of the test bench.
|
||||
/// </summary>
|
||||
/// <param name="compoundWMsCount">Numebr of combined watermeters</param>
|
||||
void ShuffleTextBoxes(int compoundWMsCount)
|
||||
{
|
||||
if (compoundWMsCount < TextBoxesCount) TextBoxesCount = compoundWMsCount;
|
||||
}
|
||||
|
||||
private void CycleBeginningForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
Localize();
|
||||
|
||||
DEUtils.PrepareCombo(orderComboBox, Program.LocalSettings.PurchaseOrderHistory);
|
||||
|
||||
if (WaterMetersCount >= 1) groupBox1.Visible = true;
|
||||
if (WaterMetersCount >= 2) groupBox2.Visible = true;
|
||||
if (WaterMetersCount >= 3) groupBox3.Visible = true;
|
||||
|
||||
for (int i = 0; i < TextBoxesCount; i++)
|
||||
{
|
||||
mainLabels[i].Visible = mainComboBoxes[i].Visible = true;
|
||||
auxLabels[i].Visible = auxComboBoxes[i].Visible = true;
|
||||
checkBoxes[i].Visible = true;
|
||||
if (RemarksEnabled)
|
||||
{
|
||||
DEUtils.PrepareCombo(remarkBoxes[i], Program.LocalSettings.RemarkHistory, true);
|
||||
remarkBoxes[i].Visible = true;
|
||||
}
|
||||
enabledComboBoxes.Add(mainComboBoxes[i]);
|
||||
enabledComboBoxes.Add(auxComboBoxes[i]);
|
||||
|
||||
if (Program.LocalSettings.LastMainSNTextsCount == TextBoxesCount &&
|
||||
Program.LocalSettings.LastAuxSNTextsCount == TextBoxesCount)
|
||||
{
|
||||
mainComboBoxes[i].Items.Add((Program.LocalSettings.LastMainSNTexts[i] == null) ? string.Empty : Program.LocalSettings.LastMainSNTexts[i]);
|
||||
auxComboBoxes[i].Items.Add((Program.LocalSettings.LastAuxSNTexts[i] == null) ? string.Empty : Program.LocalSettings.LastAuxSNTexts[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Localize()
|
||||
{
|
||||
Text = Strings.Data;
|
||||
orderGroupBox.Text = Strings.Purchase_order;
|
||||
groupBox1.Text = Strings.Water_Meter + " 1";
|
||||
groupBox2.Text = Strings.Water_Meter + " 2";
|
||||
groupBox3.Text = Strings.Water_Meter + " 3";
|
||||
mainSN1Label.Text = Strings.Main_WM_SerialNr;
|
||||
mainSN2Label.Text = Strings.Main_WM_SerialNr;
|
||||
mainSN3Label.Text = Strings.Main_WM_SerialNr;
|
||||
auxSN1Label.Text = Strings.Aux_WM_SerialNr;
|
||||
auxSN2Label.Text = Strings.Aux_WM_SerialNr;
|
||||
auxSN3Label.Text = Strings.Aux_WM_SerialNr;
|
||||
okButton.Text = Strings.OkBtnText;
|
||||
clearButton.Text = Strings.ClearBtnText;
|
||||
}
|
||||
|
||||
private void okButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
PurchaseOrder = orderComboBox.Text;
|
||||
Program.LocalSettings.UpdateHistory(orderComboBox.Text,
|
||||
ref Program.LocalSettings.PurchaseOrderHistory
|
||||
#if FUZHOU_150 || FUZHOU_300
|
||||
, 20
|
||||
#endif
|
||||
);
|
||||
|
||||
Program.LocalSettings.LastMainSNTexts = MainSNText;
|
||||
Program.LocalSettings.LastAuxSNTexts = AuxSNText;
|
||||
|
||||
for (int i = 0; i < TextBoxesCount; i++)
|
||||
{
|
||||
if (RemarksEnabled)
|
||||
{
|
||||
Program.LocalSettings.UpdateHistory(remarkBoxes[i].Text, ref Program.LocalSettings.RemarkHistory, 20);
|
||||
}
|
||||
MainSNText[i] = mainComboBoxes[i].Text;
|
||||
AuxSNText[i] = auxComboBoxes[i].Text;
|
||||
Disabled[i] = !checkBoxes[i].Checked;
|
||||
Remark[i] = remarkBoxes[i].Text;
|
||||
}
|
||||
|
||||
completed = true;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void clearButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
for (int i = 0; i < TextBoxesCount; i++)
|
||||
{
|
||||
mainComboBoxes[i].Text = string.Empty;
|
||||
auxComboBoxes[i].Text = string.Empty;
|
||||
checkBoxes[i].Checked = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// When one combo box is updated using drop-down menu, all combo boxes
|
||||
/// are updated by this function.
|
||||
/// </summary>
|
||||
private void UpdateAllCombos()
|
||||
{
|
||||
for (int i = 0; i < TextBoxesCount; i++)
|
||||
{
|
||||
mainComboBoxes[i].Text = Program.LocalSettings.LastMainSNTexts[i];
|
||||
auxComboBoxes[i].Text = Program.LocalSettings.LastAuxSNTexts[i];
|
||||
checkBoxes[i].Checked = !string.IsNullOrEmpty(mainComboBoxes[i].Text)
|
||||
|| !string.IsNullOrEmpty(auxComboBoxes[i].Text);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void main1ComboBox_TextChanged(object sender, EventArgs e) { checkBox1.Checked = true; }
|
||||
private void main1ComboBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (Program.LocalSettings.LastMainSNTextsCount == WaterMetersCount)
|
||||
{
|
||||
if (main1ComboBox.Text.Equals(main1ComboBox.Items[0])) UpdateAllCombos();
|
||||
}
|
||||
}
|
||||
|
||||
private void aux1ComboBox_TextChanged(object sender, EventArgs e) { checkBox1.Checked = true; }
|
||||
private void aux1ComboBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (Program.LocalSettings.LastAuxSNTextsCount == WaterMetersCount)
|
||||
{
|
||||
if (aux1ComboBox.Text.Equals(aux1ComboBox.Items[0])) UpdateAllCombos();
|
||||
}
|
||||
}
|
||||
|
||||
private void main2ComboBox_TextChanged(object sender, EventArgs e) { checkBox2.Checked = true; }
|
||||
private void main2ComboBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (Program.LocalSettings.LastMainSNTextsCount == WaterMetersCount)
|
||||
{
|
||||
if (main2ComboBox.Text.Equals(main2ComboBox.Items[0])) UpdateAllCombos();
|
||||
}
|
||||
}
|
||||
|
||||
private void aux2ComboBox_TextChanged(object sender, EventArgs e) { checkBox2.Checked = true; }
|
||||
private void aux2ComboBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (Program.LocalSettings.LastAuxSNTextsCount == WaterMetersCount)
|
||||
{
|
||||
if (aux2ComboBox.Text.Equals(aux2ComboBox.Items[0])) UpdateAllCombos();
|
||||
}
|
||||
}
|
||||
|
||||
private void main3ComboBox_TextChanged(object sender, EventArgs e) { checkBox3.Checked = true; }
|
||||
private void main3ComboBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (Program.LocalSettings.LastMainSNTextsCount == WaterMetersCount)
|
||||
{
|
||||
if (main3ComboBox.Text.Equals(main3ComboBox.Items[0])) UpdateAllCombos();
|
||||
}
|
||||
}
|
||||
|
||||
private void aux3ComboBox_TextChanged(object sender, EventArgs e) { checkBox3.Checked = true; }
|
||||
private void aux3ComboBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (Program.LocalSettings.LastAuxSNTextsCount == WaterMetersCount)
|
||||
{
|
||||
if (aux3ComboBox.Text.Equals(aux3ComboBox.Items[0])) UpdateAllCombos();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#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
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Process a key press within any enabled text boxe
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
/// <param name="currentFocusOwner">TextBox control which received the event</param>
|
||||
private void ProcKeyPress(object sender, KeyPressEventArgs e, ComboBox currentFocusOwner)
|
||||
{
|
||||
#if !CEVAK_200
|
||||
if (e.KeyChar == '+')
|
||||
{
|
||||
/// Process '+' key ..... Form completed
|
||||
okButton_Click(sender, e);
|
||||
}
|
||||
#endif
|
||||
if (e.KeyChar == '\r')
|
||||
{
|
||||
/// Process <enter> key ..... Next text field
|
||||
if (enabledComboBoxes.Count < 2) return; /// There is just one enabled textbox
|
||||
|
||||
for (int i = 0; i < enabledComboBoxes.Count; i++)
|
||||
{
|
||||
if (enabledComboBoxes[i] == currentFocusOwner)
|
||||
{
|
||||
/// Change focus to the next enabled text box
|
||||
enabledComboBoxes[(i + 1) % enabledComboBoxes.Count].Focus();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void main1ComboBox_KeyPress(object sender, KeyPressEventArgs e) { ProcKeyPress(sender, e, main1ComboBox); }
|
||||
private void main2ComboBox_KeyPress(object sender, KeyPressEventArgs e) { ProcKeyPress(sender, e, main2ComboBox); }
|
||||
private void main3ComboBox_KeyPress(object sender, KeyPressEventArgs e) { ProcKeyPress(sender, e, main3ComboBox); }
|
||||
private void aux1ComboBox_KeyPress(object sender, KeyPressEventArgs e) { ProcKeyPress(sender, e, aux1ComboBox); }
|
||||
private void aux2ComboBox_KeyPress(object sender, KeyPressEventArgs e) { ProcKeyPress(sender, e, aux2ComboBox); }
|
||||
private void aux3ComboBox_KeyPress(object sender, KeyPressEventArgs e) { ProcKeyPress(sender, e, aux3ComboBox); }
|
||||
}
|
||||
}
|
||||
@@ -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>
|
||||
+443
@@ -0,0 +1,443 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
namespace TBF.Rig.DataEntry.Combined
|
||||
{
|
||||
partial class CycleEndForm
|
||||
{
|
||||
/// <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.mainState1TextBox = new System.Windows.Forms.TextBox();
|
||||
this.mainState1Label = new System.Windows.Forms.Label();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.qFall1Label = new System.Windows.Forms.Label();
|
||||
this.qFall1TextBox = new System.Windows.Forms.TextBox();
|
||||
this.qRise1Label = new System.Windows.Forms.Label();
|
||||
this.qRise1TextBox = new System.Windows.Forms.TextBox();
|
||||
this.auxState1TextBox = new System.Windows.Forms.TextBox();
|
||||
this.auxState1Label = new System.Windows.Forms.Label();
|
||||
this.okButton = new System.Windows.Forms.Button();
|
||||
this.protocolGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.radioButton3 = new System.Windows.Forms.RadioButton();
|
||||
this.radioButton2 = new System.Windows.Forms.RadioButton();
|
||||
this.radioButton1 = new System.Windows.Forms.RadioButton();
|
||||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||
this.qFall2Label = new System.Windows.Forms.Label();
|
||||
this.qFall2TextBox = new System.Windows.Forms.TextBox();
|
||||
this.qRise2Label = new System.Windows.Forms.Label();
|
||||
this.qRise2TextBox = new System.Windows.Forms.TextBox();
|
||||
this.mainState2TextBox = new System.Windows.Forms.TextBox();
|
||||
this.mainState2Label = new System.Windows.Forms.Label();
|
||||
this.auxState2TextBox = new System.Windows.Forms.TextBox();
|
||||
this.auxState2Label = new System.Windows.Forms.Label();
|
||||
this.groupBox3 = new System.Windows.Forms.GroupBox();
|
||||
this.qFall3Label = new System.Windows.Forms.Label();
|
||||
this.qFall3TextBox = new System.Windows.Forms.TextBox();
|
||||
this.qRise3Label = new System.Windows.Forms.Label();
|
||||
this.qRise3TextBox = new System.Windows.Forms.TextBox();
|
||||
this.mainState3TextBox = new System.Windows.Forms.TextBox();
|
||||
this.mainState3Label = new System.Windows.Forms.Label();
|
||||
this.auxState3TextBox = new System.Windows.Forms.TextBox();
|
||||
this.auxState3Label = new System.Windows.Forms.Label();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.protocolGroupBox.SuspendLayout();
|
||||
this.groupBox2.SuspendLayout();
|
||||
this.groupBox3.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// mainState1TextBox
|
||||
//
|
||||
this.mainState1TextBox.Location = new System.Drawing.Point(211, 42);
|
||||
this.mainState1TextBox.Name = "mainState1TextBox";
|
||||
this.mainState1TextBox.Size = new System.Drawing.Size(135, 31);
|
||||
this.mainState1TextBox.TabIndex = 1;
|
||||
//
|
||||
// mainState1Label
|
||||
//
|
||||
this.mainState1Label.AutoSize = true;
|
||||
this.mainState1Label.Location = new System.Drawing.Point(18, 45);
|
||||
this.mainState1Label.Name = "mainState1Label";
|
||||
this.mainState1Label.Size = new System.Drawing.Size(153, 23);
|
||||
this.mainState1Label.TabIndex = 0;
|
||||
this.mainState1Label.Text = "Main WM State";
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
this.groupBox1.Controls.Add(this.qFall1Label);
|
||||
this.groupBox1.Controls.Add(this.qFall1TextBox);
|
||||
this.groupBox1.Controls.Add(this.qRise1Label);
|
||||
this.groupBox1.Controls.Add(this.qRise1TextBox);
|
||||
this.groupBox1.Controls.Add(this.mainState1TextBox);
|
||||
this.groupBox1.Controls.Add(this.mainState1Label);
|
||||
this.groupBox1.Controls.Add(this.auxState1TextBox);
|
||||
this.groupBox1.Controls.Add(this.auxState1Label);
|
||||
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, 23);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Size = new System.Drawing.Size(375, 237);
|
||||
this.groupBox1.TabIndex = 1;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "Water Meter 1";
|
||||
//
|
||||
// qFall1Label
|
||||
//
|
||||
this.qFall1Label.AutoSize = true;
|
||||
this.qFall1Label.Location = new System.Drawing.Point(18, 184);
|
||||
this.qFall1Label.Name = "qFall1Label";
|
||||
this.qFall1Label.Size = new System.Drawing.Size(55, 23);
|
||||
this.qFall1Label.TabIndex = 6;
|
||||
this.qFall1Label.Text = "Qfall";
|
||||
//
|
||||
// qFall1TextBox
|
||||
//
|
||||
this.qFall1TextBox.Location = new System.Drawing.Point(211, 177);
|
||||
this.qFall1TextBox.Name = "qFall1TextBox";
|
||||
this.qFall1TextBox.Size = new System.Drawing.Size(135, 31);
|
||||
this.qFall1TextBox.TabIndex = 7;
|
||||
//
|
||||
// qRise1Label
|
||||
//
|
||||
this.qRise1Label.AutoSize = true;
|
||||
this.qRise1Label.Location = new System.Drawing.Point(18, 135);
|
||||
this.qRise1Label.Name = "qRise1Label";
|
||||
this.qRise1Label.Size = new System.Drawing.Size(60, 23);
|
||||
this.qRise1Label.TabIndex = 4;
|
||||
this.qRise1Label.Text = "Qrise";
|
||||
//
|
||||
// qRise1TextBox
|
||||
//
|
||||
this.qRise1TextBox.Location = new System.Drawing.Point(211, 132);
|
||||
this.qRise1TextBox.Name = "qRise1TextBox";
|
||||
this.qRise1TextBox.Size = new System.Drawing.Size(135, 31);
|
||||
this.qRise1TextBox.TabIndex = 5;
|
||||
//
|
||||
// auxState1TextBox
|
||||
//
|
||||
this.auxState1TextBox.Location = new System.Drawing.Point(211, 87);
|
||||
this.auxState1TextBox.Name = "auxState1TextBox";
|
||||
this.auxState1TextBox.Size = new System.Drawing.Size(135, 31);
|
||||
this.auxState1TextBox.TabIndex = 3;
|
||||
//
|
||||
// auxState1Label
|
||||
//
|
||||
this.auxState1Label.AutoSize = true;
|
||||
this.auxState1Label.Location = new System.Drawing.Point(18, 90);
|
||||
this.auxState1Label.Name = "auxState1Label";
|
||||
this.auxState1Label.Size = new System.Drawing.Size(151, 23);
|
||||
this.auxState1Label.TabIndex = 2;
|
||||
this.auxState1Label.Text = "Aux. WM State";
|
||||
//
|
||||
// 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(699, 33);
|
||||
this.okButton.Name = "okButton";
|
||||
this.okButton.Size = new System.Drawing.Size(98, 63);
|
||||
this.okButton.TabIndex = 0;
|
||||
this.okButton.Text = "OK";
|
||||
this.okButton.UseVisualStyleBackColor = true;
|
||||
this.okButton.Click += new System.EventHandler(this.okButton_Click);
|
||||
//
|
||||
// protocolGroupBox
|
||||
//
|
||||
this.protocolGroupBox.Controls.Add(this.radioButton3);
|
||||
this.protocolGroupBox.Controls.Add(this.radioButton2);
|
||||
this.protocolGroupBox.Controls.Add(this.radioButton1);
|
||||
this.protocolGroupBox.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.protocolGroupBox.Location = new System.Drawing.Point(422, 118);
|
||||
this.protocolGroupBox.Name = "protocolGroupBox";
|
||||
this.protocolGroupBox.Size = new System.Drawing.Size(375, 142);
|
||||
this.protocolGroupBox.TabIndex = 4;
|
||||
this.protocolGroupBox.TabStop = false;
|
||||
this.protocolGroupBox.Text = "Protocol";
|
||||
//
|
||||
// radioButton3
|
||||
//
|
||||
this.radioButton3.AutoSize = true;
|
||||
this.radioButton3.Location = new System.Drawing.Point(34, 100);
|
||||
this.radioButton3.Name = "radioButton3";
|
||||
this.radioButton3.Size = new System.Drawing.Size(152, 27);
|
||||
this.radioButton3.TabIndex = 2;
|
||||
this.radioButton3.Text = "radioButton3";
|
||||
this.radioButton3.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// radioButton2
|
||||
//
|
||||
this.radioButton2.AutoSize = true;
|
||||
this.radioButton2.Location = new System.Drawing.Point(34, 67);
|
||||
this.radioButton2.Name = "radioButton2";
|
||||
this.radioButton2.Size = new System.Drawing.Size(152, 27);
|
||||
this.radioButton2.TabIndex = 1;
|
||||
this.radioButton2.Text = "radioButton2";
|
||||
this.radioButton2.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// radioButton1
|
||||
//
|
||||
this.radioButton1.AutoSize = true;
|
||||
this.radioButton1.Checked = true;
|
||||
this.radioButton1.Location = new System.Drawing.Point(34, 34);
|
||||
this.radioButton1.Name = "radioButton1";
|
||||
this.radioButton1.Size = new System.Drawing.Size(152, 27);
|
||||
this.radioButton1.TabIndex = 0;
|
||||
this.radioButton1.TabStop = true;
|
||||
this.radioButton1.Text = "radioButton1";
|
||||
this.radioButton1.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// groupBox2
|
||||
//
|
||||
this.groupBox2.Controls.Add(this.qFall2Label);
|
||||
this.groupBox2.Controls.Add(this.qFall2TextBox);
|
||||
this.groupBox2.Controls.Add(this.qRise2Label);
|
||||
this.groupBox2.Controls.Add(this.qRise2TextBox);
|
||||
this.groupBox2.Controls.Add(this.mainState2TextBox);
|
||||
this.groupBox2.Controls.Add(this.mainState2Label);
|
||||
this.groupBox2.Controls.Add(this.auxState2TextBox);
|
||||
this.groupBox2.Controls.Add(this.auxState2Label);
|
||||
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, 282);
|
||||
this.groupBox2.Name = "groupBox2";
|
||||
this.groupBox2.Size = new System.Drawing.Size(375, 237);
|
||||
this.groupBox2.TabIndex = 2;
|
||||
this.groupBox2.TabStop = false;
|
||||
this.groupBox2.Text = "Water Meter 2";
|
||||
//
|
||||
// qFall2Label
|
||||
//
|
||||
this.qFall2Label.AutoSize = true;
|
||||
this.qFall2Label.Location = new System.Drawing.Point(18, 184);
|
||||
this.qFall2Label.Name = "qFall2Label";
|
||||
this.qFall2Label.Size = new System.Drawing.Size(55, 23);
|
||||
this.qFall2Label.TabIndex = 6;
|
||||
this.qFall2Label.Text = "Qfall";
|
||||
//
|
||||
// qFall2TextBox
|
||||
//
|
||||
this.qFall2TextBox.Location = new System.Drawing.Point(211, 177);
|
||||
this.qFall2TextBox.Name = "qFall2TextBox";
|
||||
this.qFall2TextBox.Size = new System.Drawing.Size(135, 31);
|
||||
this.qFall2TextBox.TabIndex = 7;
|
||||
//
|
||||
// qRise2Label
|
||||
//
|
||||
this.qRise2Label.AutoSize = true;
|
||||
this.qRise2Label.Location = new System.Drawing.Point(18, 135);
|
||||
this.qRise2Label.Name = "qRise2Label";
|
||||
this.qRise2Label.Size = new System.Drawing.Size(60, 23);
|
||||
this.qRise2Label.TabIndex = 4;
|
||||
this.qRise2Label.Text = "Qrise";
|
||||
//
|
||||
// qRise2TextBox
|
||||
//
|
||||
this.qRise2TextBox.Location = new System.Drawing.Point(211, 132);
|
||||
this.qRise2TextBox.Name = "qRise2TextBox";
|
||||
this.qRise2TextBox.Size = new System.Drawing.Size(135, 31);
|
||||
this.qRise2TextBox.TabIndex = 5;
|
||||
//
|
||||
// mainState2TextBox
|
||||
//
|
||||
this.mainState2TextBox.Location = new System.Drawing.Point(211, 42);
|
||||
this.mainState2TextBox.Name = "mainState2TextBox";
|
||||
this.mainState2TextBox.Size = new System.Drawing.Size(135, 31);
|
||||
this.mainState2TextBox.TabIndex = 1;
|
||||
//
|
||||
// mainState2Label
|
||||
//
|
||||
this.mainState2Label.AutoSize = true;
|
||||
this.mainState2Label.Location = new System.Drawing.Point(17, 45);
|
||||
this.mainState2Label.Name = "mainState2Label";
|
||||
this.mainState2Label.Size = new System.Drawing.Size(153, 23);
|
||||
this.mainState2Label.TabIndex = 0;
|
||||
this.mainState2Label.Text = "Main WM State";
|
||||
//
|
||||
// auxState2TextBox
|
||||
//
|
||||
this.auxState2TextBox.Location = new System.Drawing.Point(211, 87);
|
||||
this.auxState2TextBox.Name = "auxState2TextBox";
|
||||
this.auxState2TextBox.Size = new System.Drawing.Size(135, 31);
|
||||
this.auxState2TextBox.TabIndex = 3;
|
||||
//
|
||||
// auxState2Label
|
||||
//
|
||||
this.auxState2Label.AutoSize = true;
|
||||
this.auxState2Label.Location = new System.Drawing.Point(18, 90);
|
||||
this.auxState2Label.Name = "auxState2Label";
|
||||
this.auxState2Label.Size = new System.Drawing.Size(151, 23);
|
||||
this.auxState2Label.TabIndex = 2;
|
||||
this.auxState2Label.Text = "Aux. WM State";
|
||||
//
|
||||
// groupBox3
|
||||
//
|
||||
this.groupBox3.Controls.Add(this.qFall3Label);
|
||||
this.groupBox3.Controls.Add(this.qFall3TextBox);
|
||||
this.groupBox3.Controls.Add(this.qRise3Label);
|
||||
this.groupBox3.Controls.Add(this.qRise3TextBox);
|
||||
this.groupBox3.Controls.Add(this.mainState3TextBox);
|
||||
this.groupBox3.Controls.Add(this.mainState3Label);
|
||||
this.groupBox3.Controls.Add(this.auxState3TextBox);
|
||||
this.groupBox3.Controls.Add(this.auxState3Label);
|
||||
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(422, 282);
|
||||
this.groupBox3.Name = "groupBox3";
|
||||
this.groupBox3.Size = new System.Drawing.Size(375, 237);
|
||||
this.groupBox3.TabIndex = 3;
|
||||
this.groupBox3.TabStop = false;
|
||||
this.groupBox3.Text = "Water Meter 3";
|
||||
//
|
||||
// qFall3Label
|
||||
//
|
||||
this.qFall3Label.AutoSize = true;
|
||||
this.qFall3Label.Location = new System.Drawing.Point(18, 184);
|
||||
this.qFall3Label.Name = "qFall3Label";
|
||||
this.qFall3Label.Size = new System.Drawing.Size(55, 23);
|
||||
this.qFall3Label.TabIndex = 6;
|
||||
this.qFall3Label.Text = "Qfall";
|
||||
//
|
||||
// qFall3TextBox
|
||||
//
|
||||
this.qFall3TextBox.Location = new System.Drawing.Point(211, 177);
|
||||
this.qFall3TextBox.Name = "qFall3TextBox";
|
||||
this.qFall3TextBox.Size = new System.Drawing.Size(135, 31);
|
||||
this.qFall3TextBox.TabIndex = 7;
|
||||
//
|
||||
// qRise3Label
|
||||
//
|
||||
this.qRise3Label.AutoSize = true;
|
||||
this.qRise3Label.Location = new System.Drawing.Point(18, 135);
|
||||
this.qRise3Label.Name = "qRise3Label";
|
||||
this.qRise3Label.Size = new System.Drawing.Size(60, 23);
|
||||
this.qRise3Label.TabIndex = 4;
|
||||
this.qRise3Label.Text = "Qrise";
|
||||
//
|
||||
// qRise3TextBox
|
||||
//
|
||||
this.qRise3TextBox.Location = new System.Drawing.Point(211, 132);
|
||||
this.qRise3TextBox.Name = "qRise3TextBox";
|
||||
this.qRise3TextBox.Size = new System.Drawing.Size(135, 31);
|
||||
this.qRise3TextBox.TabIndex = 5;
|
||||
//
|
||||
// mainState3TextBox
|
||||
//
|
||||
this.mainState3TextBox.Location = new System.Drawing.Point(211, 42);
|
||||
this.mainState3TextBox.Name = "mainState3TextBox";
|
||||
this.mainState3TextBox.Size = new System.Drawing.Size(135, 31);
|
||||
this.mainState3TextBox.TabIndex = 1;
|
||||
//
|
||||
// mainState3Label
|
||||
//
|
||||
this.mainState3Label.AutoSize = true;
|
||||
this.mainState3Label.Location = new System.Drawing.Point(18, 45);
|
||||
this.mainState3Label.Name = "mainState3Label";
|
||||
this.mainState3Label.Size = new System.Drawing.Size(153, 23);
|
||||
this.mainState3Label.TabIndex = 0;
|
||||
this.mainState3Label.Text = "Main WM State";
|
||||
//
|
||||
// auxState3TextBox
|
||||
//
|
||||
this.auxState3TextBox.Location = new System.Drawing.Point(211, 87);
|
||||
this.auxState3TextBox.Name = "auxState3TextBox";
|
||||
this.auxState3TextBox.Size = new System.Drawing.Size(135, 31);
|
||||
this.auxState3TextBox.TabIndex = 3;
|
||||
//
|
||||
// auxState3Label
|
||||
//
|
||||
this.auxState3Label.AutoSize = true;
|
||||
this.auxState3Label.Location = new System.Drawing.Point(18, 90);
|
||||
this.auxState3Label.Name = "auxState3Label";
|
||||
this.auxState3Label.Size = new System.Drawing.Size(151, 23);
|
||||
this.auxState3Label.TabIndex = 2;
|
||||
this.auxState3Label.Text = "Aux. WM State";
|
||||
//
|
||||
// CycleEndForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.DarkGray;
|
||||
this.ClientSize = new System.Drawing.Size(822, 542);
|
||||
this.Controls.Add(this.groupBox3);
|
||||
this.Controls.Add(this.groupBox2);
|
||||
this.Controls.Add(this.protocolGroupBox);
|
||||
this.Controls.Add(this.okButton);
|
||||
this.Controls.Add(this.groupBox1);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
|
||||
this.Name = "CycleEndForm";
|
||||
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
|
||||
this.Text = "Daten";
|
||||
this.TopMost = true;
|
||||
this.Load += new System.EventHandler(this.CycleEndForm_Load);
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
this.groupBox1.PerformLayout();
|
||||
this.protocolGroupBox.ResumeLayout(false);
|
||||
this.protocolGroupBox.PerformLayout();
|
||||
this.groupBox2.ResumeLayout(false);
|
||||
this.groupBox2.PerformLayout();
|
||||
this.groupBox3.ResumeLayout(false);
|
||||
this.groupBox3.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TextBox mainState1TextBox;
|
||||
private System.Windows.Forms.Label mainState1Label;
|
||||
private System.Windows.Forms.GroupBox groupBox1;
|
||||
private System.Windows.Forms.TextBox auxState1TextBox;
|
||||
private System.Windows.Forms.Label auxState1Label;
|
||||
private System.Windows.Forms.Button okButton;
|
||||
private System.Windows.Forms.GroupBox protocolGroupBox;
|
||||
private System.Windows.Forms.RadioButton radioButton3;
|
||||
private System.Windows.Forms.RadioButton radioButton2;
|
||||
private System.Windows.Forms.RadioButton radioButton1;
|
||||
private System.Windows.Forms.Label qFall1Label;
|
||||
private System.Windows.Forms.TextBox qFall1TextBox;
|
||||
private System.Windows.Forms.Label qRise1Label;
|
||||
private System.Windows.Forms.TextBox qRise1TextBox;
|
||||
private System.Windows.Forms.GroupBox groupBox2;
|
||||
private System.Windows.Forms.Label qFall2Label;
|
||||
private System.Windows.Forms.TextBox qFall2TextBox;
|
||||
private System.Windows.Forms.Label qRise2Label;
|
||||
private System.Windows.Forms.TextBox qRise2TextBox;
|
||||
private System.Windows.Forms.TextBox mainState2TextBox;
|
||||
private System.Windows.Forms.Label mainState2Label;
|
||||
private System.Windows.Forms.TextBox auxState2TextBox;
|
||||
private System.Windows.Forms.Label auxState2Label;
|
||||
private System.Windows.Forms.GroupBox groupBox3;
|
||||
private System.Windows.Forms.Label qFall3Label;
|
||||
private System.Windows.Forms.TextBox qFall3TextBox;
|
||||
private System.Windows.Forms.Label qRise3Label;
|
||||
private System.Windows.Forms.TextBox qRise3TextBox;
|
||||
private System.Windows.Forms.TextBox mainState3TextBox;
|
||||
private System.Windows.Forms.Label mainState3Label;
|
||||
private System.Windows.Forms.TextBox auxState3TextBox;
|
||||
private System.Windows.Forms.Label auxState3Label;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using log4net;
|
||||
using TBF.Resources;
|
||||
|
||||
#pragma warning disable 162 /// Disables 'Unreachable code detected' warning
|
||||
|
||||
namespace TBF.Rig.DataEntry.Combined
|
||||
{
|
||||
public partial class CycleEndForm : Form, GenericDevices.IHasCompleted
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(CycleEndForm));
|
||||
|
||||
// To be set before the form opens
|
||||
public string ProtocolName1;
|
||||
public string ProtocolName2;
|
||||
public string ProtocolName3;
|
||||
|
||||
// To be retrieved after the form closes
|
||||
public string[] MainStateText;
|
||||
public string[] AuxStateText;
|
||||
public float[] QRise;
|
||||
public float[] QFall;
|
||||
public string ProtocolTitle;
|
||||
|
||||
// Set to 'true' when the form closes
|
||||
public bool Completed { get { return completed; } }
|
||||
bool completed;
|
||||
|
||||
public CycleEndForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
ControlBox = false;
|
||||
|
||||
MainStateText = new string[TBF.Data.CompoundWMsCount];
|
||||
AuxStateText = new string[TBF.Data.CompoundWMsCount];
|
||||
QRise = new float[TBF.Data.CompoundWMsCount];
|
||||
QFall = new float[TBF.Data.CompoundWMsCount];
|
||||
completed = false;
|
||||
StartForceCloseHandler();
|
||||
|
||||
Localize();
|
||||
}
|
||||
|
||||
void Localize()
|
||||
{
|
||||
Text = Strings.Data;
|
||||
protocolGroupBox.Text = Strings.Protocol;
|
||||
groupBox1.Text = Strings.Water_Meter + " 1";
|
||||
mainState1Label.Text = Strings.Main_Water_Meter_State;
|
||||
auxState1Label.Text = Strings.Aux_Water_Meter_State;
|
||||
qRise1Label.Text = Strings.Qrise;
|
||||
qFall1Label.Text = Strings.Qfall;
|
||||
|
||||
groupBox2.Text = Strings.Water_Meter + " 2";
|
||||
mainState2Label.Text = Strings.Main_Water_Meter_State;
|
||||
auxState2Label.Text = Strings.Aux_Water_Meter_State;
|
||||
qRise2Label.Text = Strings.Qrise;
|
||||
qFall2Label.Text = Strings.Qfall;
|
||||
|
||||
groupBox3.Text = Strings.Water_Meter + " 3";
|
||||
mainState3Label.Text = Strings.Main_Water_Meter_State;
|
||||
auxState3Label.Text = Strings.Aux_Water_Meter_State;
|
||||
qRise3Label.Text = Strings.Qrise;
|
||||
qFall3Label.Text = Strings.Qfall;
|
||||
}
|
||||
|
||||
private void CycleEndForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
radioButton1.Text = ProtocolName1;
|
||||
radioButton2.Text = ProtocolName2;
|
||||
radioButton3.Text = ProtocolName3;
|
||||
|
||||
qRise1TextBox.Text = Utils.DoubleToStr(Sequences.SequenceBase.Qrise, 3);
|
||||
qFall1TextBox.Text = Utils.DoubleToStr(Sequences.SequenceBase.Qfall, 3);
|
||||
|
||||
if (TBF.Data.CompoundWMsCount >= 2)
|
||||
{
|
||||
qRise2TextBox.Text = Utils.DoubleToStr(Sequences.SequenceBase.Qrise, 3);
|
||||
qFall2TextBox.Text = Utils.DoubleToStr(Sequences.SequenceBase.Qfall, 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
groupBox2.Visible = false;
|
||||
Height = 305;
|
||||
}
|
||||
|
||||
if (TBF.Data.CompoundWMsCount >= 3)
|
||||
{
|
||||
qRise3TextBox.Text = Utils.DoubleToStr(Sequences.SequenceBase.Qrise, 3);
|
||||
qFall3TextBox.Text = Utils.DoubleToStr(Sequences.SequenceBase.Qfall, 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
groupBox3.Visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void okButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
float ftmp;
|
||||
bool allOK = true;
|
||||
|
||||
MainStateText[0] = mainState1TextBox.Text;
|
||||
AuxStateText[0] = auxState1TextBox.Text;
|
||||
if (Utils.TryParseUFloat(qRise1TextBox.Text, out ftmp)) { QRise[0] = ftmp; } else { allOK = false; }
|
||||
if (Utils.TryParseUFloat(qFall1TextBox.Text, out ftmp)) { QFall[0] = ftmp; } else { allOK = false; }
|
||||
|
||||
if (TBF.Data.CompoundWMsCount >= 2)
|
||||
{
|
||||
MainStateText[1] = mainState2TextBox.Text;
|
||||
AuxStateText[1] = auxState2TextBox.Text;
|
||||
if (Utils.TryParseUFloat(qRise2TextBox.Text, out ftmp)) { QRise[1] = ftmp; } else { allOK = false; }
|
||||
if (Utils.TryParseUFloat(qFall2TextBox.Text, out ftmp)) { QFall[1] = ftmp; } else { allOK = false; }
|
||||
}
|
||||
|
||||
if (TBF.Data.CompoundWMsCount >= 3)
|
||||
{
|
||||
MainStateText[2] = mainState3TextBox.Text;
|
||||
AuxStateText[2] = auxState3TextBox.Text;
|
||||
if (Utils.TryParseUFloat(qRise3TextBox.Text, out ftmp)) { QRise[2] = ftmp; } else { allOK = false; }
|
||||
if (Utils.TryParseUFloat(qFall3TextBox.Text, out ftmp)) { QFall[2] = ftmp; } else { allOK = false; }
|
||||
}
|
||||
|
||||
if (radioButton1.Checked) ProtocolTitle = ProtocolName1;
|
||||
else if (radioButton2.Checked) ProtocolTitle = ProtocolName2;
|
||||
else if (radioButton3.Checked) ProtocolTitle = ProtocolName3;
|
||||
|
||||
if (allOK)
|
||||
{
|
||||
completed = true;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
|
||||
#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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,219 @@
|
||||
<?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>
|
||||
<metadata name="mainState1TextBox.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="mainState1Label.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="groupBox1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="qFall1Label.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="qFall1TextBox.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="qRise1Label.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="qRise1TextBox.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="auxState1TextBox.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="auxState1Label.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="okButton.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="protocolGroupBox.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="radioButton3.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="radioButton2.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="radioButton1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="groupBox2.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="qFall2Label.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="qFall2TextBox.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="qRise2Label.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="qRise2TextBox.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="mainState2TextBox.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="mainState2Label.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="auxState2TextBox.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="auxState2Label.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="groupBox3.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="qFall3Label.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="qFall3TextBox.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="qRise3Label.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="qRise3TextBox.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="mainState3TextBox.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="mainState3Label.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="auxState3TextBox.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="auxState3Label.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
</root>
|
||||
@@ -0,0 +1,267 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using Config.Entities;
|
||||
using TBF.Rig;
|
||||
using TBF.Rig.GenericDevices;
|
||||
|
||||
namespace TBF.Rig.DataEntry.Combined
|
||||
{
|
||||
public class EntryForm : ComponentBase, IOperation, IDataEntry, IHasCycleBeginForm, IHasCycleEndForm, IHasWMStatesForm
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(EntryForm));
|
||||
public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
|
||||
|
||||
public bool UsesCameras() { return false; }
|
||||
|
||||
readonly EntryFormCfg entryFormCfg;
|
||||
IRegReader[] regReaders;
|
||||
|
||||
/// <summary>
|
||||
/// Properties set by the Begin and the End form
|
||||
/// </summary>
|
||||
bool[] disabled; /// This array is shared between forms
|
||||
|
||||
string[] wmCycleEndState;
|
||||
public string WMCycleEndState(int wmNr) { return (wmNr >= 0 && wmNr < wmCycleEndState.Length) ? wmCycleEndState[wmNr] : string.Empty; }
|
||||
|
||||
double[] wmStartState;
|
||||
public double WMStartState(int wmNr) { return (wmNr >= 0 && wmNr < wmStartState.Length) ? wmStartState[wmNr] : 0; }
|
||||
|
||||
double[] wmEndState;
|
||||
public double WMEndState(int wmNr) { return (wmNr >= 0 && wmNr < wmEndState.Length) ? wmEndState[wmNr] : 0; }
|
||||
|
||||
string[] wmStartStateStr;
|
||||
|
||||
|
||||
System.Windows.Forms.Form modelessDlg;
|
||||
public bool Completed { get { return (modelessDlg is IHasCompleted) ? (modelessDlg as IHasCompleted).Completed : true; } }
|
||||
|
||||
double refVolume;
|
||||
double errLimLo;
|
||||
double errLimHi;
|
||||
|
||||
bool resultSaved; /// Set in Run() when results are saved
|
||||
|
||||
IList<Results.Entities.WaterMeter> waterMeters; /// Reference to ...ProcessData.BatchRslts.WaterMeters[]
|
||||
|
||||
public enum CurrentOp
|
||||
{
|
||||
None,
|
||||
ShowFormAtCycleBeginning,
|
||||
ShowFormAtCycleEnd,
|
||||
EnterTestStartStates,
|
||||
EnterTestEndStates,
|
||||
}
|
||||
|
||||
CurrentOp currentOp;
|
||||
|
||||
|
||||
public EntryForm() { }
|
||||
|
||||
public EntryForm(Generic.IComponentCfg cfg)
|
||||
: base(cfg)
|
||||
{
|
||||
entryFormCfg = cfg as EntryFormCfg;
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
disabled = new bool[TBF.Data.CompoundWMsCount];
|
||||
wmStartState = new double[TBF.Data.CompoundWMsCount * 2];
|
||||
wmStartStateStr = new string[TBF.Data.CompoundWMsCount * 2];
|
||||
wmEndState = new double[TBF.Data.CompoundWMsCount * 2];
|
||||
wmCycleEndState = new string[TBF.Data.CompoundWMsCount * 2];
|
||||
currentOp = CurrentOp.None;
|
||||
log.FatalFormat("{0} initialized: {1}", Name, this);
|
||||
}
|
||||
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowCycleBeginFormOp()
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
currentOp = CurrentOp.ShowFormAtCycleBeginning;
|
||||
this.waterMeters = TBF.Rig.Sequences.ProcessData.BatchRslts.Batch.WaterMeters;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowCycleEndFormOp()
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
currentOp = CurrentOp.ShowFormAtCycleEnd;
|
||||
this.waterMeters = TBF.Rig.Sequences.ProcessData.BatchRslts.Batch.WaterMeters;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowTestStartFormOp(IRegReader[] regReaders)
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
currentOp = CurrentOp.EnterTestStartStates;
|
||||
this.regReaders = regReaders;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowTestEndFormOp(IRegReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
currentOp = CurrentOp.EnterTestEndStates;
|
||||
this.regReaders = regReaders;
|
||||
this.refVolume = refVolume;
|
||||
this.errLimLo = errLimLo;
|
||||
this.errLimHi = errLimHi;
|
||||
return this;
|
||||
}
|
||||
|
||||
delegate void EntryFormDlgt(EntryForm myRef);
|
||||
///
|
||||
void OpenBeginningDlg(EntryForm myRef)
|
||||
{
|
||||
myRef.modelessDlg = new CycleBeginningForm(TBF.Data.CompoundWMsCount, myRef.entryFormCfg.RemarkEnabled);
|
||||
modelessDlg.Show();
|
||||
}
|
||||
///
|
||||
void OpenEndDlg(EntryForm myRef)
|
||||
{
|
||||
CycleEndForm endForm = new CycleEndForm();
|
||||
myRef.modelessDlg = endForm;
|
||||
modelessDlg.Show();
|
||||
}
|
||||
///
|
||||
void OpenTestStartStatesDlg(EntryForm myRef)
|
||||
{
|
||||
myRef.modelessDlg = new TestStartEndForm(TBF.Data.CompoundWMsCount, myRef.regReaders, myRef.disabled);
|
||||
modelessDlg.Show();
|
||||
}
|
||||
///
|
||||
void OpenTestEndStatesDlg(EntryForm myRef)
|
||||
{
|
||||
string[] mainStartStateStr = new string[TBF.Data.CompoundWMsCount];
|
||||
string[] auxStartStateStr = new string[TBF.Data.CompoundWMsCount];
|
||||
for (int i = 0; i < TBF.Data.CompoundWMsCount; i++)
|
||||
{
|
||||
mainStartStateStr[i] = wmStartStateStr[2 * i];
|
||||
auxStartStateStr[i] = wmStartStateStr[2 * i + 1];
|
||||
}
|
||||
myRef.modelessDlg = new TestStartEndForm(TBF.Data.CompoundWMsCount, myRef.regReaders, mainStartStateStr, auxStartStateStr, disabled, refVolume, errLimLo, errLimHi);
|
||||
modelessDlg.Show();
|
||||
}
|
||||
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
resultSaved = false;
|
||||
switch (currentOp)
|
||||
{
|
||||
case CurrentOp.ShowFormAtCycleBeginning:
|
||||
Program.MainWnd.Invoke(new EntryFormDlgt(OpenBeginningDlg), this);
|
||||
break;
|
||||
case CurrentOp.ShowFormAtCycleEnd:
|
||||
if (entryFormCfg.ShowCycleEndForm)
|
||||
{
|
||||
Program.MainWnd.Invoke(new EntryFormDlgt(OpenEndDlg), this);
|
||||
}
|
||||
break;
|
||||
case CurrentOp.EnterTestStartStates:
|
||||
Program.MainWnd.Invoke(new EntryFormDlgt(OpenTestStartStatesDlg), this);
|
||||
break;
|
||||
case CurrentOp.EnterTestEndStates:
|
||||
Program.MainWnd.Invoke(new EntryFormDlgt(OpenTestEndStatesDlg), this);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
/// <returns>Event.ResultsPrinted</returns>
|
||||
public Event Run()
|
||||
{
|
||||
if ((modelessDlg is IHasCompleted) && !(modelessDlg as IHasCompleted).Completed)
|
||||
{
|
||||
return Event.ModelessFormIsOpen;
|
||||
}
|
||||
|
||||
if (!resultSaved) /// This is to save the result only once
|
||||
{
|
||||
if (currentOp == CurrentOp.ShowFormAtCycleBeginning)
|
||||
{
|
||||
CycleBeginningForm dlg = (modelessDlg as CycleBeginningForm);
|
||||
|
||||
if (dlg != null)
|
||||
{
|
||||
for (int i = 0; i < Math.Min(dlg.WaterMetersCount, waterMeters.Count); i++)
|
||||
{
|
||||
if (waterMeters[i] != null)
|
||||
{
|
||||
waterMeters[i].Disabled = disabled[i] = dlg.Disabled[i];
|
||||
waterMeters[i].SerialNr = dlg.MainSNText[i];
|
||||
waterMeters[i].SerialNrAux = dlg.AuxSNText[i];
|
||||
if (dlg.RemarksEnabled) waterMeters[i].Remark = dlg.Remark[i];
|
||||
if (dlg.PurchaseOrder != null) waterMeters[i].PurchaseOrder = dlg.PurchaseOrder;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (currentOp == CurrentOp.ShowFormAtCycleEnd)
|
||||
{
|
||||
//CycleEndForm dlg = (modelessDlg as CycleEndForm);
|
||||
//int count = waterMeters.Count;
|
||||
//if ((dlg != null) && (count > dlg.WaterMetersCount)) count = dlg.WaterMetersCount;
|
||||
|
||||
//for (int i = 0; i < count; i++)
|
||||
//{
|
||||
// if (waterMeters[i] != null)
|
||||
// {
|
||||
// /// In case entryFormCfg.ShowCycleEndForm == false dlg would be null, values would be string.Empty
|
||||
// wmCycleEndState[i] = waterMeters[i].EndState = (dlg != null) ? dlg.EndStateText[i] : string.Empty;
|
||||
// }
|
||||
//}
|
||||
}
|
||||
else if (modelessDlg is TestStartEndForm && currentOp == CurrentOp.EnterTestStartStates)
|
||||
{
|
||||
/// Fixed start test - start
|
||||
TestStartEndForm dlg = (modelessDlg as TestStartEndForm);
|
||||
|
||||
for (int i = 0; i < dlg.WaterMetersCount; i++)
|
||||
{
|
||||
wmStartState[2 * i] = dlg.MainStartState[i];
|
||||
wmStartStateStr[2 * i] = dlg.MainStartStateStr[i];
|
||||
wmStartState[2 * i + 1] = dlg.AuxStartState[i];
|
||||
wmStartStateStr[2 * i + 1] = dlg.AuxStartStateStr[i];
|
||||
}
|
||||
}
|
||||
else if (modelessDlg is TestStartEndForm && currentOp == CurrentOp.EnterTestEndStates)
|
||||
{
|
||||
/// Fixed start test - end
|
||||
TestStartEndForm dlg = (modelessDlg as TestStartEndForm);
|
||||
|
||||
for (int i = 0; i < dlg.WaterMetersCount; i++)
|
||||
{
|
||||
wmEndState[2 * i] = dlg.MainEndState[i];
|
||||
wmEndState[2 * i + 1] = dlg.AuxEndState[i];
|
||||
}
|
||||
}
|
||||
resultSaved = true;
|
||||
modelessDlg = null;
|
||||
}
|
||||
|
||||
return Event.ModelessFormClosed; /// Form closed
|
||||
}
|
||||
|
||||
/// <summary>Stop this operation</summary>
|
||||
public void Stop()
|
||||
{
|
||||
if (modelessDlg is IHasCompleted)
|
||||
{
|
||||
UiBridge.Bridge.OnCloseModelessForm(this, null);
|
||||
modelessDlg = null;
|
||||
}
|
||||
currentOp = CurrentOp.None;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2016 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Xml.Serialization;
|
||||
using TBF.Rig.Generic;
|
||||
|
||||
namespace TBF.Rig.DataEntry.Combined
|
||||
{
|
||||
public class EntryFormCfg : ComponentCfgBase, Generic.IComponentCfg
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(EntryFormCfg) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
public IComponentCfgCtrl GetControl(IList<Config.Entities.Component> cmpntEntities) { return new EntryFormCfgCtrl(); }
|
||||
|
||||
///
|
||||
/// Serialized parameters
|
||||
///
|
||||
public bool ShowCycleEndForm;
|
||||
public bool RemarkEnabled;
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
EntryFormCfg()
|
||||
{
|
||||
Name = "DataEntry-Combined";
|
||||
ParentName = string.Empty;
|
||||
ShowCycleEndForm = false;
|
||||
RemarkEnabled = false;
|
||||
}
|
||||
|
||||
public EntryFormCfg(IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
this.Factory = factory;
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("Name={0}, ShowEndForm={1}, Remark={2}", Name, ShowCycleEndForm, RemarkEnabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
using TBF.Rig.Generic;
|
||||
using TBF.Resources;
|
||||
|
||||
namespace TBF.Rig.DataEntry.Combined
|
||||
{
|
||||
public partial class EntryFormCfgCtrl : UserControl, IComponentCfgCtrl
|
||||
{
|
||||
public bool ShowMore { get { return false; } }
|
||||
|
||||
EntryFormCfg config;
|
||||
public IComponentCfg Config
|
||||
{
|
||||
get { return config as IComponentCfg; }
|
||||
set
|
||||
{
|
||||
config = value as EntryFormCfg;
|
||||
Redraw();
|
||||
}
|
||||
}
|
||||
|
||||
public EntryFormCfgCtrl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void EntryFormCfgCtrl_Load(object sender, EventArgs e)
|
||||
{
|
||||
Localize();
|
||||
Redraw();
|
||||
}
|
||||
|
||||
void Localize()
|
||||
{
|
||||
showCycleEndFormCheckBox.Text = Strings.Show_cycle_end_form;
|
||||
remarkEnabledCheckBox.Text = Strings.Enable_Remark;
|
||||
}
|
||||
|
||||
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;
|
||||
showCycleEndFormCheckBox.Checked = config.ShowCycleEndForm;
|
||||
remarkEnabledCheckBox.Checked = config.RemarkEnabled;
|
||||
}
|
||||
|
||||
public void Unlock()
|
||||
{
|
||||
nameTextBox.Enabled = true;
|
||||
showCycleEndFormCheckBox.Enabled = true;
|
||||
remarkEnabledCheckBox.Enabled = true;
|
||||
}
|
||||
|
||||
public CfgUpdateFlags VerifyCfg(ref string message)
|
||||
{
|
||||
CfgUpdateFlags flags = CfgUpdateFlags.None;
|
||||
return flags;
|
||||
}
|
||||
|
||||
public CfgUpdateFlags UpdateCfg()
|
||||
{
|
||||
CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd;
|
||||
|
||||
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
|
||||
|
||||
config.Name = nameTextBox.Text;
|
||||
config.ShowCycleEndForm = showCycleEndFormCheckBox.Checked;
|
||||
config.RemarkEnabled = remarkEnabledCheckBox.Checked;
|
||||
|
||||
return flags;
|
||||
}
|
||||
}
|
||||
}
|
||||
+114
@@ -0,0 +1,114 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
namespace TBF.Rig.DataEntry.Combined
|
||||
{
|
||||
partial class EntryFormCfgCtrl
|
||||
{
|
||||
/// <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 Component 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.nameTextBox = new System.Windows.Forms.TextBox();
|
||||
this.nameLabel = new System.Windows.Forms.Label();
|
||||
this.classNameLabel = new System.Windows.Forms.Label();
|
||||
this.showCycleEndFormCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.remarkEnabledCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// nameTextBox
|
||||
//
|
||||
this.nameTextBox.Enabled = false;
|
||||
this.nameTextBox.Location = new System.Drawing.Point(114, 57);
|
||||
this.nameTextBox.Name = "nameTextBox";
|
||||
this.nameTextBox.Size = new System.Drawing.Size(130, 20);
|
||||
this.nameTextBox.TabIndex = 5;
|
||||
//
|
||||
// nameLabel
|
||||
//
|
||||
this.nameLabel.AutoSize = true;
|
||||
this.nameLabel.Location = new System.Drawing.Point(39, 60);
|
||||
this.nameLabel.Name = "nameLabel";
|
||||
this.nameLabel.Size = new System.Drawing.Size(35, 13);
|
||||
this.nameLabel.TabIndex = 4;
|
||||
this.nameLabel.Text = "Name";
|
||||
//
|
||||
// classNameLabel
|
||||
//
|
||||
this.classNameLabel.AutoSize = true;
|
||||
this.classNameLabel.Location = new System.Drawing.Point(111, 33);
|
||||
this.classNameLabel.Name = "classNameLabel";
|
||||
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
|
||||
this.classNameLabel.TabIndex = 3;
|
||||
this.classNameLabel.Text = "ComonentName";
|
||||
//
|
||||
// showCycleEndFormCheckBox
|
||||
//
|
||||
this.showCycleEndFormCheckBox.AutoSize = true;
|
||||
this.showCycleEndFormCheckBox.Enabled = false;
|
||||
this.showCycleEndFormCheckBox.Location = new System.Drawing.Point(114, 90);
|
||||
this.showCycleEndFormCheckBox.Name = "showCycleEndFormCheckBox";
|
||||
this.showCycleEndFormCheckBox.Size = new System.Drawing.Size(125, 17);
|
||||
this.showCycleEndFormCheckBox.TabIndex = 14;
|
||||
this.showCycleEndFormCheckBox.Text = "Show cycle end form";
|
||||
this.showCycleEndFormCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// remarkEnabledCheckBox
|
||||
//
|
||||
this.remarkEnabledCheckBox.AutoSize = true;
|
||||
this.remarkEnabledCheckBox.Enabled = false;
|
||||
this.remarkEnabledCheckBox.Location = new System.Drawing.Point(114, 113);
|
||||
this.remarkEnabledCheckBox.Name = "remarkEnabledCheckBox";
|
||||
this.remarkEnabledCheckBox.Size = new System.Drawing.Size(99, 17);
|
||||
this.remarkEnabledCheckBox.TabIndex = 15;
|
||||
this.remarkEnabledCheckBox.Text = "Enable remarks";
|
||||
this.remarkEnabledCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// EntryFormCfgCtrl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.remarkEnabledCheckBox);
|
||||
this.Controls.Add(this.showCycleEndFormCheckBox);
|
||||
this.Controls.Add(this.nameTextBox);
|
||||
this.Controls.Add(this.nameLabel);
|
||||
this.Controls.Add(this.classNameLabel);
|
||||
this.Name = "EntryFormCfgCtrl";
|
||||
this.Size = new System.Drawing.Size(300, 200);
|
||||
this.Load += new System.EventHandler(this.EntryFormCfgCtrl_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 showCycleEndFormCheckBox;
|
||||
private System.Windows.Forms.CheckBox remarkEnabledCheckBox;
|
||||
}
|
||||
}
|
||||
@@ -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>
|
||||
@@ -0,0 +1,24 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2016 Sensus Metering Systems
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using TBF.Rig.Generic;
|
||||
|
||||
namespace TBF.Rig.DataEntry.Combined
|
||||
{
|
||||
public class EntryFormFactory : IComponentFactory
|
||||
{
|
||||
public string ClassName { get { return "DataEntry-Combined"; } }
|
||||
|
||||
public IComponent DummyComponent() { return new EntryForm(); }
|
||||
|
||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new EntryForm(cfg); }
|
||||
|
||||
public IComponentCfg DefaultConfig() { return new EntryFormCfg(this); }
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
||||
{
|
||||
return ComponentCfgBase.CreateFromDbEntity(EntryFormCfg.Serializer, component, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,426 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
using log4net;
|
||||
using TBF.Rig.GenericDevices;
|
||||
using TBF.Resources;
|
||||
|
||||
namespace TBF.Rig.DataEntry.Combined
|
||||
{
|
||||
public partial class TestStartEndForm : Form, GenericDevices.IHasCompleted
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(TestStartEndForm));
|
||||
|
||||
// Set to 'true' when the form closes
|
||||
public bool Completed { get { return completed; } }
|
||||
bool completed;
|
||||
|
||||
/// <summary> Number of water meters </summary>
|
||||
public readonly int WaterMetersCount; /// Main + Aux water meter count as one (combined) water meter
|
||||
readonly IRegReader[] regReaders;
|
||||
readonly bool[] disabled;
|
||||
|
||||
// To be retrieved after the form closes
|
||||
public double[] MainStartState;
|
||||
public double[] AuxStartState;
|
||||
|
||||
// To be retrieved after the form closes
|
||||
public readonly string[] MainStartStateStr;
|
||||
public readonly string[] AuxStartStateStr;
|
||||
|
||||
// To be retrieved after the form closes
|
||||
public double[] MainEndState;
|
||||
public double[] AuxEndState;
|
||||
|
||||
bool endStates; /// false=start states, true=end states
|
||||
double refVolume;
|
||||
double warningLimLo; /// limit to display exclamation mark, typically 2x errLimLo
|
||||
double warningLimHi; /// limit to display exclamation mark, typically 2x errLimHi
|
||||
|
||||
int TextBoxesCount;
|
||||
///
|
||||
Label[] mainLabels;
|
||||
Label[] auxLabels;
|
||||
TextBox[] mainStartTextBoxes;
|
||||
TextBox[] auxStartTextBoxes;
|
||||
TextBox[] mainEndTextBoxes;
|
||||
TextBox[] auxEndTextBoxes;
|
||||
IList<TextBox> enabledTextBoxes;
|
||||
|
||||
/// <summary>
|
||||
/// Parameterless constructor initializing common part for start and endstate form
|
||||
/// </summary>
|
||||
public TestStartEndForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
ControlBox = false;
|
||||
|
||||
TextBoxesCount = 3;
|
||||
|
||||
endStates = false;
|
||||
mainLabels = new Label[] { main1Label, main2Label, main3Label, };
|
||||
auxLabels = new Label[] { aux1Label, aux2Label, aux3Label, };
|
||||
mainStartTextBoxes = new TextBox[] { main1StartTextBox, main2StartTextBox, main3StartTextBox, };
|
||||
auxStartTextBoxes = new TextBox[] { aux1StartTextBox, aux2StartTextBox, aux3StartTextBox, };
|
||||
mainEndTextBoxes = new TextBox[] { main1EndTextBox, main2EndTextBox, main3EndTextBox, };
|
||||
auxEndTextBoxes = new TextBox[] { aux1EndTextBox, aux2EndTextBox, aux3EndTextBox, };
|
||||
enabledTextBoxes = new List<TextBox>();
|
||||
|
||||
completed = false;
|
||||
StartForceCloseHandler();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor to fill in start states
|
||||
/// </summary>
|
||||
/// <param name="waterMetersCount">Number of water meters</param>
|
||||
/// <param name="disabled">Information from CycleBeginningForm about availability of water meters</param>
|
||||
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, bool[] disabled)
|
||||
: this()
|
||||
{
|
||||
endStates = false;
|
||||
|
||||
this.WaterMetersCount = waterMetersCount;
|
||||
this.regReaders = regReaders;
|
||||
this.disabled = disabled;
|
||||
|
||||
ShuffleTextBoxes();
|
||||
|
||||
MainStartState = new double[waterMetersCount];
|
||||
AuxStartState = new double[waterMetersCount];
|
||||
MainStartStateStr = new string[waterMetersCount];
|
||||
AuxStartStateStr = new string[waterMetersCount];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor to fill in end states
|
||||
/// </summary>
|
||||
/// <param name="waterMetersCount">Number of water meters</param>
|
||||
/// <param name="mainStartStateStr">Information entered on test start (main)</param>
|
||||
/// <param name="auxStartStateStr">Information entered on test start (aux)</param>
|
||||
/// <param name="disabled">Information from CycleBeginningForm about availability of water meters</param>
|
||||
/// <param name="refVolume">Reference volume, it is used to verify the end state, show/hide exclamation if necessary</param>
|
||||
/// <param name="errLimLo">Error limit low, it is used to verify the end state, show/hide exclamation if necessary</param>
|
||||
/// <param name="errLimHi">Error limit high, it is used to verify the end state, show/hide exclamation if necessary</param>
|
||||
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, string[] mainStartStateStr, string[] auxStartStateStr,
|
||||
bool[] disabled, double refVolume, double errLimLo, double errLimHi)
|
||||
: this()
|
||||
{
|
||||
endStates = true;
|
||||
|
||||
this.WaterMetersCount = waterMetersCount;
|
||||
this.regReaders = regReaders;
|
||||
if (mainStartStateStr == null || mainStartStateStr.Length != waterMetersCount)
|
||||
throw (new Exception("Invalid 'mainStartStateStr' argument"));
|
||||
this.MainStartStateStr = mainStartStateStr;
|
||||
if (auxStartStateStr == null || auxStartStateStr.Length != waterMetersCount)
|
||||
throw (new Exception("Invalid 'auxStartStateStr' argument"));
|
||||
this.AuxStartStateStr = auxStartStateStr;
|
||||
this.disabled = disabled;
|
||||
this.refVolume = refVolume;
|
||||
this.warningLimLo = 2 * errLimLo;
|
||||
this.warningLimHi = 2 * errLimHi;
|
||||
|
||||
ShuffleTextBoxes();
|
||||
|
||||
MainEndState = new double[waterMetersCount];
|
||||
AuxEndState = new double[waterMetersCount];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Make sure the layout of labels/text boxes on the screen
|
||||
/// corresponds to the layout of watermeters of the test bench.
|
||||
/// </summary>
|
||||
void ShuffleTextBoxes()
|
||||
{
|
||||
if (TBF.Data.CompoundWMsCount < TextBoxesCount)
|
||||
{
|
||||
TextBoxesCount = TBF.Data.CompoundWMsCount;
|
||||
}
|
||||
}
|
||||
|
||||
private void CycleEndForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
Localize();
|
||||
|
||||
//Height = 115 + 90 * WaterMetersCount;
|
||||
|
||||
for (int i = 0; i < TextBoxesCount; i++)
|
||||
{
|
||||
if (i < WaterMetersCount)
|
||||
{
|
||||
mainLabels[i].Visible = mainStartTextBoxes[i].Visible = mainEndTextBoxes[i].Visible = true;
|
||||
auxLabels[i].Visible = auxStartTextBoxes[i].Visible = auxEndTextBoxes[i].Visible = true;
|
||||
}
|
||||
}
|
||||
if (TextBoxesCount >= 1) groupBox1.Visible = true;
|
||||
if (TextBoxesCount >= 2) groupBox2.Visible = true;
|
||||
if (TextBoxesCount >= 3) groupBox3.Visible = true;
|
||||
|
||||
if (endStates)
|
||||
{
|
||||
for (int i = 0; i < TextBoxesCount; i++)
|
||||
{
|
||||
if (MainStartStateStr != null && i < MainStartStateStr.Length)
|
||||
{
|
||||
mainStartTextBoxes[i].Text = MainStartStateStr[i];
|
||||
}
|
||||
if (AuxStartStateStr != null && i < AuxStartStateStr.Length)
|
||||
{
|
||||
auxStartTextBoxes[i].Text = AuxStartStateStr[i];
|
||||
}
|
||||
|
||||
if (disabled != null && i < disabled.Length && disabled[i])
|
||||
{
|
||||
mainEndTextBoxes[i].Enabled = false;
|
||||
auxEndTextBoxes[i].Enabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
mainEndTextBoxes[i].Enabled = true;
|
||||
auxEndTextBoxes[i].Enabled = true;
|
||||
enabledTextBoxes.Add(mainEndTextBoxes[i]);
|
||||
enabledTextBoxes.Add(auxEndTextBoxes[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < TextBoxesCount; i++)
|
||||
{
|
||||
if (disabled != null && i < disabled.Length && disabled[i])
|
||||
{
|
||||
mainStartTextBoxes[i].Enabled = false;
|
||||
auxStartTextBoxes[i].Enabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
mainStartTextBoxes[i].Enabled = true;
|
||||
auxStartTextBoxes[i].Enabled = true;
|
||||
enabledTextBoxes.Add(mainStartTextBoxes[i]);
|
||||
enabledTextBoxes.Add(auxStartTextBoxes[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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";
|
||||
for (int i = 0; i < TextBoxesCount; i++)
|
||||
{
|
||||
mainLabels[i].Text = Strings.Main_;
|
||||
auxLabels[i].Text = Strings.Aux_;
|
||||
}
|
||||
startLabel.Text = Strings.Start;
|
||||
endLabel.Text = Strings.End;
|
||||
okButton.Text = Strings.OkBtnText;
|
||||
}
|
||||
|
||||
private void okButton_Click(object sender, EventArgs eArgs)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (endStates)
|
||||
{
|
||||
for (int i = 0; i < Math.Min(WaterMetersCount, TextBoxesCount); i++)
|
||||
{
|
||||
if (mainEndTextBoxes[i].Visible && mainEndTextBoxes[i].Enabled)
|
||||
{
|
||||
MainEndState[i] = Utils.ParseUDouble(mainEndTextBoxes[i].Text);
|
||||
}
|
||||
if (auxEndTextBoxes[i].Visible && auxEndTextBoxes[i].Enabled)
|
||||
{
|
||||
AuxEndState[i] = Utils.ParseUDouble(auxEndTextBoxes[i].Text);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < Math.Min(WaterMetersCount, TextBoxesCount); i++)
|
||||
{
|
||||
if (mainStartTextBoxes[i].Visible && mainStartTextBoxes[i].Enabled)
|
||||
{
|
||||
MainStartStateStr[i] = mainStartTextBoxes[i].Text;
|
||||
MainStartState[i] = Utils.ParseUDouble(mainStartTextBoxes[i].Text);
|
||||
}
|
||||
if (auxStartTextBoxes[i].Visible && auxStartTextBoxes[i].Enabled)
|
||||
{
|
||||
AuxStartStateStr[i] = auxStartTextBoxes[i].Text;
|
||||
AuxStartState[i] = Utils.ParseUDouble(auxStartTextBoxes[i].Text);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.ErrorFormat("Exception: {0}", e.Message);
|
||||
return;
|
||||
}
|
||||
|
||||
completed = true;
|
||||
Close();
|
||||
}
|
||||
|
||||
#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
|
||||
|
||||
/// <summary>
|
||||
/// Calculate the approximate error and verify whether it is within limits.
|
||||
/// Make an exclamation mark visible if out of range.
|
||||
/// Similar event handler is implemented for all main/auxEndTextBoxes (1..3).
|
||||
/// </summary>
|
||||
private void main1EndTextBox_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
//double err = 0;
|
||||
//try
|
||||
//{
|
||||
// double endState = Utils.ParseUDouble(main1EndTextBox.Text);
|
||||
// double startState = Utils.ParseUDouble(main1StartTextBox.Text);
|
||||
// err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
//}
|
||||
//catch { };
|
||||
|
||||
//main1Exclamation.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
}
|
||||
|
||||
private void aux1EndTextBox_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
//double err = 0;
|
||||
//try
|
||||
//{
|
||||
// double endState = Utils.ParseUDouble(aux1EndTextBox.Text);
|
||||
// double startState = Utils.ParseUDouble(aux1StartTextBox.Text);
|
||||
// err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
//}
|
||||
//catch { err = 1000.0f; };
|
||||
|
||||
//aux1Exclamation.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
}
|
||||
|
||||
private void main2EndTextBox_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
//double err = 0;
|
||||
//try
|
||||
//{
|
||||
// double endState = Utils.ParseUDouble(main2EndTextBox.Text);
|
||||
// double startState = Utils.ParseUDouble(main2StartTextBox.Text);
|
||||
// err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
//}
|
||||
//catch { err = 1000.0f; };
|
||||
|
||||
//main2Exclamation.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
}
|
||||
|
||||
private void aux2EndTextBox_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
//double err = 0;
|
||||
//try
|
||||
//{
|
||||
// double endState = Utils.ParseUDouble(aux2EndTextBox.Text);
|
||||
// double startState = Utils.ParseUDouble(aux2StartTextBox.Text);
|
||||
// err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
//}
|
||||
//catch { err = 1000.0f; };
|
||||
|
||||
//aux2Exclamation.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
}
|
||||
|
||||
private void main3EndTextBox_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
//double err = 0;
|
||||
//try
|
||||
//{
|
||||
// double endState = Utils.ParseUDouble(main3EndTextBox.Text);
|
||||
// double startState = Utils.ParseUDouble(main3StartTextBox.Text);
|
||||
// err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
//}
|
||||
//catch { err = 1000.0f; };
|
||||
|
||||
//main3Exclamation.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
}
|
||||
|
||||
private void aux3EndTextBox_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
//double err = 0;
|
||||
//try
|
||||
//{
|
||||
// double endState = Utils.ParseUDouble(aux3EndTextBox.Text);
|
||||
// double startState = Utils.ParseUDouble(aux3StartTextBox.Text);
|
||||
// err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
//}
|
||||
//catch { err = 1000.0f; };
|
||||
|
||||
//aux3Exclamation.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Process a key press within any enabled text boxe
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
/// <param name="currentFocusOwner">TextBox control which received the event</param>
|
||||
private void ProcKeyPress(object sender, KeyPressEventArgs e, TextBox currentFocusOwner)
|
||||
{
|
||||
if (e.KeyChar == '+')
|
||||
{
|
||||
/// Process '+' key ..... Form completed
|
||||
okButton_Click(sender, e);
|
||||
}
|
||||
if (e.KeyChar == '\r')
|
||||
{
|
||||
/// Process <enter> key ..... Next text field
|
||||
if (enabledTextBoxes.Count < 2) return; /// There is just one enabled textbox
|
||||
|
||||
for (int i = 0; i < enabledTextBoxes.Count; i++)
|
||||
{
|
||||
if (enabledTextBoxes[i] == currentFocusOwner)
|
||||
{
|
||||
/// Change focus to the next enabled text box
|
||||
enabledTextBoxes[(i + 1) % enabledTextBoxes.Count].Focus();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void main1StartTextBox_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, main1StartTextBox); }
|
||||
private void main2StartTextBox_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, main2StartTextBox); }
|
||||
private void main3StartTextBox_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, main3StartTextBox); }
|
||||
|
||||
private void aux1StartTextBox_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, aux1StartTextBox); }
|
||||
private void aux2StartTextBox_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, aux2StartTextBox); }
|
||||
private void aux3StartTextBox_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, aux3StartTextBox); }
|
||||
|
||||
private void main1EndTextBox_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, main1EndTextBox); }
|
||||
private void main2EndTextBox_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, main2EndTextBox); }
|
||||
private void main3EndTextBox_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, main3EndTextBox); }
|
||||
|
||||
private void aux1EndTextBox_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, aux1EndTextBox); }
|
||||
private void aux2EndTextBox_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, aux2EndTextBox); }
|
||||
private void aux3EndTextBox_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, aux3EndTextBox); }
|
||||
}
|
||||
}
|
||||
+482
@@ -0,0 +1,482 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
namespace TBF.Rig.DataEntry.Combined
|
||||
{
|
||||
partial class TestStartEndForm
|
||||
{
|
||||
/// <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.aux1Exclamation = new System.Windows.Forms.Label();
|
||||
this.aux1StartTextBox = new System.Windows.Forms.TextBox();
|
||||
this.aux1EndTextBox = new System.Windows.Forms.TextBox();
|
||||
this.aux1Label = new System.Windows.Forms.Label();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.main1Exclamation = new System.Windows.Forms.Label();
|
||||
this.main1StartTextBox = new System.Windows.Forms.TextBox();
|
||||
this.main1EndTextBox = new System.Windows.Forms.TextBox();
|
||||
this.main1Label = new System.Windows.Forms.Label();
|
||||
this.okButton = new System.Windows.Forms.Button();
|
||||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||
this.aux2Exclamation = new System.Windows.Forms.Label();
|
||||
this.main2Exclamation = new System.Windows.Forms.Label();
|
||||
this.aux2StartTextBox = new System.Windows.Forms.TextBox();
|
||||
this.main2StartTextBox = new System.Windows.Forms.TextBox();
|
||||
this.aux2EndTextBox = new System.Windows.Forms.TextBox();
|
||||
this.aux2Label = new System.Windows.Forms.Label();
|
||||
this.main2EndTextBox = new System.Windows.Forms.TextBox();
|
||||
this.main2Label = new System.Windows.Forms.Label();
|
||||
this.groupBox3 = new System.Windows.Forms.GroupBox();
|
||||
this.aux3Exclamation = new System.Windows.Forms.Label();
|
||||
this.main3Exclamation = new System.Windows.Forms.Label();
|
||||
this.aux3StartTextBox = new System.Windows.Forms.TextBox();
|
||||
this.main3StartTextBox = new System.Windows.Forms.TextBox();
|
||||
this.aux3EndTextBox = new System.Windows.Forms.TextBox();
|
||||
this.aux3Label = new System.Windows.Forms.Label();
|
||||
this.main3EndTextBox = new System.Windows.Forms.TextBox();
|
||||
this.main3Label = new System.Windows.Forms.Label();
|
||||
this.startLabel = new System.Windows.Forms.Label();
|
||||
this.endLabel = new System.Windows.Forms.Label();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.groupBox2.SuspendLayout();
|
||||
this.groupBox3.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// aux1Exclamation
|
||||
//
|
||||
this.aux1Exclamation.AutoSize = true;
|
||||
this.aux1Exclamation.Font = new System.Drawing.Font("Verdana", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.aux1Exclamation.ForeColor = System.Drawing.Color.Red;
|
||||
this.aux1Exclamation.Location = new System.Drawing.Point(515, 71);
|
||||
this.aux1Exclamation.Name = "aux1Exclamation";
|
||||
this.aux1Exclamation.Size = new System.Drawing.Size(30, 38);
|
||||
this.aux1Exclamation.TabIndex = 4;
|
||||
this.aux1Exclamation.Text = "!";
|
||||
this.aux1Exclamation.Visible = false;
|
||||
//
|
||||
// aux1StartTextBox
|
||||
//
|
||||
this.aux1StartTextBox.Enabled = false;
|
||||
this.aux1StartTextBox.Location = new System.Drawing.Point(164, 75);
|
||||
this.aux1StartTextBox.Name = "aux1StartTextBox";
|
||||
this.aux1StartTextBox.Size = new System.Drawing.Size(163, 31);
|
||||
this.aux1StartTextBox.TabIndex = 1;
|
||||
this.aux1StartTextBox.Visible = false;
|
||||
this.aux1StartTextBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.aux1StartTextBox_KeyPress);
|
||||
//
|
||||
// aux1EndTextBox
|
||||
//
|
||||
this.aux1EndTextBox.Enabled = false;
|
||||
this.aux1EndTextBox.Location = new System.Drawing.Point(350, 75);
|
||||
this.aux1EndTextBox.Name = "aux1EndTextBox";
|
||||
this.aux1EndTextBox.Size = new System.Drawing.Size(163, 31);
|
||||
this.aux1EndTextBox.TabIndex = 3;
|
||||
this.aux1EndTextBox.Visible = false;
|
||||
this.aux1EndTextBox.TextChanged += new System.EventHandler(this.aux1EndTextBox_TextChanged);
|
||||
this.aux1EndTextBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.aux1EndTextBox_KeyPress);
|
||||
//
|
||||
// aux1Label
|
||||
//
|
||||
this.aux1Label.AutoSize = true;
|
||||
this.aux1Label.Location = new System.Drawing.Point(18, 78);
|
||||
this.aux1Label.Name = "aux1Label";
|
||||
this.aux1Label.Size = new System.Drawing.Size(55, 23);
|
||||
this.aux1Label.TabIndex = 0;
|
||||
this.aux1Label.Text = "Aux:";
|
||||
this.aux1Label.Visible = false;
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
this.groupBox1.Controls.Add(this.aux1Exclamation);
|
||||
this.groupBox1.Controls.Add(this.main1Exclamation);
|
||||
this.groupBox1.Controls.Add(this.aux1StartTextBox);
|
||||
this.groupBox1.Controls.Add(this.aux1EndTextBox);
|
||||
this.groupBox1.Controls.Add(this.main1StartTextBox);
|
||||
this.groupBox1.Controls.Add(this.aux1Label);
|
||||
this.groupBox1.Controls.Add(this.main1EndTextBox);
|
||||
this.groupBox1.Controls.Add(this.main1Label);
|
||||
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, 32);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Size = new System.Drawing.Size(547, 124);
|
||||
this.groupBox1.TabIndex = 1;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "Water Meter 1";
|
||||
this.groupBox1.Visible = false;
|
||||
//
|
||||
// main1Exclamation
|
||||
//
|
||||
this.main1Exclamation.AutoSize = true;
|
||||
this.main1Exclamation.Font = new System.Drawing.Font("Verdana", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.main1Exclamation.ForeColor = System.Drawing.Color.Red;
|
||||
this.main1Exclamation.Location = new System.Drawing.Point(515, 27);
|
||||
this.main1Exclamation.Name = "main1Exclamation";
|
||||
this.main1Exclamation.Size = new System.Drawing.Size(30, 38);
|
||||
this.main1Exclamation.TabIndex = 3;
|
||||
this.main1Exclamation.Text = "!";
|
||||
this.main1Exclamation.Visible = false;
|
||||
//
|
||||
// main1StartTextBox
|
||||
//
|
||||
this.main1StartTextBox.Enabled = false;
|
||||
this.main1StartTextBox.Location = new System.Drawing.Point(164, 31);
|
||||
this.main1StartTextBox.Name = "main1StartTextBox";
|
||||
this.main1StartTextBox.Size = new System.Drawing.Size(163, 31);
|
||||
this.main1StartTextBox.TabIndex = 0;
|
||||
this.main1StartTextBox.Visible = false;
|
||||
this.main1StartTextBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.main1StartTextBox_KeyPress);
|
||||
//
|
||||
// main1EndTextBox
|
||||
//
|
||||
this.main1EndTextBox.Enabled = false;
|
||||
this.main1EndTextBox.Location = new System.Drawing.Point(350, 31);
|
||||
this.main1EndTextBox.Name = "main1EndTextBox";
|
||||
this.main1EndTextBox.Size = new System.Drawing.Size(163, 31);
|
||||
this.main1EndTextBox.TabIndex = 2;
|
||||
this.main1EndTextBox.Visible = false;
|
||||
this.main1EndTextBox.TextChanged += new System.EventHandler(this.main1EndTextBox_TextChanged);
|
||||
this.main1EndTextBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.main1EndTextBox_KeyPress);
|
||||
//
|
||||
// main1Label
|
||||
//
|
||||
this.main1Label.AutoSize = true;
|
||||
this.main1Label.Location = new System.Drawing.Point(18, 34);
|
||||
this.main1Label.Name = "main1Label";
|
||||
this.main1Label.Size = new System.Drawing.Size(64, 23);
|
||||
this.main1Label.TabIndex = 0;
|
||||
this.main1Label.Text = "Main:";
|
||||
this.main1Label.Visible = false;
|
||||
//
|
||||
// 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(603, 46);
|
||||
this.okButton.Name = "okButton";
|
||||
this.okButton.Size = new System.Drawing.Size(98, 63);
|
||||
this.okButton.TabIndex = 4;
|
||||
this.okButton.Text = "OK";
|
||||
this.okButton.UseVisualStyleBackColor = true;
|
||||
this.okButton.Click += new System.EventHandler(this.okButton_Click);
|
||||
//
|
||||
// groupBox2
|
||||
//
|
||||
this.groupBox2.Controls.Add(this.aux2Exclamation);
|
||||
this.groupBox2.Controls.Add(this.main2Exclamation);
|
||||
this.groupBox2.Controls.Add(this.aux2StartTextBox);
|
||||
this.groupBox2.Controls.Add(this.main2StartTextBox);
|
||||
this.groupBox2.Controls.Add(this.aux2EndTextBox);
|
||||
this.groupBox2.Controls.Add(this.aux2Label);
|
||||
this.groupBox2.Controls.Add(this.main2EndTextBox);
|
||||
this.groupBox2.Controls.Add(this.main2Label);
|
||||
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, 177);
|
||||
this.groupBox2.Name = "groupBox2";
|
||||
this.groupBox2.Size = new System.Drawing.Size(547, 124);
|
||||
this.groupBox2.TabIndex = 2;
|
||||
this.groupBox2.TabStop = false;
|
||||
this.groupBox2.Text = "Water Meter 2";
|
||||
this.groupBox2.Visible = false;
|
||||
//
|
||||
// aux2Exclamation
|
||||
//
|
||||
this.aux2Exclamation.AutoSize = true;
|
||||
this.aux2Exclamation.Font = new System.Drawing.Font("Verdana", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.aux2Exclamation.ForeColor = System.Drawing.Color.Red;
|
||||
this.aux2Exclamation.Location = new System.Drawing.Point(515, 70);
|
||||
this.aux2Exclamation.Name = "aux2Exclamation";
|
||||
this.aux2Exclamation.Size = new System.Drawing.Size(30, 38);
|
||||
this.aux2Exclamation.TabIndex = 5;
|
||||
this.aux2Exclamation.Text = "!";
|
||||
this.aux2Exclamation.Visible = false;
|
||||
//
|
||||
// main2Exclamation
|
||||
//
|
||||
this.main2Exclamation.AutoSize = true;
|
||||
this.main2Exclamation.Font = new System.Drawing.Font("Verdana", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.main2Exclamation.ForeColor = System.Drawing.Color.Red;
|
||||
this.main2Exclamation.Location = new System.Drawing.Point(515, 27);
|
||||
this.main2Exclamation.Name = "main2Exclamation";
|
||||
this.main2Exclamation.Size = new System.Drawing.Size(30, 38);
|
||||
this.main2Exclamation.TabIndex = 5;
|
||||
this.main2Exclamation.Text = "!";
|
||||
this.main2Exclamation.Visible = false;
|
||||
//
|
||||
// aux2StartTextBox
|
||||
//
|
||||
this.aux2StartTextBox.Enabled = false;
|
||||
this.aux2StartTextBox.Location = new System.Drawing.Point(164, 74);
|
||||
this.aux2StartTextBox.Name = "aux2StartTextBox";
|
||||
this.aux2StartTextBox.Size = new System.Drawing.Size(163, 31);
|
||||
this.aux2StartTextBox.TabIndex = 1;
|
||||
this.aux2StartTextBox.Visible = false;
|
||||
this.aux2StartTextBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.aux2StartTextBox_KeyPress);
|
||||
//
|
||||
// main2StartTextBox
|
||||
//
|
||||
this.main2StartTextBox.Enabled = false;
|
||||
this.main2StartTextBox.Location = new System.Drawing.Point(164, 31);
|
||||
this.main2StartTextBox.Name = "main2StartTextBox";
|
||||
this.main2StartTextBox.Size = new System.Drawing.Size(163, 31);
|
||||
this.main2StartTextBox.TabIndex = 0;
|
||||
this.main2StartTextBox.Visible = false;
|
||||
this.main2StartTextBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.main2StartTextBox_KeyPress);
|
||||
//
|
||||
// aux2EndTextBox
|
||||
//
|
||||
this.aux2EndTextBox.Enabled = false;
|
||||
this.aux2EndTextBox.Location = new System.Drawing.Point(350, 74);
|
||||
this.aux2EndTextBox.Name = "aux2EndTextBox";
|
||||
this.aux2EndTextBox.Size = new System.Drawing.Size(163, 31);
|
||||
this.aux2EndTextBox.TabIndex = 3;
|
||||
this.aux2EndTextBox.Visible = false;
|
||||
this.aux2EndTextBox.TextChanged += new System.EventHandler(this.aux2EndTextBox_TextChanged);
|
||||
this.aux2EndTextBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.aux2EndTextBox_KeyPress);
|
||||
//
|
||||
// aux2Label
|
||||
//
|
||||
this.aux2Label.AutoSize = true;
|
||||
this.aux2Label.Location = new System.Drawing.Point(18, 77);
|
||||
this.aux2Label.Name = "aux2Label";
|
||||
this.aux2Label.Size = new System.Drawing.Size(55, 23);
|
||||
this.aux2Label.TabIndex = 0;
|
||||
this.aux2Label.Text = "Aux:";
|
||||
this.aux2Label.Visible = false;
|
||||
//
|
||||
// main2EndTextBox
|
||||
//
|
||||
this.main2EndTextBox.Enabled = false;
|
||||
this.main2EndTextBox.Location = new System.Drawing.Point(350, 31);
|
||||
this.main2EndTextBox.Name = "main2EndTextBox";
|
||||
this.main2EndTextBox.Size = new System.Drawing.Size(163, 31);
|
||||
this.main2EndTextBox.TabIndex = 2;
|
||||
this.main2EndTextBox.Visible = false;
|
||||
this.main2EndTextBox.TextChanged += new System.EventHandler(this.main2EndTextBox_TextChanged);
|
||||
this.main2EndTextBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.main2EndTextBox_KeyPress);
|
||||
//
|
||||
// main2Label
|
||||
//
|
||||
this.main2Label.AutoSize = true;
|
||||
this.main2Label.Location = new System.Drawing.Point(18, 34);
|
||||
this.main2Label.Name = "main2Label";
|
||||
this.main2Label.Size = new System.Drawing.Size(64, 23);
|
||||
this.main2Label.TabIndex = 0;
|
||||
this.main2Label.Text = "Main:";
|
||||
this.main2Label.Visible = false;
|
||||
//
|
||||
// groupBox3
|
||||
//
|
||||
this.groupBox3.Controls.Add(this.aux3Exclamation);
|
||||
this.groupBox3.Controls.Add(this.main3Exclamation);
|
||||
this.groupBox3.Controls.Add(this.aux3StartTextBox);
|
||||
this.groupBox3.Controls.Add(this.main3StartTextBox);
|
||||
this.groupBox3.Controls.Add(this.aux3EndTextBox);
|
||||
this.groupBox3.Controls.Add(this.aux3Label);
|
||||
this.groupBox3.Controls.Add(this.main3EndTextBox);
|
||||
this.groupBox3.Controls.Add(this.main3Label);
|
||||
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, 321);
|
||||
this.groupBox3.Name = "groupBox3";
|
||||
this.groupBox3.Size = new System.Drawing.Size(547, 124);
|
||||
this.groupBox3.TabIndex = 3;
|
||||
this.groupBox3.TabStop = false;
|
||||
this.groupBox3.Text = "Water Meter 3";
|
||||
this.groupBox3.Visible = false;
|
||||
//
|
||||
// aux3Exclamation
|
||||
//
|
||||
this.aux3Exclamation.AutoSize = true;
|
||||
this.aux3Exclamation.Font = new System.Drawing.Font("Verdana", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.aux3Exclamation.ForeColor = System.Drawing.Color.Red;
|
||||
this.aux3Exclamation.Location = new System.Drawing.Point(515, 70);
|
||||
this.aux3Exclamation.Name = "aux3Exclamation";
|
||||
this.aux3Exclamation.Size = new System.Drawing.Size(30, 38);
|
||||
this.aux3Exclamation.TabIndex = 5;
|
||||
this.aux3Exclamation.Text = "!";
|
||||
this.aux3Exclamation.Visible = false;
|
||||
//
|
||||
// main3Exclamation
|
||||
//
|
||||
this.main3Exclamation.AutoSize = true;
|
||||
this.main3Exclamation.Font = new System.Drawing.Font("Verdana", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.main3Exclamation.ForeColor = System.Drawing.Color.Red;
|
||||
this.main3Exclamation.Location = new System.Drawing.Point(515, 27);
|
||||
this.main3Exclamation.Name = "main3Exclamation";
|
||||
this.main3Exclamation.Size = new System.Drawing.Size(30, 38);
|
||||
this.main3Exclamation.TabIndex = 5;
|
||||
this.main3Exclamation.Text = "!";
|
||||
this.main3Exclamation.Visible = false;
|
||||
//
|
||||
// aux3StartTextBox
|
||||
//
|
||||
this.aux3StartTextBox.Enabled = false;
|
||||
this.aux3StartTextBox.Location = new System.Drawing.Point(164, 74);
|
||||
this.aux3StartTextBox.Name = "aux3StartTextBox";
|
||||
this.aux3StartTextBox.Size = new System.Drawing.Size(163, 31);
|
||||
this.aux3StartTextBox.TabIndex = 1;
|
||||
this.aux3StartTextBox.Visible = false;
|
||||
this.aux3StartTextBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.aux3StartTextBox_KeyPress);
|
||||
//
|
||||
// main3StartTextBox
|
||||
//
|
||||
this.main3StartTextBox.Enabled = false;
|
||||
this.main3StartTextBox.Location = new System.Drawing.Point(164, 31);
|
||||
this.main3StartTextBox.Name = "main3StartTextBox";
|
||||
this.main3StartTextBox.Size = new System.Drawing.Size(163, 31);
|
||||
this.main3StartTextBox.TabIndex = 0;
|
||||
this.main3StartTextBox.Visible = false;
|
||||
this.main3StartTextBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.main3StartTextBox_KeyPress);
|
||||
//
|
||||
// aux3EndTextBox
|
||||
//
|
||||
this.aux3EndTextBox.Enabled = false;
|
||||
this.aux3EndTextBox.Location = new System.Drawing.Point(350, 74);
|
||||
this.aux3EndTextBox.Name = "aux3EndTextBox";
|
||||
this.aux3EndTextBox.Size = new System.Drawing.Size(163, 31);
|
||||
this.aux3EndTextBox.TabIndex = 3;
|
||||
this.aux3EndTextBox.Visible = false;
|
||||
this.aux3EndTextBox.TextChanged += new System.EventHandler(this.aux3EndTextBox_TextChanged);
|
||||
this.aux3EndTextBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.aux3EndTextBox_KeyPress);
|
||||
//
|
||||
// aux3Label
|
||||
//
|
||||
this.aux3Label.AutoSize = true;
|
||||
this.aux3Label.Location = new System.Drawing.Point(18, 77);
|
||||
this.aux3Label.Name = "aux3Label";
|
||||
this.aux3Label.Size = new System.Drawing.Size(55, 23);
|
||||
this.aux3Label.TabIndex = 0;
|
||||
this.aux3Label.Text = "Aux:";
|
||||
this.aux3Label.Visible = false;
|
||||
//
|
||||
// main3EndTextBox
|
||||
//
|
||||
this.main3EndTextBox.Enabled = false;
|
||||
this.main3EndTextBox.Location = new System.Drawing.Point(350, 31);
|
||||
this.main3EndTextBox.Name = "main3EndTextBox";
|
||||
this.main3EndTextBox.Size = new System.Drawing.Size(163, 31);
|
||||
this.main3EndTextBox.TabIndex = 2;
|
||||
this.main3EndTextBox.Visible = false;
|
||||
this.main3EndTextBox.TextChanged += new System.EventHandler(this.main3EndTextBox_TextChanged);
|
||||
this.main3EndTextBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.main3EndTextBox_KeyPress);
|
||||
//
|
||||
// main3Label
|
||||
//
|
||||
this.main3Label.AutoSize = true;
|
||||
this.main3Label.Location = new System.Drawing.Point(18, 34);
|
||||
this.main3Label.Name = "main3Label";
|
||||
this.main3Label.Size = new System.Drawing.Size(64, 23);
|
||||
this.main3Label.TabIndex = 0;
|
||||
this.main3Label.Text = "Main:";
|
||||
this.main3Label.Visible = false;
|
||||
//
|
||||
// startLabel
|
||||
//
|
||||
this.startLabel.AutoSize = true;
|
||||
this.startLabel.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.startLabel.Location = new System.Drawing.Point(245, 11);
|
||||
this.startLabel.Name = "startLabel";
|
||||
this.startLabel.Size = new System.Drawing.Size(56, 23);
|
||||
this.startLabel.TabIndex = 5;
|
||||
this.startLabel.Text = "Start";
|
||||
//
|
||||
// endLabel
|
||||
//
|
||||
this.endLabel.AutoSize = true;
|
||||
this.endLabel.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.endLabel.Location = new System.Drawing.Point(431, 11);
|
||||
this.endLabel.Name = "endLabel";
|
||||
this.endLabel.Size = new System.Drawing.Size(46, 23);
|
||||
this.endLabel.TabIndex = 5;
|
||||
this.endLabel.Text = "End";
|
||||
//
|
||||
// TestStartEndForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.DarkGray;
|
||||
this.ClientSize = new System.Drawing.Size(729, 471);
|
||||
this.Controls.Add(this.endLabel);
|
||||
this.Controls.Add(this.startLabel);
|
||||
this.Controls.Add(this.groupBox3);
|
||||
this.Controls.Add(this.groupBox2);
|
||||
this.Controls.Add(this.okButton);
|
||||
this.Controls.Add(this.groupBox1);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
|
||||
this.Name = "TestStartEndForm";
|
||||
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
|
||||
this.Text = "End States";
|
||||
this.TopMost = true;
|
||||
this.Load += new System.EventHandler(this.CycleEndForm_Load);
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
this.groupBox1.PerformLayout();
|
||||
this.groupBox2.ResumeLayout(false);
|
||||
this.groupBox2.PerformLayout();
|
||||
this.groupBox3.ResumeLayout(false);
|
||||
this.groupBox3.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TextBox aux1EndTextBox;
|
||||
private System.Windows.Forms.Label aux1Label;
|
||||
private System.Windows.Forms.GroupBox groupBox1;
|
||||
private System.Windows.Forms.TextBox main1EndTextBox;
|
||||
private System.Windows.Forms.Label main1Label;
|
||||
private System.Windows.Forms.Button okButton;
|
||||
private System.Windows.Forms.GroupBox groupBox2;
|
||||
private System.Windows.Forms.TextBox main2EndTextBox;
|
||||
private System.Windows.Forms.Label main2Label;
|
||||
private System.Windows.Forms.TextBox aux2EndTextBox;
|
||||
private System.Windows.Forms.Label aux2Label;
|
||||
private System.Windows.Forms.GroupBox groupBox3;
|
||||
private System.Windows.Forms.TextBox main3EndTextBox;
|
||||
private System.Windows.Forms.Label main3Label;
|
||||
private System.Windows.Forms.TextBox aux3EndTextBox;
|
||||
private System.Windows.Forms.Label aux3Label;
|
||||
private System.Windows.Forms.TextBox aux1StartTextBox;
|
||||
private System.Windows.Forms.TextBox main1StartTextBox;
|
||||
private System.Windows.Forms.TextBox main2StartTextBox;
|
||||
private System.Windows.Forms.TextBox aux2StartTextBox;
|
||||
private System.Windows.Forms.TextBox main3StartTextBox;
|
||||
private System.Windows.Forms.TextBox aux3StartTextBox;
|
||||
private System.Windows.Forms.Label startLabel;
|
||||
private System.Windows.Forms.Label endLabel;
|
||||
private System.Windows.Forms.Label aux1Exclamation;
|
||||
private System.Windows.Forms.Label main1Exclamation;
|
||||
private System.Windows.Forms.Label main2Exclamation;
|
||||
private System.Windows.Forms.Label aux2Exclamation;
|
||||
private System.Windows.Forms.Label main3Exclamation;
|
||||
private System.Windows.Forms.Label aux3Exclamation;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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>
|
||||
@@ -0,0 +1,34 @@
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace TBF.Rig.DataEntry
|
||||
{
|
||||
public class DEUtils
|
||||
{
|
||||
/// <summary>
|
||||
/// Load Purchase order combo box items from the LocalSettings PurchaseOrderHistory array
|
||||
/// </summary>
|
||||
/// <param name="comboBox">Puchase order ComboBox</param>
|
||||
public static void PrepareCombo(ComboBox comboBox, string[] history, bool emptyOnStart = false)
|
||||
{
|
||||
int historyLen = (history != null) ? history.Length : 0;
|
||||
|
||||
if (!emptyOnStart && (historyLen > 0))
|
||||
{
|
||||
comboBox.Text = history[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
comboBox.Text = string.Empty;
|
||||
}
|
||||
|
||||
for (int i = 0; i < historyLen; i++)
|
||||
{
|
||||
comboBox.Items.Add(history[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
///
|
||||
/// Copyright (c) 2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using TBF.Resources;
|
||||
|
||||
namespace TBF.Rig.DataEntry.DataStream
|
||||
{
|
||||
public class CheckBoxImage : PictureBox
|
||||
{
|
||||
private bool cbChecked;
|
||||
private readonly Image checkedImg;
|
||||
private readonly Image uncheckedImg;
|
||||
|
||||
public CheckBoxImage()
|
||||
: this(new Bitmap(TBF.Properties.Resources.SwitchOn), new Bitmap(TBF.Properties.Resources.SwitchOff), true)
|
||||
{
|
||||
SizeMode = PictureBoxSizeMode.StretchImage;
|
||||
}
|
||||
|
||||
public CheckBoxImage(Image checkedImg, Image uncheckedImg, bool initState)
|
||||
: base()
|
||||
{
|
||||
this.checkedImg = checkedImg;
|
||||
this.uncheckedImg = uncheckedImg;
|
||||
Click += (sender, e) => { Checked = !Checked; };
|
||||
Checked = initState;
|
||||
}
|
||||
|
||||
public bool Checked
|
||||
{
|
||||
get { return cbChecked; }
|
||||
set
|
||||
{
|
||||
if (Enabled)
|
||||
{
|
||||
Image = value ? checkedImg : uncheckedImg;
|
||||
cbChecked = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+1115
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,566 @@
|
||||
///
|
||||
/// Copyright (c) 2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Globalization;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
using log4net;
|
||||
using TBF.Rig.RegisterReaders.DataStream.MefImport;
|
||||
using TBF.Resources;
|
||||
|
||||
namespace TBF.Rig.DataEntry.DataStream
|
||||
{
|
||||
public enum CommErr
|
||||
{
|
||||
None = 0,
|
||||
CommFailed, /// 1
|
||||
HeadDisabledByUser, /// 2
|
||||
}
|
||||
|
||||
public partial class CycleBeginningForm : Form, GenericDevices.IHasCompleted
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(CycleBeginningForm));
|
||||
|
||||
public static Color InitialColor = Color.LightGray;
|
||||
public static Color DisabledColor = Color.DarkGray;
|
||||
public static Color OptoOKColor = Color.Green;
|
||||
public static Color OptoNokColor = Color.Red;
|
||||
public static Color BusyColor = Color.Yellow;
|
||||
|
||||
/// <summary> Number of water meters </summary>
|
||||
IList<Results.Entities.WaterMeter> waterMeters;
|
||||
MefImport mefImport;
|
||||
|
||||
/// To be retrieved after the form is closed
|
||||
public string PurchaseOrder;
|
||||
public string[] SNText;
|
||||
public bool[] Disabled;
|
||||
|
||||
/// Set to 'true' when the form closes
|
||||
public bool Completed { get { return formCompleted; } }
|
||||
bool formCompleted;
|
||||
|
||||
Thread thread;
|
||||
public int DataStreamsCount;
|
||||
int busyIx;
|
||||
|
||||
/// <summary> Number of text boxes for serial numbers </summary>
|
||||
Label[] labels;
|
||||
CheckBoxImage[] checkBoxes;
|
||||
PictureBox[] pictures;
|
||||
TextBox[] serialNrBoxes;
|
||||
IList<TextBox> enabledSerialNrBoxes;
|
||||
|
||||
|
||||
/// <summary> Parameterless constructor for common functionality </summary>
|
||||
public CycleBeginningForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
ControlBox = false;
|
||||
|
||||
labels = new Label[]
|
||||
{
|
||||
label1, label2, label3, label4, label5, label6, label7, label8, label9, label10, label11, label12,
|
||||
label13, label14, label15, label16, label17, label18, label19, label20, label21, label22, label23, label24,
|
||||
};
|
||||
checkBoxes = new CheckBoxImage[]
|
||||
{
|
||||
checkBoxImage1, checkBoxImage2, checkBoxImage3, checkBoxImage4, checkBoxImage5, checkBoxImage6,
|
||||
checkBoxImage7, checkBoxImage8, checkBoxImage9, checkBoxImage10, checkBoxImage11, checkBoxImage12,
|
||||
checkBoxImage13, checkBoxImage14, checkBoxImage15, checkBoxImage16, checkBoxImage17, checkBoxImage18,
|
||||
checkBoxImage19, checkBoxImage20, checkBoxImage21, checkBoxImage22, checkBoxImage23, checkBoxImage24,
|
||||
};
|
||||
pictures = new PictureBox[]
|
||||
{
|
||||
pictureBox1, pictureBox2, pictureBox3, pictureBox4, pictureBox5, pictureBox6,
|
||||
pictureBox7, pictureBox8, pictureBox9, pictureBox10, pictureBox11, pictureBox12,
|
||||
pictureBox13, pictureBox14, pictureBox15, pictureBox16, pictureBox17, pictureBox18,
|
||||
pictureBox19, pictureBox20, pictureBox21, pictureBox22, pictureBox23, pictureBox24,
|
||||
};
|
||||
serialNrBoxes = new TextBox[]
|
||||
{
|
||||
serialNrBox1, serialNrBox2, serialNrBox3, serialNrBox4, serialNrBox5, serialNrBox6,
|
||||
serialNrBox7, serialNrBox8, serialNrBox9, serialNrBox10, serialNrBox11, serialNrBox12,
|
||||
serialNrBox13, serialNrBox14, serialNrBox15, serialNrBox16, serialNrBox17, serialNrBox18,
|
||||
serialNrBox19, serialNrBox20, serialNrBox21, serialNrBox22, serialNrBox23, serialNrBox24,
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="waterMetersCount">Number of text boxes for serial numbers</param>
|
||||
public CycleBeginningForm(IList<Results.Entities.WaterMeter> waterMeters, MefImport mefImport)
|
||||
: this()
|
||||
{
|
||||
this.waterMeters = waterMeters;
|
||||
this.mefImport = mefImport;
|
||||
|
||||
SNText = new string[waterMeters.Count];
|
||||
Disabled = new bool[waterMeters.Count];
|
||||
|
||||
Localize();
|
||||
|
||||
PrepareOrderCombo(orderComboBox);
|
||||
|
||||
int wmsCount = Math.Min(mefImport.DataStreamIFace.GetMetersCount(), waterMeters.Count);
|
||||
|
||||
int right, bottom;
|
||||
enabledSerialNrBoxes = ShuffleTextBoxes(wmsCount, TBF.Data.LineSize, out right, out bottom);
|
||||
Height = bottom + 60;
|
||||
|
||||
DataStreamsCount = enabledSerialNrBoxes.Count;
|
||||
|
||||
SetCheckBoxStates(Program.LocalSettings.OptoHeadsEnabled);
|
||||
|
||||
busyIx = -1;
|
||||
formCompleted = false;
|
||||
StartForceCloseHandler();
|
||||
|
||||
/// Attach to handlers
|
||||
OpenConnStartedHandler += delegate(object sender, OpenConnectionEventArgs args)
|
||||
{
|
||||
if (InvokeRequired) { Invoke(new EventHandler<OpenConnectionEventArgs>(DoOnOpenConnStarted), sender, args); }
|
||||
else { DoOnOpenConnStarted(sender, args); }
|
||||
};
|
||||
OpenConnCompletedHandler += delegate(object sender, OpenConnectionEventArgs args)
|
||||
{
|
||||
if (InvokeRequired) { Invoke(new EventHandler<OpenConnectionEventArgs>(DoOnOpenConnCompleted), sender, args); }
|
||||
else { DoOnOpenConnCompleted(sender, args); }
|
||||
};
|
||||
|
||||
///
|
||||
/// Start communication with water meters in the worker thread
|
||||
///
|
||||
thread = new Thread(Worker);
|
||||
thread.CurrentCulture = CultureInfo.CurrentCulture;
|
||||
thread.CurrentUICulture = CultureInfo.CurrentUICulture;
|
||||
thread.Start();
|
||||
}
|
||||
|
||||
void Localize()
|
||||
{
|
||||
Text = Strings.Opening_connections_with_water_meters;
|
||||
orderGroupBox.Text = Strings.Purchase_order;
|
||||
okButton.Text = Strings.OkBtnText;
|
||||
retryButton.Text = Strings.RetryBtnText;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load Purchase order combo box items from the LocalSettings PurchaseOrderHistory array
|
||||
/// </summary>
|
||||
/// <param name="orderComboBox">Puchase order ComboBox</param>
|
||||
void PrepareOrderCombo(ComboBox orderComboBox)
|
||||
{
|
||||
for (int i = 0; i < Program.LocalSettings.PurchaseOrderHistoryCount; i++)
|
||||
{
|
||||
orderComboBox.Items.Add(Program.LocalSettings.PurchaseOrderHistory[i]);
|
||||
}
|
||||
|
||||
if (orderComboBox.Items.Count > 0)
|
||||
{
|
||||
orderComboBox.Text = orderComboBox.Items[0].ToString();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Makes layout of labels/text boxes on the screen the same
|
||||
/// as the layout of watermeters on the test bench.
|
||||
/// To be used only once in the constructor or in the form load handler.
|
||||
/// </summary>
|
||||
/// <param name="wmsCount">Number of water meters</param>
|
||||
/// <param name="lineSize">Number of water meters in one line</param>
|
||||
/// <param name="right">Right coordinate of the rightmost TextBox</param>
|
||||
/// <param name="bottom">Bottom coordinate of the bottommost TextBox</param>
|
||||
/// <returns>List of enabled text boxes</returns>
|
||||
IList<TextBox> ShuffleTextBoxes(int wmsCount, int lineSize, out int right, out int bottom)
|
||||
{
|
||||
int uiBoxesCount = serialNrBoxes.Length;
|
||||
IList<TextBox> enabledSerialNrBoxes = new List<TextBox>();
|
||||
|
||||
if (wmsCount < uiBoxesCount && lineSize > 0)
|
||||
{
|
||||
int nrLines = (wmsCount + lineSize - 1) / lineSize;
|
||||
int gap = (uiBoxesCount - wmsCount) / nrLines;
|
||||
|
||||
int dest = 0;
|
||||
for (int l = 0; l < nrLines; l++)
|
||||
{
|
||||
for (int i = 0; i < lineSize; i++)
|
||||
{
|
||||
int origin = l * lineSize + l * gap + i;
|
||||
|
||||
labels[dest] = labels[origin];
|
||||
checkBoxes[dest] = checkBoxes[origin];
|
||||
pictures[dest] = pictures[origin];
|
||||
serialNrBoxes[dest] = serialNrBoxes[origin];
|
||||
|
||||
labels[dest].Visible = true;
|
||||
checkBoxes[dest].Visible = true;
|
||||
pictures[dest].Visible = true;
|
||||
serialNrBoxes[dest].Visible = true;
|
||||
|
||||
labels[dest].Text = (dest + 1).ToString();
|
||||
enabledSerialNrBoxes.Add(serialNrBoxes[dest]);
|
||||
|
||||
dest++;
|
||||
if (dest >= wmsCount) break;
|
||||
}
|
||||
|
||||
if (dest >= wmsCount) break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int activatedWMsCount = Math.Min(wmsCount, uiBoxesCount);
|
||||
|
||||
for (int i = 0; i < activatedWMsCount; i++)
|
||||
{
|
||||
labels[i].Visible = true;
|
||||
checkBoxes[i].Visible = true;
|
||||
pictures[i].Visible = true;
|
||||
serialNrBoxes[i].Visible = true;
|
||||
|
||||
labels[i].Text = (i + 1).ToString();
|
||||
enabledSerialNrBoxes.Add(serialNrBoxes[i]);
|
||||
}
|
||||
}
|
||||
|
||||
int xMax = 0;
|
||||
int yMax = 0;
|
||||
foreach (var tb in enabledSerialNrBoxes)
|
||||
{
|
||||
if (tb.Left + tb.Width > xMax) xMax = tb.Left + tb.Width;
|
||||
if (tb.Top + tb.Height > yMax) yMax = tb.Top + tb.Height;
|
||||
}
|
||||
|
||||
right = xMax;
|
||||
bottom = yMax;
|
||||
return enabledSerialNrBoxes;
|
||||
}
|
||||
|
||||
///
|
||||
/// Set checkbox states accroding to TBF program level configuration
|
||||
///
|
||||
void SetCheckBoxStates(long optoHeadsConfig)
|
||||
{
|
||||
for (int i = 0; i < DataStreamsCount; i++)
|
||||
{
|
||||
if ((optoHeadsConfig & (1L << i)) == 0)
|
||||
{
|
||||
/// Opto head is disabled in configuration
|
||||
checkBoxes[i].Checked = false;
|
||||
checkBoxes[i].Enabled = false;
|
||||
pictures[i].BackColor = DisabledColor;
|
||||
serialNrBoxes[i].Text = Strings.Disabled_in_configuration;
|
||||
SNText[i] = string.Empty;
|
||||
Disabled[i] = waterMeters[i].Disabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
/// Opto head is enabled
|
||||
checkBoxes[i].Checked = true;
|
||||
checkBoxes[i].Enabled = true;
|
||||
Disabled[i] = waterMeters[i].Disabled = false;
|
||||
|
||||
if (string.IsNullOrEmpty(SNText[i]))
|
||||
{
|
||||
serialNrBoxes[i].Text = string.Empty;
|
||||
pictures[i].BackColor = InitialColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
serialNrBoxes[i].Text = SNText[i];
|
||||
pictures[i].BackColor = OptoOKColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Worker thread
|
||||
/// </summary>
|
||||
void Worker()
|
||||
{
|
||||
do
|
||||
{
|
||||
for (int wmNr0 = 0; wmNr0 < DataStreamsCount; wmNr0++)
|
||||
{
|
||||
if (formCompleted) break;
|
||||
|
||||
bool isLast = (wmNr0 == DataStreamsCount - 1);
|
||||
|
||||
if (!Disabled[wmNr0])
|
||||
{
|
||||
OnOpenConnStarted(this, new OpenConnectionEventArgs(wmNr0, isLast, waterMeters[wmNr0]));
|
||||
string waterMeterID;
|
||||
bool connected = mefImport.OpenConnection(wmNr0, "", out waterMeterID);
|
||||
log.WarnFormat("{0} : mefImport.OpenConnection({1}, ...) returned {2}, ID={3}", Name, wmNr0, connected, waterMeterID);
|
||||
if (!formCompleted)
|
||||
{
|
||||
OnOpenConnCompleted(this, new OpenConnectionEventArgs(wmNr0, isLast, waterMeters[wmNr0], connected, waterMeterID));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!formCompleted)
|
||||
{
|
||||
OnOpenConnCompleted(this, new OpenConnectionEventArgs(wmNr0, isLast, waterMeters[wmNr0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
while (!formCompleted);
|
||||
}
|
||||
|
||||
|
||||
private void checkBoxImage1_Click(object sender, EventArgs e) { ProcessCheckBoxClick(checkBoxImage1); }
|
||||
private void checkBoxImage2_Click(object sender, EventArgs e) { ProcessCheckBoxClick(checkBoxImage2); }
|
||||
private void checkBoxImage3_Click(object sender, EventArgs e) { ProcessCheckBoxClick(checkBoxImage3); }
|
||||
private void checkBoxImage4_Click(object sender, EventArgs e) { ProcessCheckBoxClick(checkBoxImage4); }
|
||||
private void checkBoxImage5_Click(object sender, EventArgs e) { ProcessCheckBoxClick(checkBoxImage5); }
|
||||
private void checkBoxImage6_Click(object sender, EventArgs e) { ProcessCheckBoxClick(checkBoxImage6); }
|
||||
private void checkBoxImage7_Click(object sender, EventArgs e) { ProcessCheckBoxClick(checkBoxImage7); }
|
||||
private void checkBoxImage8_Click(object sender, EventArgs e) { ProcessCheckBoxClick(checkBoxImage8); }
|
||||
private void checkBoxImage9_Click(object sender, EventArgs e) { ProcessCheckBoxClick(checkBoxImage9); }
|
||||
private void checkBoxImage10_Click(object sender, EventArgs e) { ProcessCheckBoxClick(checkBoxImage10); }
|
||||
private void checkBoxImage11_Click(object sender, EventArgs e) { ProcessCheckBoxClick(checkBoxImage11); }
|
||||
private void checkBoxImage12_Click(object sender, EventArgs e) { ProcessCheckBoxClick(checkBoxImage12); }
|
||||
private void checkBoxImage13_Click(object sender, EventArgs e) { ProcessCheckBoxClick(checkBoxImage13); }
|
||||
private void checkBoxImage14_Click(object sender, EventArgs e) { ProcessCheckBoxClick(checkBoxImage14); }
|
||||
private void checkBoxImage15_Click(object sender, EventArgs e) { ProcessCheckBoxClick(checkBoxImage15); }
|
||||
private void checkBoxImage16_Click(object sender, EventArgs e) { ProcessCheckBoxClick(checkBoxImage16); }
|
||||
private void checkBoxImage17_Click(object sender, EventArgs e) { ProcessCheckBoxClick(checkBoxImage17); }
|
||||
private void checkBoxImage18_Click(object sender, EventArgs e) { ProcessCheckBoxClick(checkBoxImage18); }
|
||||
private void checkBoxImage19_Click(object sender, EventArgs e) { ProcessCheckBoxClick(checkBoxImage19); }
|
||||
private void checkBoxImage20_Click(object sender, EventArgs e) { ProcessCheckBoxClick(checkBoxImage20); }
|
||||
private void checkBoxImage21_Click(object sender, EventArgs e) { ProcessCheckBoxClick(checkBoxImage21); }
|
||||
private void checkBoxImage22_Click(object sender, EventArgs e) { ProcessCheckBoxClick(checkBoxImage22); }
|
||||
private void checkBoxImage23_Click(object sender, EventArgs e) { ProcessCheckBoxClick(checkBoxImage23); }
|
||||
private void checkBoxImage24_Click(object sender, EventArgs e) { ProcessCheckBoxClick(checkBoxImage24); }
|
||||
|
||||
void ProcessCheckBoxClick(CheckBoxImage checkBox)
|
||||
{
|
||||
for (int ix = 0; ix < DataStreamsCount; ix++)
|
||||
{
|
||||
if (checkBoxes[ix] == checkBox)
|
||||
{
|
||||
Disabled[ix] = waterMeters[ix].Disabled ? true : !checkBoxes[ix].Checked;
|
||||
CheckAllOK();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void serialNrBox1_TextChanged(object sender, EventArgs e) { checkBoxImage1.Checked = true; }
|
||||
private void serialNrBox2_TextChanged(object sender, EventArgs e) { checkBoxImage2.Checked = true; }
|
||||
private void serialNrBox3_TextChanged(object sender, EventArgs e) { checkBoxImage3.Checked = true; }
|
||||
private void serialNrBox4_TextChanged(object sender, EventArgs e) { checkBoxImage4.Checked = true; }
|
||||
private void serialNrBox5_TextChanged(object sender, EventArgs e) { checkBoxImage5.Checked = true; }
|
||||
private void serialNrBox6_TextChanged(object sender, EventArgs e) { checkBoxImage6.Checked = true; }
|
||||
private void serialNrBox7_TextChanged(object sender, EventArgs e) { checkBoxImage7.Checked = true; }
|
||||
private void serialNrBox8_TextChanged(object sender, EventArgs e) { checkBoxImage8.Checked = true; }
|
||||
private void serialNrBox9_TextChanged(object sender, EventArgs e) { checkBoxImage9.Checked = true; }
|
||||
private void serialNrBox10_TextChanged(object sender, EventArgs e) { checkBoxImage10.Checked = true; }
|
||||
private void serialNrBox11_TextChanged(object sender, EventArgs e) { checkBoxImage11.Checked = true; }
|
||||
private void serialNrBox12_TextChanged(object sender, EventArgs e) { checkBoxImage12.Checked = true; }
|
||||
private void serialNrBox13_TextChanged(object sender, EventArgs e) { checkBoxImage13.Checked = true; }
|
||||
private void serialNrBox14_TextChanged(object sender, EventArgs e) { checkBoxImage14.Checked = true; }
|
||||
private void serialNrBox15_TextChanged(object sender, EventArgs e) { checkBoxImage15.Checked = true; }
|
||||
private void serialNrBox16_TextChanged(object sender, EventArgs e) { checkBoxImage16.Checked = true; }
|
||||
private void serialNrBox17_TextChanged(object sender, EventArgs e) { checkBoxImage17.Checked = true; }
|
||||
private void serialNrBox18_TextChanged(object sender, EventArgs e) { checkBoxImage18.Checked = true; }
|
||||
private void serialNrBox19_TextChanged(object sender, EventArgs e) { checkBoxImage19.Checked = true; }
|
||||
private void serialNrBox20_TextChanged(object sender, EventArgs e) { checkBoxImage20.Checked = true; }
|
||||
private void serialNrBox21_TextChanged(object sender, EventArgs e) { checkBoxImage21.Checked = true; }
|
||||
private void serialNrBox22_TextChanged(object sender, EventArgs e) { checkBoxImage22.Checked = true; }
|
||||
private void serialNrBox23_TextChanged(object sender, EventArgs e) { checkBoxImage23.Checked = true; }
|
||||
private void serialNrBox24_TextChanged(object sender, EventArgs e) { checkBoxImage24.Checked = true; }
|
||||
|
||||
private void serialNrBox1_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, serialNrBox1); }
|
||||
private void serialNrBox2_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, serialNrBox2); }
|
||||
private void serialNrBox3_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, serialNrBox3); }
|
||||
private void serialNrBox4_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, serialNrBox4); }
|
||||
private void serialNrBox5_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, serialNrBox5); }
|
||||
private void serialNrBox6_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, serialNrBox6); }
|
||||
private void serialNrBox7_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, serialNrBox7); }
|
||||
private void serialNrBox8_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, serialNrBox8); }
|
||||
private void serialNrBox9_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, serialNrBox9); }
|
||||
private void serialNrBox10_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, serialNrBox10); }
|
||||
private void serialNrBox11_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, serialNrBox11); }
|
||||
private void serialNrBox12_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, serialNrBox12); }
|
||||
private void serialNrBox13_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, serialNrBox13); }
|
||||
private void serialNrBox14_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, serialNrBox14); }
|
||||
private void serialNrBox15_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, serialNrBox15); }
|
||||
private void serialNrBox16_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, serialNrBox16); }
|
||||
private void serialNrBox17_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, serialNrBox17); }
|
||||
private void serialNrBox18_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, serialNrBox18); }
|
||||
private void serialNrBox19_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, serialNrBox19); }
|
||||
private void serialNrBox20_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, serialNrBox20); }
|
||||
private void serialNrBox21_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, serialNrBox21); }
|
||||
private void serialNrBox22_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, serialNrBox22); }
|
||||
private void serialNrBox23_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, serialNrBox23); }
|
||||
private void serialNrBox24_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, serialNrBox24); }
|
||||
|
||||
/// <summary>
|
||||
/// Process a key press within any enabled text boxe
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
/// <param name="currentFocusOwner">TextBox control which received the event</param>
|
||||
private void ProcKeyPress(object sender, KeyPressEventArgs e, TextBox currentFocusOwner)
|
||||
{
|
||||
if (e.KeyChar == '+')
|
||||
{
|
||||
/// Process '+' key ..... Form completed
|
||||
okButton_Click(sender, e);
|
||||
}
|
||||
if (e.KeyChar == '\r')
|
||||
{
|
||||
/// Process <enter> key ..... Next text field
|
||||
if (enabledSerialNrBoxes.Count < 2) return; /// There is just one enabled textbox
|
||||
|
||||
for (int i = 0; i < enabledSerialNrBoxes.Count; i++)
|
||||
{
|
||||
if (enabledSerialNrBoxes[i] == currentFocusOwner)
|
||||
{
|
||||
/// Change focus to the next enabled text box
|
||||
enabledSerialNrBoxes[(i + 1) % enabledSerialNrBoxes.Count].Focus();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void allCheckBox_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
foreach (var cb in checkBoxes)
|
||||
{
|
||||
cb.Checked = allCheckBox.Checked;
|
||||
}
|
||||
}
|
||||
|
||||
#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);
|
||||
};
|
||||
}
|
||||
|
||||
private void OnForceClose(object sender, EventArgs args)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Called when communication with one watermeter is completed
|
||||
/// </summary>
|
||||
public static void OnOpenConnStarted(object sender, OpenConnectionEventArgs data)
|
||||
{
|
||||
if (OpenConnStartedHandler == null) return;
|
||||
try { OpenConnStartedHandler(sender, data); }
|
||||
catch (Exception e) { log.Error("OpenConnStartedHandler(...) failed", e); }
|
||||
}
|
||||
public static event EventHandler<OpenConnectionEventArgs> OpenConnStartedHandler;
|
||||
|
||||
void DoOnOpenConnStarted(object sender, OpenConnectionEventArgs data)
|
||||
{
|
||||
busyIx = data.WMNr0;
|
||||
pictures[busyIx].BackColor = BusyColor;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when communication with one watermeter is completed
|
||||
/// </summary>
|
||||
public static void OnOpenConnCompleted(object sender, OpenConnectionEventArgs data)
|
||||
{
|
||||
if (OpenConnCompletedHandler == null) return;
|
||||
try { OpenConnCompletedHandler(sender, data); }
|
||||
catch (Exception e) { log.Error("OpenConnCompletedHandler(...) failed", e); }
|
||||
}
|
||||
public static event EventHandler<OpenConnectionEventArgs> OpenConnCompletedHandler;
|
||||
|
||||
void DoOnOpenConnCompleted(object sender, OpenConnectionEventArgs data)
|
||||
{
|
||||
busyIx = -1;
|
||||
int ix = data.WMNr0;
|
||||
|
||||
if (data.Wm != null)
|
||||
{
|
||||
if (data.Wm.Disabled)
|
||||
{
|
||||
/// Disabled in configuration
|
||||
SNText[ix] = Strings.Disabled_in_configuration;
|
||||
pictures[ix].BackColor = DisabledColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
serialNrBoxes[ix].Text = SNText[ix] = string.IsNullOrEmpty(data.WaterMeterID) ? string.Empty : data.WaterMeterID;
|
||||
pictures[ix].BackColor = data.Connected ? OptoOKColor : OptoNokColor;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
serialNrBoxes[ix].Text = SNText[ix] = string.Empty;
|
||||
pictures[ix].BackColor = OptoNokColor;
|
||||
}
|
||||
|
||||
CheckAllOK();
|
||||
}
|
||||
|
||||
void CheckAllOK()
|
||||
{
|
||||
bool allOk = true;
|
||||
for (int i = 0; i < DataStreamsCount; i++)
|
||||
{
|
||||
if (!Disabled[i] && string.IsNullOrEmpty(SNText[i]))
|
||||
{
|
||||
allOk = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (allOk) okButton_Click(this, null);
|
||||
}
|
||||
|
||||
void okButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
formCompleted = true;
|
||||
|
||||
PurchaseOrder = orderComboBox.Text;
|
||||
for (int i = 0; i < DataStreamsCount; i++)
|
||||
{
|
||||
if (SNText != null && SNText.Length > i) SNText[i] = serialNrBoxes[i].Text;
|
||||
if (Disabled != null && Disabled.Length > i) Disabled[i] = !checkBoxes[i].Checked;
|
||||
|
||||
if (waterMeters != null && waterMeters.Count > i && waterMeters[i] != null && !waterMeters[i].Disabled)
|
||||
{
|
||||
waterMeters[i].SerialNr = serialNrBoxes[i].Text;
|
||||
waterMeters[i].Disabled = !checkBoxes[i].Checked;
|
||||
}
|
||||
}
|
||||
|
||||
Program.LocalSettings.UpdateHistory(orderComboBox.Text, ref Program.LocalSettings.PurchaseOrderHistory);
|
||||
Program.LocalSettings.LastSNTexts = SNText;
|
||||
|
||||
Close();
|
||||
}
|
||||
|
||||
void retryButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
SetCheckBoxStates(Program.LocalSettings.OptoHeadsEnabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
+653
@@ -0,0 +1,653 @@
|
||||
///
|
||||
/// Copyright (c) 2021 Sensus Slovensko a.s.
|
||||
///
|
||||
namespace TBF.Rig.DataEntry.DataStream
|
||||
{
|
||||
partial class CycleEndForm
|
||||
{
|
||||
/// <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.textBox2 = new System.Windows.Forms.TextBox();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.textBox1 = new System.Windows.Forms.TextBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.okButton = new System.Windows.Forms.Button();
|
||||
this.textBox3 = new System.Windows.Forms.TextBox();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.textBox4 = new System.Windows.Forms.TextBox();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.textBox5 = new System.Windows.Forms.TextBox();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.textBox6 = new System.Windows.Forms.TextBox();
|
||||
this.label6 = new System.Windows.Forms.Label();
|
||||
this.textBox7 = new System.Windows.Forms.TextBox();
|
||||
this.label7 = new System.Windows.Forms.Label();
|
||||
this.textBox8 = new System.Windows.Forms.TextBox();
|
||||
this.label8 = new System.Windows.Forms.Label();
|
||||
this.textBox9 = new System.Windows.Forms.TextBox();
|
||||
this.label9 = new System.Windows.Forms.Label();
|
||||
this.textBox10 = new System.Windows.Forms.TextBox();
|
||||
this.label10 = new System.Windows.Forms.Label();
|
||||
this.textBox11 = new System.Windows.Forms.TextBox();
|
||||
this.label11 = new System.Windows.Forms.Label();
|
||||
this.textBox12 = new System.Windows.Forms.TextBox();
|
||||
this.label12 = new System.Windows.Forms.Label();
|
||||
this.textBox13 = new System.Windows.Forms.TextBox();
|
||||
this.label13 = new System.Windows.Forms.Label();
|
||||
this.textBox14 = new System.Windows.Forms.TextBox();
|
||||
this.label14 = new System.Windows.Forms.Label();
|
||||
this.textBox15 = new System.Windows.Forms.TextBox();
|
||||
this.label15 = new System.Windows.Forms.Label();
|
||||
this.textBox16 = new System.Windows.Forms.TextBox();
|
||||
this.label16 = new System.Windows.Forms.Label();
|
||||
this.textBox17 = new System.Windows.Forms.TextBox();
|
||||
this.label17 = new System.Windows.Forms.Label();
|
||||
this.textBox18 = new System.Windows.Forms.TextBox();
|
||||
this.label18 = new System.Windows.Forms.Label();
|
||||
this.textBox19 = new System.Windows.Forms.TextBox();
|
||||
this.label19 = new System.Windows.Forms.Label();
|
||||
this.textBox20 = new System.Windows.Forms.TextBox();
|
||||
this.label20 = new System.Windows.Forms.Label();
|
||||
this.textBox21 = new System.Windows.Forms.TextBox();
|
||||
this.label21 = new System.Windows.Forms.Label();
|
||||
this.textBox22 = new System.Windows.Forms.TextBox();
|
||||
this.label22 = new System.Windows.Forms.Label();
|
||||
this.textBox23 = new System.Windows.Forms.TextBox();
|
||||
this.label23 = new System.Windows.Forms.Label();
|
||||
this.textBox24 = new System.Windows.Forms.TextBox();
|
||||
this.label24 = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// textBox2
|
||||
//
|
||||
this.textBox2.Location = new System.Drawing.Point(205, 66);
|
||||
this.textBox2.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
|
||||
this.textBox2.Name = "textBox2";
|
||||
this.textBox2.Size = new System.Drawing.Size(169, 27);
|
||||
this.textBox2.TabIndex = 1;
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(38, 71);
|
||||
this.label2.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(62, 18);
|
||||
this.label2.TabIndex = 0;
|
||||
this.label2.Text = "Stand:";
|
||||
//
|
||||
// textBox1
|
||||
//
|
||||
this.textBox1.Location = new System.Drawing.Point(205, 30);
|
||||
this.textBox1.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
|
||||
this.textBox1.Name = "textBox1";
|
||||
this.textBox1.Size = new System.Drawing.Size(169, 27);
|
||||
this.textBox1.TabIndex = 1;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(38, 35);
|
||||
this.label1.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(62, 18);
|
||||
this.label1.TabIndex = 0;
|
||||
this.label1.Text = "Stand:";
|
||||
//
|
||||
// okButton
|
||||
//
|
||||
this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
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(832, 30);
|
||||
this.okButton.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
|
||||
this.okButton.Name = "okButton";
|
||||
this.okButton.Size = new System.Drawing.Size(90, 60);
|
||||
this.okButton.TabIndex = 7;
|
||||
this.okButton.Text = "OK";
|
||||
this.okButton.UseVisualStyleBackColor = true;
|
||||
this.okButton.Click += new System.EventHandler(this.okButton_Click);
|
||||
//
|
||||
// textBox3
|
||||
//
|
||||
this.textBox3.Location = new System.Drawing.Point(205, 102);
|
||||
this.textBox3.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
|
||||
this.textBox3.Name = "textBox3";
|
||||
this.textBox3.Size = new System.Drawing.Size(169, 27);
|
||||
this.textBox3.TabIndex = 1;
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(38, 107);
|
||||
this.label3.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(62, 18);
|
||||
this.label3.TabIndex = 0;
|
||||
this.label3.Text = "Stand:";
|
||||
//
|
||||
// textBox4
|
||||
//
|
||||
this.textBox4.Location = new System.Drawing.Point(205, 138);
|
||||
this.textBox4.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
|
||||
this.textBox4.Name = "textBox4";
|
||||
this.textBox4.Size = new System.Drawing.Size(169, 27);
|
||||
this.textBox4.TabIndex = 1;
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Location = new System.Drawing.Point(38, 143);
|
||||
this.label4.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(62, 18);
|
||||
this.label4.TabIndex = 0;
|
||||
this.label4.Text = "Stand:";
|
||||
//
|
||||
// textBox5
|
||||
//
|
||||
this.textBox5.Location = new System.Drawing.Point(205, 174);
|
||||
this.textBox5.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
|
||||
this.textBox5.Name = "textBox5";
|
||||
this.textBox5.Size = new System.Drawing.Size(169, 27);
|
||||
this.textBox5.TabIndex = 1;
|
||||
//
|
||||
// label5
|
||||
//
|
||||
this.label5.AutoSize = true;
|
||||
this.label5.Location = new System.Drawing.Point(38, 179);
|
||||
this.label5.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
|
||||
this.label5.Name = "label5";
|
||||
this.label5.Size = new System.Drawing.Size(62, 18);
|
||||
this.label5.TabIndex = 0;
|
||||
this.label5.Text = "Stand:";
|
||||
//
|
||||
// textBox6
|
||||
//
|
||||
this.textBox6.Location = new System.Drawing.Point(205, 210);
|
||||
this.textBox6.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
|
||||
this.textBox6.Name = "textBox6";
|
||||
this.textBox6.Size = new System.Drawing.Size(169, 27);
|
||||
this.textBox6.TabIndex = 1;
|
||||
//
|
||||
// label6
|
||||
//
|
||||
this.label6.AutoSize = true;
|
||||
this.label6.Location = new System.Drawing.Point(38, 215);
|
||||
this.label6.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
|
||||
this.label6.Name = "label6";
|
||||
this.label6.Size = new System.Drawing.Size(62, 18);
|
||||
this.label6.TabIndex = 0;
|
||||
this.label6.Text = "Stand:";
|
||||
//
|
||||
// textBox7
|
||||
//
|
||||
this.textBox7.Location = new System.Drawing.Point(205, 246);
|
||||
this.textBox7.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
|
||||
this.textBox7.Name = "textBox7";
|
||||
this.textBox7.Size = new System.Drawing.Size(169, 27);
|
||||
this.textBox7.TabIndex = 9;
|
||||
//
|
||||
// label7
|
||||
//
|
||||
this.label7.AutoSize = true;
|
||||
this.label7.Location = new System.Drawing.Point(38, 251);
|
||||
this.label7.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
|
||||
this.label7.Name = "label7";
|
||||
this.label7.Size = new System.Drawing.Size(62, 18);
|
||||
this.label7.TabIndex = 8;
|
||||
this.label7.Text = "Stand:";
|
||||
//
|
||||
// textBox8
|
||||
//
|
||||
this.textBox8.Location = new System.Drawing.Point(205, 282);
|
||||
this.textBox8.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
|
||||
this.textBox8.Name = "textBox8";
|
||||
this.textBox8.Size = new System.Drawing.Size(169, 27);
|
||||
this.textBox8.TabIndex = 11;
|
||||
//
|
||||
// label8
|
||||
//
|
||||
this.label8.AutoSize = true;
|
||||
this.label8.Location = new System.Drawing.Point(38, 287);
|
||||
this.label8.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
|
||||
this.label8.Name = "label8";
|
||||
this.label8.Size = new System.Drawing.Size(62, 18);
|
||||
this.label8.TabIndex = 10;
|
||||
this.label8.Text = "Stand:";
|
||||
//
|
||||
// textBox9
|
||||
//
|
||||
this.textBox9.Location = new System.Drawing.Point(205, 318);
|
||||
this.textBox9.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
|
||||
this.textBox9.Name = "textBox9";
|
||||
this.textBox9.Size = new System.Drawing.Size(169, 27);
|
||||
this.textBox9.TabIndex = 13;
|
||||
//
|
||||
// label9
|
||||
//
|
||||
this.label9.AutoSize = true;
|
||||
this.label9.Location = new System.Drawing.Point(38, 323);
|
||||
this.label9.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
|
||||
this.label9.Name = "label9";
|
||||
this.label9.Size = new System.Drawing.Size(62, 18);
|
||||
this.label9.TabIndex = 12;
|
||||
this.label9.Text = "Stand:";
|
||||
//
|
||||
// textBox10
|
||||
//
|
||||
this.textBox10.Location = new System.Drawing.Point(205, 354);
|
||||
this.textBox10.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
|
||||
this.textBox10.Name = "textBox10";
|
||||
this.textBox10.Size = new System.Drawing.Size(169, 27);
|
||||
this.textBox10.TabIndex = 15;
|
||||
//
|
||||
// label10
|
||||
//
|
||||
this.label10.AutoSize = true;
|
||||
this.label10.Location = new System.Drawing.Point(38, 359);
|
||||
this.label10.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
|
||||
this.label10.Name = "label10";
|
||||
this.label10.Size = new System.Drawing.Size(62, 18);
|
||||
this.label10.TabIndex = 14;
|
||||
this.label10.Text = "Stand:";
|
||||
//
|
||||
// textBox11
|
||||
//
|
||||
this.textBox11.Location = new System.Drawing.Point(205, 390);
|
||||
this.textBox11.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
|
||||
this.textBox11.Name = "textBox11";
|
||||
this.textBox11.Size = new System.Drawing.Size(169, 27);
|
||||
this.textBox11.TabIndex = 17;
|
||||
//
|
||||
// label11
|
||||
//
|
||||
this.label11.AutoSize = true;
|
||||
this.label11.Location = new System.Drawing.Point(38, 395);
|
||||
this.label11.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
|
||||
this.label11.Name = "label11";
|
||||
this.label11.Size = new System.Drawing.Size(62, 18);
|
||||
this.label11.TabIndex = 16;
|
||||
this.label11.Text = "Stand:";
|
||||
//
|
||||
// textBox12
|
||||
//
|
||||
this.textBox12.Location = new System.Drawing.Point(205, 426);
|
||||
this.textBox12.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
|
||||
this.textBox12.Name = "textBox12";
|
||||
this.textBox12.Size = new System.Drawing.Size(169, 27);
|
||||
this.textBox12.TabIndex = 19;
|
||||
//
|
||||
// label12
|
||||
//
|
||||
this.label12.AutoSize = true;
|
||||
this.label12.Location = new System.Drawing.Point(38, 431);
|
||||
this.label12.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
|
||||
this.label12.Name = "label12";
|
||||
this.label12.Size = new System.Drawing.Size(62, 18);
|
||||
this.label12.TabIndex = 18;
|
||||
this.label12.Text = "Stand:";
|
||||
//
|
||||
// textBox13
|
||||
//
|
||||
this.textBox13.Location = new System.Drawing.Point(623, 30);
|
||||
this.textBox13.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
|
||||
this.textBox13.Name = "textBox13";
|
||||
this.textBox13.Size = new System.Drawing.Size(169, 27);
|
||||
this.textBox13.TabIndex = 21;
|
||||
//
|
||||
// label13
|
||||
//
|
||||
this.label13.AutoSize = true;
|
||||
this.label13.Location = new System.Drawing.Point(456, 35);
|
||||
this.label13.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
|
||||
this.label13.Name = "label13";
|
||||
this.label13.Size = new System.Drawing.Size(62, 18);
|
||||
this.label13.TabIndex = 20;
|
||||
this.label13.Text = "Stand:";
|
||||
//
|
||||
// textBox14
|
||||
//
|
||||
this.textBox14.Location = new System.Drawing.Point(623, 66);
|
||||
this.textBox14.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
|
||||
this.textBox14.Name = "textBox14";
|
||||
this.textBox14.Size = new System.Drawing.Size(169, 27);
|
||||
this.textBox14.TabIndex = 23;
|
||||
//
|
||||
// label14
|
||||
//
|
||||
this.label14.AutoSize = true;
|
||||
this.label14.Location = new System.Drawing.Point(456, 71);
|
||||
this.label14.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
|
||||
this.label14.Name = "label14";
|
||||
this.label14.Size = new System.Drawing.Size(62, 18);
|
||||
this.label14.TabIndex = 22;
|
||||
this.label14.Text = "Stand:";
|
||||
//
|
||||
// textBox15
|
||||
//
|
||||
this.textBox15.Location = new System.Drawing.Point(623, 102);
|
||||
this.textBox15.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
|
||||
this.textBox15.Name = "textBox15";
|
||||
this.textBox15.Size = new System.Drawing.Size(169, 27);
|
||||
this.textBox15.TabIndex = 25;
|
||||
//
|
||||
// label15
|
||||
//
|
||||
this.label15.AutoSize = true;
|
||||
this.label15.Location = new System.Drawing.Point(456, 107);
|
||||
this.label15.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
|
||||
this.label15.Name = "label15";
|
||||
this.label15.Size = new System.Drawing.Size(62, 18);
|
||||
this.label15.TabIndex = 24;
|
||||
this.label15.Text = "Stand:";
|
||||
//
|
||||
// textBox16
|
||||
//
|
||||
this.textBox16.Location = new System.Drawing.Point(623, 138);
|
||||
this.textBox16.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
|
||||
this.textBox16.Name = "textBox16";
|
||||
this.textBox16.Size = new System.Drawing.Size(169, 27);
|
||||
this.textBox16.TabIndex = 27;
|
||||
//
|
||||
// label16
|
||||
//
|
||||
this.label16.AutoSize = true;
|
||||
this.label16.Location = new System.Drawing.Point(456, 143);
|
||||
this.label16.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
|
||||
this.label16.Name = "label16";
|
||||
this.label16.Size = new System.Drawing.Size(62, 18);
|
||||
this.label16.TabIndex = 26;
|
||||
this.label16.Text = "Stand:";
|
||||
//
|
||||
// textBox17
|
||||
//
|
||||
this.textBox17.Location = new System.Drawing.Point(623, 174);
|
||||
this.textBox17.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
|
||||
this.textBox17.Name = "textBox17";
|
||||
this.textBox17.Size = new System.Drawing.Size(169, 27);
|
||||
this.textBox17.TabIndex = 29;
|
||||
//
|
||||
// label17
|
||||
//
|
||||
this.label17.AutoSize = true;
|
||||
this.label17.Location = new System.Drawing.Point(456, 179);
|
||||
this.label17.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
|
||||
this.label17.Name = "label17";
|
||||
this.label17.Size = new System.Drawing.Size(62, 18);
|
||||
this.label17.TabIndex = 28;
|
||||
this.label17.Text = "Stand:";
|
||||
//
|
||||
// textBox18
|
||||
//
|
||||
this.textBox18.Location = new System.Drawing.Point(623, 210);
|
||||
this.textBox18.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
|
||||
this.textBox18.Name = "textBox18";
|
||||
this.textBox18.Size = new System.Drawing.Size(169, 27);
|
||||
this.textBox18.TabIndex = 31;
|
||||
//
|
||||
// label18
|
||||
//
|
||||
this.label18.AutoSize = true;
|
||||
this.label18.Location = new System.Drawing.Point(456, 215);
|
||||
this.label18.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
|
||||
this.label18.Name = "label18";
|
||||
this.label18.Size = new System.Drawing.Size(62, 18);
|
||||
this.label18.TabIndex = 30;
|
||||
this.label18.Text = "Stand:";
|
||||
//
|
||||
// textBox19
|
||||
//
|
||||
this.textBox19.Location = new System.Drawing.Point(623, 246);
|
||||
this.textBox19.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
|
||||
this.textBox19.Name = "textBox19";
|
||||
this.textBox19.Size = new System.Drawing.Size(169, 27);
|
||||
this.textBox19.TabIndex = 33;
|
||||
//
|
||||
// label19
|
||||
//
|
||||
this.label19.AutoSize = true;
|
||||
this.label19.Location = new System.Drawing.Point(456, 251);
|
||||
this.label19.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
|
||||
this.label19.Name = "label19";
|
||||
this.label19.Size = new System.Drawing.Size(62, 18);
|
||||
this.label19.TabIndex = 32;
|
||||
this.label19.Text = "Stand:";
|
||||
//
|
||||
// textBox20
|
||||
//
|
||||
this.textBox20.Location = new System.Drawing.Point(623, 282);
|
||||
this.textBox20.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
|
||||
this.textBox20.Name = "textBox20";
|
||||
this.textBox20.Size = new System.Drawing.Size(169, 27);
|
||||
this.textBox20.TabIndex = 35;
|
||||
//
|
||||
// label20
|
||||
//
|
||||
this.label20.AutoSize = true;
|
||||
this.label20.Location = new System.Drawing.Point(456, 287);
|
||||
this.label20.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
|
||||
this.label20.Name = "label20";
|
||||
this.label20.Size = new System.Drawing.Size(62, 18);
|
||||
this.label20.TabIndex = 34;
|
||||
this.label20.Text = "Stand:";
|
||||
//
|
||||
// textBox21
|
||||
//
|
||||
this.textBox21.Location = new System.Drawing.Point(623, 318);
|
||||
this.textBox21.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
|
||||
this.textBox21.Name = "textBox21";
|
||||
this.textBox21.Size = new System.Drawing.Size(169, 27);
|
||||
this.textBox21.TabIndex = 37;
|
||||
//
|
||||
// label21
|
||||
//
|
||||
this.label21.AutoSize = true;
|
||||
this.label21.Location = new System.Drawing.Point(456, 323);
|
||||
this.label21.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
|
||||
this.label21.Name = "label21";
|
||||
this.label21.Size = new System.Drawing.Size(62, 18);
|
||||
this.label21.TabIndex = 36;
|
||||
this.label21.Text = "Stand:";
|
||||
//
|
||||
// textBox22
|
||||
//
|
||||
this.textBox22.Location = new System.Drawing.Point(623, 354);
|
||||
this.textBox22.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
|
||||
this.textBox22.Name = "textBox22";
|
||||
this.textBox22.Size = new System.Drawing.Size(169, 27);
|
||||
this.textBox22.TabIndex = 39;
|
||||
//
|
||||
// label22
|
||||
//
|
||||
this.label22.AutoSize = true;
|
||||
this.label22.Location = new System.Drawing.Point(456, 359);
|
||||
this.label22.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
|
||||
this.label22.Name = "label22";
|
||||
this.label22.Size = new System.Drawing.Size(62, 18);
|
||||
this.label22.TabIndex = 38;
|
||||
this.label22.Text = "Stand:";
|
||||
//
|
||||
// textBox23
|
||||
//
|
||||
this.textBox23.Location = new System.Drawing.Point(623, 390);
|
||||
this.textBox23.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
|
||||
this.textBox23.Name = "textBox23";
|
||||
this.textBox23.Size = new System.Drawing.Size(169, 27);
|
||||
this.textBox23.TabIndex = 41;
|
||||
//
|
||||
// label23
|
||||
//
|
||||
this.label23.AutoSize = true;
|
||||
this.label23.Location = new System.Drawing.Point(456, 395);
|
||||
this.label23.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
|
||||
this.label23.Name = "label23";
|
||||
this.label23.Size = new System.Drawing.Size(62, 18);
|
||||
this.label23.TabIndex = 40;
|
||||
this.label23.Text = "Stand:";
|
||||
//
|
||||
// textBox24
|
||||
//
|
||||
this.textBox24.Location = new System.Drawing.Point(623, 426);
|
||||
this.textBox24.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
|
||||
this.textBox24.Name = "textBox24";
|
||||
this.textBox24.Size = new System.Drawing.Size(169, 27);
|
||||
this.textBox24.TabIndex = 43;
|
||||
//
|
||||
// label24
|
||||
//
|
||||
this.label24.AutoSize = true;
|
||||
this.label24.Location = new System.Drawing.Point(456, 431);
|
||||
this.label24.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
|
||||
this.label24.Name = "label24";
|
||||
this.label24.Size = new System.Drawing.Size(62, 18);
|
||||
this.label24.TabIndex = 42;
|
||||
this.label24.Text = "Stand:";
|
||||
//
|
||||
// CycleEndForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 18F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.DarkGray;
|
||||
this.ClientSize = new System.Drawing.Size(959, 489);
|
||||
this.Controls.Add(this.textBox24);
|
||||
this.Controls.Add(this.label24);
|
||||
this.Controls.Add(this.textBox23);
|
||||
this.Controls.Add(this.label23);
|
||||
this.Controls.Add(this.textBox22);
|
||||
this.Controls.Add(this.label22);
|
||||
this.Controls.Add(this.textBox21);
|
||||
this.Controls.Add(this.label21);
|
||||
this.Controls.Add(this.textBox20);
|
||||
this.Controls.Add(this.label20);
|
||||
this.Controls.Add(this.textBox19);
|
||||
this.Controls.Add(this.label19);
|
||||
this.Controls.Add(this.textBox18);
|
||||
this.Controls.Add(this.label18);
|
||||
this.Controls.Add(this.textBox17);
|
||||
this.Controls.Add(this.label17);
|
||||
this.Controls.Add(this.textBox16);
|
||||
this.Controls.Add(this.label16);
|
||||
this.Controls.Add(this.textBox15);
|
||||
this.Controls.Add(this.label15);
|
||||
this.Controls.Add(this.textBox14);
|
||||
this.Controls.Add(this.label14);
|
||||
this.Controls.Add(this.textBox13);
|
||||
this.Controls.Add(this.label13);
|
||||
this.Controls.Add(this.textBox12);
|
||||
this.Controls.Add(this.label12);
|
||||
this.Controls.Add(this.textBox11);
|
||||
this.Controls.Add(this.label11);
|
||||
this.Controls.Add(this.textBox10);
|
||||
this.Controls.Add(this.label10);
|
||||
this.Controls.Add(this.textBox9);
|
||||
this.Controls.Add(this.label9);
|
||||
this.Controls.Add(this.textBox8);
|
||||
this.Controls.Add(this.label8);
|
||||
this.Controls.Add(this.textBox7);
|
||||
this.Controls.Add(this.label7);
|
||||
this.Controls.Add(this.textBox6);
|
||||
this.Controls.Add(this.label6);
|
||||
this.Controls.Add(this.textBox5);
|
||||
this.Controls.Add(this.label5);
|
||||
this.Controls.Add(this.textBox4);
|
||||
this.Controls.Add(this.label4);
|
||||
this.Controls.Add(this.textBox3);
|
||||
this.Controls.Add(this.label3);
|
||||
this.Controls.Add(this.textBox2);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.textBox1);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.okButton);
|
||||
this.Font = new System.Drawing.Font("Verdana", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
|
||||
this.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
|
||||
this.Name = "CycleEndForm";
|
||||
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Daten";
|
||||
this.TopMost = true;
|
||||
this.Load += new System.EventHandler(this.CycleEndForm_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TextBox textBox2;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.TextBox textBox1;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Button okButton;
|
||||
private System.Windows.Forms.TextBox textBox3;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.TextBox textBox4;
|
||||
private System.Windows.Forms.Label label4;
|
||||
private System.Windows.Forms.TextBox textBox5;
|
||||
private System.Windows.Forms.Label label5;
|
||||
private System.Windows.Forms.TextBox textBox6;
|
||||
private System.Windows.Forms.Label label6;
|
||||
private System.Windows.Forms.TextBox textBox7;
|
||||
private System.Windows.Forms.Label label7;
|
||||
private System.Windows.Forms.TextBox textBox8;
|
||||
private System.Windows.Forms.Label label8;
|
||||
private System.Windows.Forms.TextBox textBox9;
|
||||
private System.Windows.Forms.Label label9;
|
||||
private System.Windows.Forms.TextBox textBox10;
|
||||
private System.Windows.Forms.Label label10;
|
||||
private System.Windows.Forms.TextBox textBox11;
|
||||
private System.Windows.Forms.Label label11;
|
||||
private System.Windows.Forms.TextBox textBox12;
|
||||
private System.Windows.Forms.Label label12;
|
||||
private System.Windows.Forms.TextBox textBox13;
|
||||
private System.Windows.Forms.Label label13;
|
||||
private System.Windows.Forms.TextBox textBox14;
|
||||
private System.Windows.Forms.Label label14;
|
||||
private System.Windows.Forms.TextBox textBox15;
|
||||
private System.Windows.Forms.Label label15;
|
||||
private System.Windows.Forms.TextBox textBox16;
|
||||
private System.Windows.Forms.Label label16;
|
||||
private System.Windows.Forms.TextBox textBox17;
|
||||
private System.Windows.Forms.Label label17;
|
||||
private System.Windows.Forms.TextBox textBox18;
|
||||
private System.Windows.Forms.Label label18;
|
||||
private System.Windows.Forms.TextBox textBox19;
|
||||
private System.Windows.Forms.Label label19;
|
||||
private System.Windows.Forms.TextBox textBox20;
|
||||
private System.Windows.Forms.Label label20;
|
||||
private System.Windows.Forms.TextBox textBox21;
|
||||
private System.Windows.Forms.Label label21;
|
||||
private System.Windows.Forms.TextBox textBox22;
|
||||
private System.Windows.Forms.Label label22;
|
||||
private System.Windows.Forms.TextBox textBox23;
|
||||
private System.Windows.Forms.Label label23;
|
||||
private System.Windows.Forms.TextBox textBox24;
|
||||
private System.Windows.Forms.Label label24;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,155 @@
|
||||
///
|
||||
/// Copyright (c) 2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using log4net;
|
||||
using TBF.Resources;
|
||||
|
||||
namespace TBF.Rig.DataEntry.DataStream
|
||||
{
|
||||
public partial class CycleEndForm : Form, GenericDevices.IHasCompleted
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(CycleEndForm));
|
||||
|
||||
/// <summary> Number of text boxes for serial numbers </summary>
|
||||
public readonly int WaterMetersCount;
|
||||
readonly int lineSize;
|
||||
|
||||
// To be retrieved after the form closes
|
||||
public string[] EndStateText;
|
||||
|
||||
// Set to 'true' when the form closes
|
||||
public bool Completed { get { return completed; } }
|
||||
bool completed;
|
||||
|
||||
int textBoxesCount;
|
||||
Label[] labels;
|
||||
TextBox[] textBoxes;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="waterMetersCount">Number of text boxes for serial numbers</param>
|
||||
public CycleEndForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
ControlBox = false;
|
||||
|
||||
labels = new Label[]
|
||||
{
|
||||
label1, label2, label3, label4, label5, label6, label7, label8, label9, label10,
|
||||
label11, label12, label13, label14, label15, label16, label17, label18, label19, label20,
|
||||
label21, label22, label23, label24,
|
||||
};
|
||||
textBoxes = new TextBox[]
|
||||
{
|
||||
textBox1, textBox2, textBox3, textBox4, textBox5, textBox6,
|
||||
textBox7, textBox8, textBox9, textBox10, textBox11, textBox12,
|
||||
textBox13, textBox14, textBox15, textBox16, textBox17, textBox18,
|
||||
textBox19, textBox20, textBox21, textBox22, textBox23, textBox24,
|
||||
};
|
||||
textBoxesCount = textBoxes.Length;
|
||||
this.WaterMetersCount = textBoxesCount;
|
||||
this.lineSize = textBoxesCount / 2;
|
||||
|
||||
completed = false;
|
||||
StartForceCloseHandler();
|
||||
}
|
||||
|
||||
/// <summary> Parameterless constructor for 3 watermeters </summary>
|
||||
public CycleEndForm(int waterMetersCount, int lineSize)
|
||||
: this()
|
||||
{
|
||||
this.WaterMetersCount = waterMetersCount;
|
||||
this.lineSize = lineSize;
|
||||
ShuffleTextBoxes(waterMetersCount, lineSize);
|
||||
EndStateText = new string[WaterMetersCount];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Make sure the layout of labels/text boxes on the screen
|
||||
/// corresponds to the layout of watermeters of the test bench.
|
||||
/// </summary>
|
||||
/// <param name="wmsCount">Number of watermeters</param>
|
||||
/// <param name="lineSize">Number of watermeters in one line</param>
|
||||
void ShuffleTextBoxes(int wmsCount, int lineSize)
|
||||
{
|
||||
if (wmsCount < textBoxesCount && lineSize > 0)
|
||||
{
|
||||
int nrLines = (wmsCount + lineSize - 1) / lineSize;
|
||||
int gap = (textBoxesCount - wmsCount) / nrLines;
|
||||
|
||||
int dest = 0;
|
||||
for (int l = 0; l < nrLines; l++)
|
||||
{
|
||||
for (int i = 0; i < lineSize; i++)
|
||||
{
|
||||
labels[dest] = labels[l * lineSize + l * gap + i];
|
||||
textBoxes[dest] = textBoxes[l * lineSize + l * gap + i];
|
||||
dest++;
|
||||
}
|
||||
}
|
||||
textBoxesCount = wmsCount;
|
||||
}
|
||||
}
|
||||
|
||||
private void CycleEndForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
Localize();
|
||||
|
||||
Height = 60 + 36 * lineSize;
|
||||
|
||||
for (int i = 0; i < textBoxesCount; i++)
|
||||
{
|
||||
if (i >= WaterMetersCount)
|
||||
{
|
||||
labels[i].Visible = false;
|
||||
textBoxes[i].Visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Localize()
|
||||
{
|
||||
Text = Strings.Data;
|
||||
okButton.Text = Strings.OkBtnText;
|
||||
|
||||
for (int i = 0; i < WaterMetersCount; i++)
|
||||
{
|
||||
labels[i].Text = string.Format("{0} {1}:", Strings.Water_Meter, (i + 1).ToString());
|
||||
}
|
||||
}
|
||||
|
||||
private void okButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
for (int i = 0; i < WaterMetersCount; i++)
|
||||
{
|
||||
EndStateText[i] = textBoxes[i].Text;
|
||||
}
|
||||
|
||||
completed = true;
|
||||
Close();
|
||||
}
|
||||
|
||||
#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
|
||||
}
|
||||
}
|
||||
@@ -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>
|
||||
@@ -0,0 +1,267 @@
|
||||
///
|
||||
/// Copyright (c) 2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using TBF.Rig.GenericDevices;
|
||||
using TBF.Rig.RegisterReaders.DataStream.MefImport;
|
||||
|
||||
namespace TBF.Rig.DataEntry.DataStream
|
||||
{
|
||||
public class EntryForm : ComponentBase, IOperation, IDataEntry, IHasCycleBeginForm, IHasCycleEndForm, IHasWMStatesForm
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(EntryForm));
|
||||
public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
|
||||
|
||||
public bool UsesCameras() { return false; }
|
||||
|
||||
readonly EntryFormCfg entryFormCfg;
|
||||
IRegReader[] regReaders;
|
||||
|
||||
MefImport mefImport;
|
||||
|
||||
/// <summary>
|
||||
/// Properties set by the Begin, End and WMStates form
|
||||
/// </summary>
|
||||
bool[] disabled; /// This array is shared between forms
|
||||
|
||||
double[] wmStartState;
|
||||
public double WMStartState(int wmNr) { return (wmNr >= 0 && wmNr < wmStartState.Length) ? wmStartState[wmNr] : 0; }
|
||||
|
||||
string[] wmStartStateStr;
|
||||
|
||||
double[] wmEndState;
|
||||
public double WMEndState(int wmNr) { return (wmNr >= 0 && wmNr < wmEndState.Length) ? wmEndState[wmNr] : 0; }
|
||||
|
||||
string[] wmCycleEndState;
|
||||
public string WMCycleEndState(int wmNr) { return (wmNr >= 0 && wmNr < wmCycleEndState.Length) ? wmCycleEndState[wmNr] : string.Empty; }
|
||||
|
||||
|
||||
System.Windows.Forms.Form modelessDlg;
|
||||
public bool Completed { get { return (modelessDlg is IHasCompleted) ? (modelessDlg as IHasCompleted).Completed : true; } }
|
||||
|
||||
double refVolume;
|
||||
double errLimLo;
|
||||
double errLimHi;
|
||||
|
||||
bool resultSaved; /// Set in Run() when results are saved
|
||||
|
||||
IList<Results.Entities.WaterMeter> waterMeters; /// Reference to ...ProcessData.BatchRslts.WaterMeters[]
|
||||
|
||||
public enum CurrentOp
|
||||
{
|
||||
None,
|
||||
ShowFormAtCycleBeginning,
|
||||
ShowFormAtCycleEnd,
|
||||
EnterTestStartStates,
|
||||
EnterTestEndStates,
|
||||
}
|
||||
|
||||
CurrentOp currentOp;
|
||||
|
||||
|
||||
public EntryForm() { }
|
||||
|
||||
public EntryForm(Generic.IComponentCfg cfg, IList<Generic.IComponent> components)
|
||||
: base(cfg)
|
||||
{
|
||||
entryFormCfg = cfg as EntryFormCfg;
|
||||
|
||||
mefImport = TbfComponents.FindComponent(cfg.ParentName, components) as MefImport;
|
||||
if (mefImport == null) throw new Exception("Cannot find " + Name + " parent");
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
disabled = new bool[TBF.Data.WMsCount];
|
||||
wmStartState = new double[TBF.Data.WMsCount];
|
||||
wmStartStateStr = new string[TBF.Data.WMsCount];
|
||||
wmEndState = new double[TBF.Data.WMsCount];
|
||||
wmCycleEndState = new string[TBF.Data.WMsCount];
|
||||
currentOp = CurrentOp.None;
|
||||
log.FatalFormat("{0} initialized: {1}", Name, this);
|
||||
}
|
||||
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowCycleBeginFormOp()
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
mefImport.CloseConnectionAll();
|
||||
currentOp = CurrentOp.ShowFormAtCycleBeginning;
|
||||
this.waterMeters = TBF.Rig.Sequences.ProcessData.BatchRslts.Batch.WaterMeters;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowCycleEndFormOp()
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
mefImport.CloseConnectionAll();
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowTestStartFormOp(IRegReader[] regReaders)
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
currentOp = CurrentOp.EnterTestStartStates;
|
||||
this.regReaders = regReaders;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowTestEndFormOp(IRegReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
currentOp = CurrentOp.EnterTestEndStates;
|
||||
this.regReaders = regReaders;
|
||||
this.refVolume = refVolume;
|
||||
this.errLimLo = errLimLo;
|
||||
this.errLimHi = errLimHi;
|
||||
return this;
|
||||
}
|
||||
|
||||
delegate void EntryFormDlgt(EntryForm myRef);
|
||||
///
|
||||
void OpenBeginningDlg(EntryForm myRef)
|
||||
{
|
||||
myRef.modelessDlg = new CycleBeginningForm(waterMeters, mefImport);
|
||||
modelessDlg.Show();
|
||||
}
|
||||
///
|
||||
void OpenEndDlg(EntryForm myRef)
|
||||
{
|
||||
myRef.modelessDlg = new CycleEndForm(TBF.Data.WMsCount, TBF.Data.LineSize);
|
||||
modelessDlg.Show();
|
||||
}
|
||||
///
|
||||
void OpenTestStartStatesDlg(EntryForm myRef)
|
||||
{
|
||||
myRef.modelessDlg = new TestStartEndForm(TBF.Data.WMsCount, myRef.regReaders, myRef.disabled);
|
||||
modelessDlg.Show();
|
||||
}
|
||||
///
|
||||
void OpenTestEndStatesDlg(EntryForm myRef)
|
||||
{
|
||||
myRef.modelessDlg = new TestStartEndForm(TBF.Data.WMsCount, myRef.regReaders, wmStartStateStr, disabled, refVolume, errLimLo, errLimHi);
|
||||
modelessDlg.Show();
|
||||
}
|
||||
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
resultSaved = false;
|
||||
switch (currentOp)
|
||||
{
|
||||
case CurrentOp.ShowFormAtCycleBeginning:
|
||||
Program.MainWnd.Invoke(new EntryFormDlgt(OpenBeginningDlg), this);
|
||||
break;
|
||||
case CurrentOp.ShowFormAtCycleEnd:
|
||||
if (entryFormCfg.ShowCycleEndForm)
|
||||
{
|
||||
Program.MainWnd.Invoke(new EntryFormDlgt(OpenEndDlg), this);
|
||||
}
|
||||
break;
|
||||
case CurrentOp.EnterTestStartStates:
|
||||
Program.MainWnd.Invoke(new EntryFormDlgt(OpenTestStartStatesDlg), this);
|
||||
break;
|
||||
case CurrentOp.EnterTestEndStates:
|
||||
Program.MainWnd.Invoke(new EntryFormDlgt(OpenTestEndStatesDlg), this);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
/// <returns>Event.ResultsPrinted</returns>
|
||||
public Event Run()
|
||||
{
|
||||
if ((modelessDlg is IHasCompleted) && !(modelessDlg as IHasCompleted).Completed)
|
||||
{
|
||||
return Event.ModelessFormIsOpen;
|
||||
}
|
||||
|
||||
if (!resultSaved) /// This is to save the result only once
|
||||
{
|
||||
if (currentOp == CurrentOp.ShowFormAtCycleBeginning)
|
||||
{
|
||||
CycleBeginningForm dlg = (modelessDlg as CycleBeginningForm);
|
||||
if (dlg != null)
|
||||
{
|
||||
for (int i = 0; i < dlg.DataStreamsCount; i++)
|
||||
{
|
||||
if (waterMeters[i] != null)
|
||||
{
|
||||
waterMeters[i].Disabled = disabled[i] = dlg.Disabled[i];
|
||||
waterMeters[i].SerialNr = dlg.SNText[i];
|
||||
if (dlg.PurchaseOrder != null) waterMeters[i].PurchaseOrder = dlg.PurchaseOrder;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (entryFormCfg.ShowCycleEndForm && currentOp == CurrentOp.ShowFormAtCycleEnd)
|
||||
{
|
||||
CycleEndForm dlg = (modelessDlg as CycleEndForm);
|
||||
int count = waterMeters.Count;
|
||||
if ((dlg != null) && (count > dlg.WaterMetersCount)) count = dlg.WaterMetersCount;
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
if (waterMeters[i] != null)
|
||||
{
|
||||
/// In case entryFormCfg.ShowCycleEndForm == false dlg would be null, values would be string.Empty
|
||||
wmCycleEndState[i] = waterMeters[i].EndState = (dlg != null) ? dlg.EndStateText[i] : string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (modelessDlg is TestStartEndForm && currentOp == CurrentOp.EnterTestStartStates)
|
||||
{
|
||||
/// Fixed start test - start
|
||||
TestStartEndForm dlg = (modelessDlg as TestStartEndForm);
|
||||
if (dlg != null)
|
||||
{
|
||||
for (int i = 0; i < dlg.WaterMetersCount; i++)
|
||||
{
|
||||
if (!(((i < disabled.Length) && disabled[i]) || ((i < regReaders.Length) && (regReaders[i] == null))))
|
||||
{
|
||||
wmStartState[i] = dlg.WMStartState[i];
|
||||
wmStartStateStr[i] = dlg.WMStartStateStr[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (modelessDlg is TestStartEndForm && currentOp == CurrentOp.EnterTestEndStates)
|
||||
{
|
||||
/// Fixed start test - end
|
||||
TestStartEndForm dlg = (modelessDlg as TestStartEndForm);
|
||||
if (dlg != null)
|
||||
{
|
||||
for (int i = 0; i < dlg.WaterMetersCount; i++)
|
||||
{
|
||||
if (!(((i < disabled.Length) && disabled[i]) || ((i < regReaders.Length) && (regReaders[i] == null))))
|
||||
{
|
||||
wmEndState[i] = dlg.WMEndState[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
resultSaved = true;
|
||||
modelessDlg = null;
|
||||
}
|
||||
|
||||
return Event.ModelessFormClosed; /// Form closed
|
||||
}
|
||||
|
||||
/// <summary>Stop this operation</summary>
|
||||
public void Stop()
|
||||
{
|
||||
if (modelessDlg is IHasCompleted)
|
||||
{
|
||||
UiBridge.Bridge.OnCloseModelessForm(this, null);
|
||||
modelessDlg = null;
|
||||
}
|
||||
currentOp = CurrentOp.None;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
///
|
||||
/// Copyright (c) 2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
using TBF.Rig.Generic;
|
||||
using TBF.Resources;
|
||||
|
||||
namespace TBF.Rig.DataEntry.DataStream
|
||||
{
|
||||
/// <summary>
|
||||
/// Holds DataEntry.DataStream configuration.
|
||||
/// </summary>
|
||||
public class EntryFormCfg : ComponentCfgBase, Generic.IChildComponentCfg, IParamsProvider
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(EntryFormCfg) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
public IComponentCfgCtrl GetControl(IList<Config.Entities.Component> cmpntEntities)
|
||||
{
|
||||
IList<string> parents = new List<string>();
|
||||
parents.Add("MefImport");
|
||||
|
||||
return new Configs.ParamsProvider.ComponentCfgCtrl(this, parents);
|
||||
}
|
||||
|
||||
///
|
||||
/// Serialized parameters
|
||||
///
|
||||
public bool ShowCycleEndForm;
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
EntryFormCfg() {}
|
||||
|
||||
public EntryFormCfg(IComponentFactory factory, string name)
|
||||
: this()
|
||||
{
|
||||
Factory = factory;
|
||||
Name = name;
|
||||
ParentName = "MefImport";
|
||||
InitializeAll();
|
||||
}
|
||||
|
||||
public string ComponentName { get { return Name; } }
|
||||
|
||||
public void InitializeAll()
|
||||
{
|
||||
ShowCycleEndForm = false;
|
||||
}
|
||||
|
||||
string[] paramNames = new string[]
|
||||
{
|
||||
"Show form at the end of cycle",
|
||||
};
|
||||
public string ParamName(int i) { return paramNames[i]; }
|
||||
public int ParamsCount() { return paramNames.Length; }
|
||||
|
||||
public ICollection<string> ParamValues(int i)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
return new List<string>() { Strings.yes, Strings.no };
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
return ShowCycleEndForm ? Strings.yes : Strings.no;
|
||||
default:
|
||||
return string.Format("{0}: ShowEndForm={1}", Name, ShowCycleEndForm);
|
||||
}
|
||||
}
|
||||
|
||||
public CfgUpdateFlags UpdateParam(int i, string strValue)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
ShowCycleEndForm = (strValue == Strings.yes);
|
||||
return CfgUpdateFlags.RestartRqrd;
|
||||
default:
|
||||
return CfgUpdateFlags.None;
|
||||
}
|
||||
}
|
||||
|
||||
public bool ValidateParam(int i, string strValue, out string message)
|
||||
{
|
||||
message = string.Empty;
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
if (ParamValues(i).Contains(strValue)) return true;
|
||||
break;
|
||||
default:
|
||||
message = "Invalid index";
|
||||
return false;
|
||||
}
|
||||
|
||||
message = ParamName(i) + " is invalid";
|
||||
return false;
|
||||
}
|
||||
|
||||
void CopyContentTo(EntryFormCfg prms)
|
||||
{
|
||||
prms.ShowCycleEndForm = this.ShowCycleEndForm;
|
||||
}
|
||||
|
||||
public Config.Entities.IParamsProvider Clone()
|
||||
{
|
||||
EntryFormCfg pars = new EntryFormCfg();
|
||||
CopyContentTo(pars);
|
||||
return pars;
|
||||
}
|
||||
|
||||
public bool UpdateEmbeddedDbEntity()
|
||||
{
|
||||
return true; /// =OK, do nothing
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
///
|
||||
/// Copyright (c) 2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using TBF.Rig.Generic;
|
||||
|
||||
namespace TBF.Rig.DataEntry.DataStream
|
||||
{
|
||||
public class Factory : IComponentFactory
|
||||
{
|
||||
public string ClassName { get { return GetType().Namespace.Substring(8); } }
|
||||
|
||||
public IComponent DummyComponent() { return new EntryForm(); }
|
||||
|
||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new EntryForm(cfg, components); }
|
||||
|
||||
public IComponentCfg DefaultConfig() { return new EntryFormCfg(this, GetType().Namespace.Substring(8)); }
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
||||
{
|
||||
return ComponentCfgBase.CreateFromDbEntity(EntryFormCfg.Serializer, component, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
///
|
||||
/// Copyright (c) 2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
|
||||
namespace TBF.Rig.DataEntry.DataStream
|
||||
{
|
||||
public class OpenConnectionEventArgs : EventArgs
|
||||
{
|
||||
public int WMNr0; /// 0-based water meter position
|
||||
public bool IsLast;
|
||||
public Results.Entities.WaterMeter Wm;
|
||||
public bool Connected;
|
||||
public string WaterMeterID;
|
||||
|
||||
public OpenConnectionEventArgs(int wmNr0, bool isLast, Results.Entities.WaterMeter wm = null, bool connected = false, string waterMeterID = null)
|
||||
{
|
||||
this.WMNr0 = wmNr0;
|
||||
this.IsLast = isLast;
|
||||
this.Wm = wm;
|
||||
this.Connected = connected;
|
||||
this.WaterMeterID = connected ? waterMeterID : null;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("WMNr0={0} Last={1} WMPos={2} connected={3} S/N={4}",
|
||||
WMNr0,
|
||||
IsLast,
|
||||
Wm.WMPosition,
|
||||
Connected,
|
||||
string.IsNullOrEmpty(WaterMeterID) ? string.Empty : WaterMeterID);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,533 @@
|
||||
///
|
||||
/// Copyright (c) 2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
using log4net;
|
||||
using TBF.Rig.GenericDevices;
|
||||
using TBF.Resources;
|
||||
|
||||
namespace TBF.Rig.DataEntry.DataStream
|
||||
{
|
||||
public partial class TestStartEndForm : Form, GenericDevices.IHasCompleted
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(TestStartEndForm));
|
||||
|
||||
// Set to 'true' when the form closes
|
||||
public bool Completed { get { return completed; } }
|
||||
bool completed;
|
||||
|
||||
/// <summary> Number of text boxes for serial numbers </summary>
|
||||
public readonly int WaterMetersCount;
|
||||
readonly IRegReader[] regReaders;
|
||||
readonly bool[] disabled;
|
||||
|
||||
// To be retrieved after the form closes
|
||||
public double[] WMStartState;
|
||||
|
||||
// To be retrieved after the form closes
|
||||
public readonly string[] WMStartStateStr;
|
||||
|
||||
// To be retrieved after the form closes
|
||||
public double[] WMEndState;
|
||||
|
||||
bool endStates; /// false=start states, true=end states
|
||||
double refVolume;
|
||||
double warningLimLo; /// limit to display exclamation mark, typically 2x errLimLo
|
||||
double warningLimHi; /// limit to display exclamation mark, typically 2x errLimHi
|
||||
bool fixedErrorLimits; /// false in case of calculated error limits
|
||||
|
||||
int TextBoxesCount;
|
||||
///
|
||||
Label[] labels;
|
||||
TextBox[] startTextBoxes;
|
||||
TextBox[] endTextBoxes;
|
||||
Label[] exclamations;
|
||||
|
||||
IList<TextBox> activeTextBoxes;
|
||||
IList<int> activeWmNrs;
|
||||
|
||||
/// <summary>
|
||||
/// Parameterless constructor initializing common part for start and endstate form
|
||||
/// </summary>
|
||||
public TestStartEndForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
ControlBox = false;
|
||||
|
||||
TextBoxesCount = 24;
|
||||
|
||||
labels = new Label[]
|
||||
{
|
||||
label1, label2, label3, label4, label5, label6, label7, label8, label9, label10,
|
||||
label11, label12, label13, label14, label15, label16, label17, label18, label19, label20,
|
||||
label21, label22, label23, label24,
|
||||
};
|
||||
startTextBoxes = new TextBox[]
|
||||
{
|
||||
startTextBox1, startTextBox2, startTextBox3, startTextBox4, startTextBox5, startTextBox6,
|
||||
startTextBox7, startTextBox8, startTextBox9, startTextBox10, startTextBox11, startTextBox12,
|
||||
startTextBox13, startTextBox14, startTextBox15, startTextBox16, startTextBox17, startTextBox18,
|
||||
startTextBox19, startTextBox20, startTextBox21, startTextBox22, startTextBox23, startTextBox24,
|
||||
};
|
||||
endTextBoxes = new TextBox[]
|
||||
{
|
||||
endTextBox1, endTextBox2, endTextBox3, endTextBox4, endTextBox5, endTextBox6,
|
||||
endTextBox7, endTextBox8, endTextBox9, endTextBox10, endTextBox11, endTextBox12,
|
||||
endTextBox13, endTextBox14, endTextBox15, endTextBox16, endTextBox17, endTextBox18,
|
||||
endTextBox19, endTextBox20, endTextBox21, endTextBox22, endTextBox23, endTextBox24,
|
||||
};
|
||||
exclamations = new Label[]
|
||||
{
|
||||
exclamation1, exclamation2, exclamation3, exclamation4, exclamation5, exclamation6,
|
||||
exclamation7, exclamation8, exclamation9, exclamation10, exclamation11, exclamation12,
|
||||
exclamation13, exclamation14, exclamation15, exclamation16, exclamation17, exclamation18,
|
||||
exclamation19, exclamation20, exclamation21, exclamation22, exclamation23, exclamation24,
|
||||
};
|
||||
|
||||
activeTextBoxes = new List<TextBox>();
|
||||
activeWmNrs = new List<int>();
|
||||
|
||||
completed = false;
|
||||
StartForceCloseHandler();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor to fill in start states
|
||||
/// </summary>
|
||||
/// <param name="waterMetersCount">Number of water meters</param>
|
||||
/// <param name="disabled">Information from CycleBeginningForm about availability of water meters</param>
|
||||
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, bool[] disabled)
|
||||
: this()
|
||||
{
|
||||
endStates = false;
|
||||
|
||||
this.WaterMetersCount = waterMetersCount;
|
||||
this.regReaders = regReaders;
|
||||
this.disabled = disabled;
|
||||
|
||||
ShuffleTextBoxes();
|
||||
|
||||
WMStartState = new double[waterMetersCount];
|
||||
WMStartStateStr = new string[waterMetersCount];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor to fill in end states
|
||||
/// </summary>
|
||||
/// <param name="waterMetersCount">Number of water meters</param>
|
||||
/// <param name="wmStartStateStr">Information entered on test start</param>
|
||||
/// <param name="disabled">Information from CycleBeginningForm about availability of water meters</param>
|
||||
/// <param name="refVolume">Reference volume, it is used to verify the end state, show/hide exclamation if necessary</param>
|
||||
/// <param name="errLimLo">Error limit low, it is used to verify the end state, show/hide exclamation if necessary</param>
|
||||
/// <param name="errLimHi">Error limit high, it is used to verify the end state, show/hide exclamation if necessary</param>
|
||||
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, string[] wmStartStateStr, bool[] disabled,
|
||||
double refVolume, double errLimLo, double errLimHi)
|
||||
: this()
|
||||
{
|
||||
endStates = true;
|
||||
|
||||
this.WaterMetersCount = waterMetersCount;
|
||||
this.regReaders = regReaders;
|
||||
if (wmStartStateStr == null || wmStartStateStr.Length != waterMetersCount)
|
||||
throw (new Exception("Invalid 'wmStartStateStr' argument"));
|
||||
this.WMStartStateStr = wmStartStateStr;
|
||||
this.disabled = disabled;
|
||||
this.refVolume = refVolume;
|
||||
this.warningLimLo = 2 * errLimLo;
|
||||
this.warningLimHi = 2 * errLimHi;
|
||||
this.fixedErrorLimits = (errLimHi > errLimLo);
|
||||
|
||||
ShuffleTextBoxes();
|
||||
|
||||
WMEndState = new double[waterMetersCount];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Make sure the layout of labels/text boxes on the screen
|
||||
/// corresponds to the layout of watermeters of the test bench.
|
||||
/// </summary>
|
||||
void ShuffleTextBoxes()
|
||||
{
|
||||
if (TextBoxesCount > WaterMetersCount)
|
||||
{
|
||||
int nrLines = WaterMetersCount / TBF.Data.LineSize;
|
||||
int gap = (TextBoxesCount - WaterMetersCount) / nrLines;
|
||||
|
||||
int dest = 0;
|
||||
for (int l = 0; l < nrLines; l++)
|
||||
{
|
||||
for (int i = 0; i < TBF.Data.LineSize; i++)
|
||||
{
|
||||
labels[dest] = labels[l * TBF.Data.LineSize + l * gap + i];
|
||||
startTextBoxes[dest] = startTextBoxes[l * TBF.Data.LineSize + l * gap + i];
|
||||
endTextBoxes[dest] = endTextBoxes[l * TBF.Data.LineSize + l * gap + i];
|
||||
exclamations[dest] = exclamations[l * TBF.Data.LineSize + l * gap + i];
|
||||
dest++;
|
||||
}
|
||||
}
|
||||
TextBoxesCount = WaterMetersCount;
|
||||
}
|
||||
}
|
||||
|
||||
private void CycleEndForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
Localize();
|
||||
|
||||
//Height = 115 + 90 * WaterMetersCount;
|
||||
|
||||
for (int i = 0; i < TextBoxesCount; i++)
|
||||
{
|
||||
if (i < WaterMetersCount)
|
||||
{
|
||||
labels[i].Visible = startTextBoxes[i].Visible = endTextBoxes[i].Visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (endStates)
|
||||
{
|
||||
/// End of test
|
||||
for (int i = 0; i < TextBoxesCount; i++)
|
||||
{
|
||||
if (WMStartStateStr != null && i < WMStartStateStr.Length)
|
||||
{
|
||||
startTextBoxes[i].Text = WMStartStateStr[i];
|
||||
}
|
||||
|
||||
if (((i < disabled.Length) && disabled[i]) || ((i < regReaders.Length) && (regReaders[i] == null)))
|
||||
{
|
||||
endTextBoxes[i].Enabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
endTextBoxes[i].Enabled = true;
|
||||
activeTextBoxes.Add(endTextBoxes[i]);
|
||||
activeWmNrs.Add(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/// Start of test
|
||||
for (int i = 0; i < TextBoxesCount; i++)
|
||||
{
|
||||
if (((i < disabled.Length) && disabled[i]) || ((i < regReaders.Length) && (regReaders[i] == null)))
|
||||
{
|
||||
startTextBoxes[i].Enabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
startTextBoxes[i].Enabled = true;
|
||||
activeTextBoxes.Add(startTextBoxes[i]);
|
||||
activeWmNrs.Add(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((activeTextBoxes.Count > 0) && (activeWmNrs.Count > 0))
|
||||
{
|
||||
activeTextBoxes[0].Focus();
|
||||
largeTextBox.Text = string.Format("{0} {1}: {2}", Strings.Water_Meter, activeWmNrs[0] + 1, string.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
void Localize()
|
||||
{
|
||||
Text = Strings.Water_Meter_States;
|
||||
for (int i = 0; i < TextBoxesCount; i++)
|
||||
{
|
||||
labels[i].Text = string.Format("{0} {1}", Strings.Water_Meter, i + 1);
|
||||
}
|
||||
startLabel.Text = startLabel2.Text = Strings.Start;
|
||||
endLabel.Text = endLabel2.Text = Strings.End;
|
||||
okButton.Text = Strings.OkBtnText;
|
||||
}
|
||||
|
||||
private void okButton_Click(object sender, EventArgs eArgs)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (endStates)
|
||||
{
|
||||
for (int i = 0; i < Math.Min(WaterMetersCount, TextBoxesCount); i++)
|
||||
{
|
||||
if (endTextBoxes[i].Visible && endTextBoxes[i].Enabled)
|
||||
{
|
||||
WMEndState[i] = Utils.ParseUDouble(endTextBoxes[i].Text);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < Math.Min(WaterMetersCount, TextBoxesCount); i++)
|
||||
{
|
||||
if (startTextBoxes[i].Visible && startTextBoxes[i].Enabled)
|
||||
{
|
||||
WMStartStateStr[i] = startTextBoxes[i].Text;
|
||||
WMStartState[i] = Utils.ParseUDouble(startTextBoxes[i].Text);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
log.ErrorFormat("Exception: {0}", e.Message);
|
||||
return;
|
||||
}
|
||||
|
||||
completed = true;
|
||||
Close();
|
||||
}
|
||||
|
||||
#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
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Calculate the approximate error and verify whether it is within limits.
|
||||
/// Make an exclamation mark visible if out of range.
|
||||
/// Similar event handler is implemented for all endTextBoxes (1..24).
|
||||
/// </summary>
|
||||
private void ProcEndTextChanged(object sender, EventArgs e, TextBox endTBox)
|
||||
{
|
||||
int wmIx = -1;
|
||||
for (int i = 0; i < endTextBoxes.Length; i++)
|
||||
{
|
||||
if (endTextBoxes[i] == endTBox)
|
||||
{
|
||||
wmIx = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
double err = 0;
|
||||
try
|
||||
{
|
||||
double endState = Utils.ParseUDouble(endTextBoxes[wmIx].Text);
|
||||
double startState = Utils.ParseUDouble(startTextBoxes[wmIx].Text);
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
|
||||
bool errorOoR = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
exclamations[wmIx].Visible = errorOoR;
|
||||
largeExclamationLabel.Visible = errorOoR;
|
||||
largeTextBox.Text = string.Format("{0} {1}: {2}", Strings.Water_Meter, wmIx + 1, endTextBoxes[wmIx].Text);
|
||||
}
|
||||
|
||||
private void endTextBox1_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox1); }
|
||||
private void endTextBox2_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox2); }
|
||||
private void endTextBox3_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox3); }
|
||||
private void endTextBox4_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox4); }
|
||||
private void endTextBox5_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox5); }
|
||||
private void endTextBox6_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox6); }
|
||||
private void endTextBox7_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox7); }
|
||||
private void endTextBox8_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox8); }
|
||||
private void endTextBox9_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox9); }
|
||||
private void endTextBox10_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox10); }
|
||||
private void endTextBox11_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox11); }
|
||||
private void endTextBox12_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox12); }
|
||||
private void endTextBox13_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox13); }
|
||||
private void endTextBox14_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox14); }
|
||||
private void endTextBox15_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox15); }
|
||||
private void endTextBox16_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox16); }
|
||||
private void endTextBox17_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox17); }
|
||||
private void endTextBox18_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox18); }
|
||||
private void endTextBox19_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox19); }
|
||||
private void endTextBox20_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox20); }
|
||||
private void endTextBox21_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox21); }
|
||||
private void endTextBox22_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox22); }
|
||||
private void endTextBox23_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox23); }
|
||||
private void endTextBox24_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox24); }
|
||||
|
||||
private void endTextBox1_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox1); }
|
||||
private void endTextBox2_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox2); }
|
||||
private void endTextBox3_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox3); }
|
||||
private void endTextBox4_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox4); }
|
||||
private void endTextBox5_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox5); }
|
||||
private void endTextBox6_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox6); }
|
||||
private void endTextBox7_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox7); }
|
||||
private void endTextBox8_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox8); }
|
||||
private void endTextBox9_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox9); }
|
||||
private void endTextBox10_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox10); }
|
||||
private void endTextBox11_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox11); }
|
||||
private void endTextBox12_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox12); }
|
||||
private void endTextBox13_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox13); }
|
||||
private void endTextBox14_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox14); }
|
||||
private void endTextBox15_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox15); }
|
||||
private void endTextBox16_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox16); }
|
||||
private void endTextBox17_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox17); }
|
||||
private void endTextBox18_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox18); }
|
||||
private void endTextBox19_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox19); }
|
||||
private void endTextBox20_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox20); }
|
||||
private void endTextBox21_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox21); }
|
||||
private void endTextBox22_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox22); }
|
||||
private void endTextBox23_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox23); }
|
||||
private void endTextBox24_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox24); }
|
||||
|
||||
/// <summary>
|
||||
/// Process a key press within any enabled text boxe
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
/// <param name="currentFocusOwner">TextBox control which received the event</param>
|
||||
private void ProcKeyPress(object sender, KeyPressEventArgs e, TextBox currentFocusOwner)
|
||||
{
|
||||
if (e.KeyChar == '+')
|
||||
{
|
||||
/// Process '+' key ..... Form completed
|
||||
okButton_Click(sender, e);
|
||||
}
|
||||
|
||||
if (e.KeyChar == '\r')
|
||||
{
|
||||
/// Process <enter> key ..... Next text field
|
||||
if (activeTextBoxes.Count < 2) return; /// There is just one enabled textbox
|
||||
|
||||
for (int i = 0; i < activeTextBoxes.Count; i++)
|
||||
{
|
||||
if (activeTextBoxes[i] == currentFocusOwner)
|
||||
{
|
||||
/// Change focus to the next enabled text box
|
||||
int newTBIdx = (i + 1) % activeTextBoxes.Count;
|
||||
activeTextBoxes[newTBIdx].Focus();
|
||||
largeTextBox.Text = string.Format("{0} {1}: {2}", Strings.Water_Meter, activeWmNrs[newTBIdx] + 1, activeTextBoxes[newTBIdx].Text);
|
||||
largeExclamationLabel.Visible = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void startTextBox1_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, startTextBox1); }
|
||||
private void startTextBox2_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, startTextBox2); }
|
||||
private void startTextBox3_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, startTextBox3); }
|
||||
private void startTextBox4_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, startTextBox4); }
|
||||
private void startTextBox5_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, startTextBox5); }
|
||||
private void startTextBox6_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, startTextBox6); }
|
||||
private void startTextBox7_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, startTextBox7); }
|
||||
private void startTextBox8_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, startTextBox8); }
|
||||
private void startTextBox9_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, startTextBox9); }
|
||||
private void startTextBox10_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, startTextBox10); }
|
||||
private void startTextBox11_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, startTextBox11); }
|
||||
private void startTextBox12_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, startTextBox12); }
|
||||
private void startTextBox13_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, startTextBox13); }
|
||||
private void startTextBox14_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, startTextBox14); }
|
||||
private void startTextBox15_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, startTextBox15); }
|
||||
private void startTextBox16_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, startTextBox16); }
|
||||
private void startTextBox17_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, startTextBox17); }
|
||||
private void startTextBox18_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, startTextBox18); }
|
||||
private void startTextBox19_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, startTextBox19); }
|
||||
private void startTextBox20_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, startTextBox20); }
|
||||
private void startTextBox21_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, startTextBox21); }
|
||||
private void startTextBox22_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, startTextBox22); }
|
||||
private void startTextBox23_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, startTextBox23); }
|
||||
private void startTextBox24_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, startTextBox24); }
|
||||
|
||||
private void endTextBox1_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox1); }
|
||||
private void endTextBox2_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox2); }
|
||||
private void endTextBox3_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox3); }
|
||||
private void endTextBox4_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox4); }
|
||||
private void endTextBox5_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox5); }
|
||||
private void endTextBox6_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox6); }
|
||||
private void endTextBox7_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox7); }
|
||||
private void endTextBox8_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox8); }
|
||||
private void endTextBox9_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox9); }
|
||||
private void endTextBox10_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox10); }
|
||||
private void endTextBox11_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox11); }
|
||||
private void endTextBox12_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox12); }
|
||||
private void endTextBox13_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox13); }
|
||||
private void endTextBox14_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox14); }
|
||||
private void endTextBox15_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox15); }
|
||||
private void endTextBox16_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox16); }
|
||||
private void endTextBox17_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox17); }
|
||||
private void endTextBox18_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox18); }
|
||||
private void endTextBox19_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox19); }
|
||||
private void endTextBox20_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox20); }
|
||||
private void endTextBox21_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox21); }
|
||||
private void endTextBox22_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox22); }
|
||||
private void endTextBox23_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox23); }
|
||||
private void endTextBox24_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox24); }
|
||||
|
||||
|
||||
private void ProcStartTextChanged(object sender, EventArgs e, TextBox startTBox)
|
||||
{
|
||||
for (int i = 0; i < startTextBoxes.Length; i++)
|
||||
{
|
||||
if (startTextBoxes[i] == startTBox)
|
||||
{
|
||||
largeTextBox.Text = string.Format("{0} {1}: {2}", Strings.Water_Meter, i + 1, startTextBoxes[i].Text);
|
||||
largeExclamationLabel.Visible = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void startTextBox1_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox1); }
|
||||
private void startTextBox2_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox2); }
|
||||
private void startTextBox3_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox3); }
|
||||
private void startTextBox4_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox4); }
|
||||
private void startTextBox5_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox5); }
|
||||
private void startTextBox6_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox6); }
|
||||
private void startTextBox7_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox7); }
|
||||
private void startTextBox8_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox8); }
|
||||
private void startTextBox9_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox9); }
|
||||
private void startTextBox10_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox10); }
|
||||
private void startTextBox11_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox11); }
|
||||
private void startTextBox12_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox12); }
|
||||
private void startTextBox13_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox13); }
|
||||
private void startTextBox14_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox14); }
|
||||
private void startTextBox15_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox15); }
|
||||
private void startTextBox16_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox16); }
|
||||
private void startTextBox17_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox17); }
|
||||
private void startTextBox18_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox18); }
|
||||
private void startTextBox19_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox19); }
|
||||
private void startTextBox20_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox20); }
|
||||
private void startTextBox21_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox21); }
|
||||
private void startTextBox22_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox22); }
|
||||
private void startTextBox23_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox23); }
|
||||
private void startTextBox24_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox24); }
|
||||
|
||||
private void startTextBox1_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox1); }
|
||||
private void startTextBox2_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox2); }
|
||||
private void startTextBox3_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox3); }
|
||||
private void startTextBox4_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox4); }
|
||||
private void startTextBox5_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox5); }
|
||||
private void startTextBox6_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox6); }
|
||||
private void startTextBox7_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox7); }
|
||||
private void startTextBox8_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox8); }
|
||||
private void startTextBox9_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox9); }
|
||||
private void startTextBox10_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox10); }
|
||||
private void startTextBox11_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox11); }
|
||||
private void startTextBox12_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox12); }
|
||||
private void startTextBox13_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox13); }
|
||||
private void startTextBox14_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox14); }
|
||||
private void startTextBox15_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox15); }
|
||||
private void startTextBox16_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox16); }
|
||||
private void startTextBox17_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox17); }
|
||||
private void startTextBox18_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox18); }
|
||||
private void startTextBox19_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox19); }
|
||||
private void startTextBox20_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox20); }
|
||||
private void startTextBox21_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox21); }
|
||||
private void startTextBox22_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox22); }
|
||||
private void startTextBox23_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox23); }
|
||||
private void startTextBox24_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox24); }
|
||||
}
|
||||
}
|
||||
+1615
File diff suppressed because it is too large
Load Diff
@@ -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>
|
||||
+1102
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,431 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
using log4net;
|
||||
using TBF.Resources;
|
||||
|
||||
namespace TBF.Rig.DataEntry.Fewa
|
||||
{
|
||||
public partial class CycleBeginningForm : Form, GenericDevices.IHasCompleted
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(CycleBeginningForm));
|
||||
|
||||
/// <summary> Number of water meters </summary>
|
||||
public readonly int WMsCount;
|
||||
|
||||
/// To be retrieved after the form is closed
|
||||
public string PurchaseOrder;
|
||||
public string[] SNText;
|
||||
public string[] SN2Text;
|
||||
string[] suffixText;
|
||||
public bool[] Disabled;
|
||||
|
||||
/// Set to 'true' when the form closes
|
||||
public bool Completed { get { return completed; } }
|
||||
bool completed;
|
||||
|
||||
/// <summary> Number of text boxes for serial numbers </summary>
|
||||
int textBoxesCount;
|
||||
Label[] labels;
|
||||
ComboBox[] comboBoxes;
|
||||
ComboBox[] suffixComboBoxes;
|
||||
CheckBox[] checkBoxes;
|
||||
IList<ComboBox> enabledComboBoxes;
|
||||
|
||||
|
||||
/// <summary> Parameterless constructor for common functionality </summary>
|
||||
public CycleBeginningForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
ControlBox = false;
|
||||
|
||||
textBoxesCount = 24;
|
||||
labels = new Label[]
|
||||
{
|
||||
label1, label2, label3, label4, label5, label6, label7, label8, label9, label10,
|
||||
label11, label12, label13, label14, label15, label16, label17, label18, label19, label20,
|
||||
label21, label22, label23, label24,
|
||||
};
|
||||
comboBoxes = new ComboBox[]
|
||||
{
|
||||
comboBox1, comboBox2, comboBox3, comboBox4, comboBox5, comboBox6,
|
||||
comboBox7, comboBox8, comboBox9, comboBox10, comboBox11, comboBox12,
|
||||
comboBox13, comboBox14, comboBox15, comboBox16, comboBox17, comboBox18,
|
||||
comboBox19, comboBox20, comboBox21, comboBox22, comboBox23, comboBox24,
|
||||
};
|
||||
suffixComboBoxes = new ComboBox[]
|
||||
{
|
||||
suffixComboBox1, suffixComboBox2, suffixComboBox3, suffixComboBox4, suffixComboBox5, suffixComboBox6,
|
||||
suffixComboBox7, suffixComboBox8, suffixComboBox9, suffixComboBox10, suffixComboBox11, suffixComboBox12,
|
||||
suffixComboBox13, suffixComboBox14, suffixComboBox15, suffixComboBox16, suffixComboBox17, suffixComboBox18,
|
||||
suffixComboBox19, suffixComboBox20, suffixComboBox21, suffixComboBox22, suffixComboBox23, suffixComboBox24,
|
||||
};
|
||||
checkBoxes = new CheckBox[]
|
||||
{
|
||||
checkBox1, checkBox2, checkBox3, checkBox4, checkBox5, checkBox6,
|
||||
checkBox7, checkBox8, checkBox9, checkBox10, checkBox11, checkBox12,
|
||||
checkBox13, checkBox14, checkBox15, checkBox16, checkBox17, checkBox18,
|
||||
checkBox19, checkBox20, checkBox21, checkBox22, checkBox23, checkBox24,
|
||||
};
|
||||
enabledComboBoxes = new List<ComboBox>();
|
||||
|
||||
completed = false;
|
||||
StartForceCloseHandler();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="waterMetersCount">Number of text boxes for serial numbers</param>
|
||||
public CycleBeginningForm(int waterMetersCount)
|
||||
: this()
|
||||
{
|
||||
this.WMsCount = waterMetersCount;
|
||||
SNText = new string[WMsCount];
|
||||
SN2Text = new string[WMsCount];
|
||||
suffixText = new string[WMsCount];
|
||||
Disabled = new bool[WMsCount];
|
||||
|
||||
ShuffleTextBoxes(TBF.Data.WMsCount, TBF.Data.LineSize);
|
||||
|
||||
//Height = 147 + WaterMetersCount * 90;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Make sure the layout of labels/text boxes on the screen
|
||||
/// corresponds to the layout of watermeters of the test bench.
|
||||
/// </summary>
|
||||
/// <param name="wmsCount">Number of watermeters</param>
|
||||
/// <param name="lineSize">Number of watermeters in one line</param>
|
||||
void ShuffleTextBoxes(int wmsCount, int lineSize)
|
||||
{
|
||||
if (wmsCount < textBoxesCount && lineSize > 0)
|
||||
{
|
||||
int nrLines = (wmsCount + lineSize - 1) / lineSize;
|
||||
int gap = (textBoxesCount - wmsCount) / nrLines;
|
||||
|
||||
int dest = 0;
|
||||
for (int l = 0; l < nrLines; l++)
|
||||
{
|
||||
for (int i = 0; i < lineSize; i++)
|
||||
{
|
||||
labels[dest] = labels[l * lineSize + l * gap + i];
|
||||
comboBoxes[dest] = comboBoxes[l * lineSize + l * gap + i];
|
||||
suffixComboBoxes[dest] = suffixComboBoxes[l * lineSize + l * gap + i];
|
||||
checkBoxes[dest] = checkBoxes[l * lineSize + l * gap + i];
|
||||
dest++;
|
||||
}
|
||||
}
|
||||
textBoxesCount = wmsCount;
|
||||
}
|
||||
}
|
||||
|
||||
private void CycleBeginningForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
Localize();
|
||||
|
||||
PrepareOrderCombo(orderComboBox);
|
||||
PreparePrefixCombo(prefixComboBox);
|
||||
|
||||
for (int i = 0; i < textBoxesCount; i++)
|
||||
{
|
||||
if (Program.LocalSettings.LastSNTextsCount == textBoxesCount)
|
||||
{
|
||||
comboBoxes[i].Items.Add((Program.LocalSettings.LastSNTexts[i] == null) ? string.Empty : Program.LocalSettings.LastSNTexts[i]);
|
||||
suffixComboBoxes[i].Items.Add((Program.LocalSettings.LastAuxSNTexts[i] == null) ? string.Empty : Program.LocalSettings.LastAuxSNTexts[i]);
|
||||
}
|
||||
|
||||
labels[i].Visible = comboBoxes[i].Visible = suffixComboBoxes[i].Visible = checkBoxes[i].Visible = true;
|
||||
|
||||
enabledComboBoxes.Add(comboBoxes[i]);
|
||||
enabledComboBoxes.Add(suffixComboBoxes[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void Localize()
|
||||
{
|
||||
Text = Strings.Data;
|
||||
orderGroupBox.Text = Strings.Purchase_order;
|
||||
for (int i = 0; i < textBoxesCount; i++)
|
||||
{
|
||||
labels[i].Text = Strings.Serial_Number + " " + (i + 1).ToString();
|
||||
}
|
||||
okButton.Text = Strings.OkBtnText;
|
||||
clearButton.Text = Strings.ClearBtnText;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load Purchase order combo box items from the LocalSettings PurchaseOrderHistory array
|
||||
/// </summary>
|
||||
/// <param name="orderComboBox">Puchase order ComboBox</param>
|
||||
void PrepareOrderCombo(ComboBox orderComboBox)
|
||||
{
|
||||
for (int i = 0; i < Program.LocalSettings.PurchaseOrderHistoryCount; i++)
|
||||
{
|
||||
orderComboBox.Items.Add(Program.LocalSettings.PurchaseOrderHistory[i]);
|
||||
}
|
||||
|
||||
if (orderComboBox.Items.Count > 0) orderComboBox.Text = orderComboBox.Items[0].ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load Prefix combo box items from the LocalSettings PrefixHistory array
|
||||
/// </summary>
|
||||
/// <param name="orderComboBox">Prefix ComboBox</param>
|
||||
void PreparePrefixCombo(ComboBox prefixComboBox)
|
||||
{
|
||||
for (int i = 0; i < Program.LocalSettings.PrefixHistoryCount; i++)
|
||||
{
|
||||
prefixComboBox.Items.Add(Program.LocalSettings.PrefixHistory[i]);
|
||||
}
|
||||
|
||||
if (prefixComboBox.Items.Count > 0) prefixComboBox.Text = prefixComboBox.Items[0].ToString();
|
||||
}
|
||||
|
||||
private void okButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
for (int i = 0; i < Math.Min(WMsCount, textBoxesCount); i++)
|
||||
{
|
||||
SNText[i] = comboBoxes[i].Text;
|
||||
suffixText[i] = suffixComboBoxes[i].Text;
|
||||
SN2Text[i] = string.Format("{0}{1}", prefixComboBox.Text, suffixComboBoxes[i].Text);
|
||||
Disabled[i] = !checkBoxes[i].Checked;
|
||||
}
|
||||
|
||||
PurchaseOrder = orderComboBox.Text;
|
||||
Program.LocalSettings.UpdateHistory(orderComboBox.Text, ref Program.LocalSettings.PurchaseOrderHistory);
|
||||
Program.LocalSettings.UpdateHistory(prefixComboBox.Text, ref Program.LocalSettings.PrefixHistory);
|
||||
Program.LocalSettings.LastSNTexts = SNText;
|
||||
Program.LocalSettings.LastAuxSNTexts = suffixText;
|
||||
|
||||
completed = true;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void clearButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
for (int i = 0; i < Math.Min(WMsCount, textBoxesCount); i++)
|
||||
{
|
||||
comboBoxes[i].Text = string.Empty;
|
||||
checkBoxes[i].Checked = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void comboBox1_SelectedIndexChanged(object s, EventArgs e) { if (comboBox1.Text.Equals(comboBox1.Items[0])) UpdateAllCombos(); }
|
||||
private void comboBox2_SelectedIndexChanged(object s, EventArgs e) { if (comboBox2.Text.Equals(comboBox2.Items[0])) UpdateAllCombos(); }
|
||||
private void comboBox3_SelectedIndexChanged(object s, EventArgs e) { if (comboBox3.Text.Equals(comboBox3.Items[0])) UpdateAllCombos(); }
|
||||
private void comboBox4_SelectedIndexChanged(object s, EventArgs e) { if (comboBox4.Text.Equals(comboBox4.Items[0])) UpdateAllCombos(); }
|
||||
private void comboBox5_SelectedIndexChanged(object s, EventArgs e) { if (comboBox5.Text.Equals(comboBox5.Items[0])) UpdateAllCombos(); }
|
||||
private void comboBox6_SelectedIndexChanged(object s, EventArgs e) { if (comboBox6.Text.Equals(comboBox6.Items[0])) UpdateAllCombos(); }
|
||||
private void comboBox7_SelectedIndexChanged(object s, EventArgs e) { if (comboBox7.Text.Equals(comboBox7.Items[0])) UpdateAllCombos(); }
|
||||
private void comboBox8_SelectedIndexChanged(object s, EventArgs e) { if (comboBox8.Text.Equals(comboBox8.Items[0])) UpdateAllCombos(); }
|
||||
private void comboBox9_SelectedIndexChanged(object s, EventArgs e) { if (comboBox9.Text.Equals(comboBox9.Items[0])) UpdateAllCombos(); }
|
||||
private void comboBox10_SelectedIndexChanged(object s, EventArgs e) { if (comboBox10.Text.Equals(comboBox10.Items[0])) UpdateAllCombos(); }
|
||||
private void comboBox11_SelectedIndexChanged(object s, EventArgs e) { if (comboBox11.Text.Equals(comboBox11.Items[0])) UpdateAllCombos(); }
|
||||
private void comboBox12_SelectedIndexChanged(object s, EventArgs e) { if (comboBox12.Text.Equals(comboBox12.Items[0])) UpdateAllCombos(); }
|
||||
private void comboBox13_SelectedIndexChanged(object s, EventArgs e) { if (comboBox13.Text.Equals(comboBox13.Items[0])) UpdateAllCombos(); }
|
||||
private void comboBox14_SelectedIndexChanged(object s, EventArgs e) { if (comboBox14.Text.Equals(comboBox14.Items[0])) UpdateAllCombos(); }
|
||||
private void comboBox15_SelectedIndexChanged(object s, EventArgs e) { if (comboBox15.Text.Equals(comboBox15.Items[0])) UpdateAllCombos(); }
|
||||
private void comboBox16_SelectedIndexChanged(object s, EventArgs e) { if (comboBox16.Text.Equals(comboBox16.Items[0])) UpdateAllCombos(); }
|
||||
private void comboBox17_SelectedIndexChanged(object s, EventArgs e) { if (comboBox17.Text.Equals(comboBox17.Items[0])) UpdateAllCombos(); }
|
||||
private void comboBox18_SelectedIndexChanged(object s, EventArgs e) { if (comboBox18.Text.Equals(comboBox18.Items[0])) UpdateAllCombos(); }
|
||||
private void comboBox19_SelectedIndexChanged(object s, EventArgs e) { if (comboBox19.Text.Equals(comboBox19.Items[0])) UpdateAllCombos(); }
|
||||
private void comboBox20_SelectedIndexChanged(object s, EventArgs e) { if (comboBox20.Text.Equals(comboBox20.Items[0])) UpdateAllCombos(); }
|
||||
private void comboBox21_SelectedIndexChanged(object s, EventArgs e) { if (comboBox21.Text.Equals(comboBox21.Items[0])) UpdateAllCombos(); }
|
||||
private void comboBox22_SelectedIndexChanged(object s, EventArgs e) { if (comboBox22.Text.Equals(comboBox22.Items[0])) UpdateAllCombos(); }
|
||||
private void comboBox23_SelectedIndexChanged(object s, EventArgs e) { if (comboBox23.Text.Equals(comboBox23.Items[0])) UpdateAllCombos(); }
|
||||
private void comboBox24_SelectedIndexChanged(object s, EventArgs e) { if (comboBox24.Text.Equals(comboBox24.Items[0])) UpdateAllCombos(); }
|
||||
private void suffixComboBox1_SelectedIndexChanged(object s, EventArgs e) { if (suffixComboBox1.Text.Equals(suffixComboBox1.Items[0])) UpdateAllCombos(); }
|
||||
private void suffixComboBox2_SelectedIndexChanged(object s, EventArgs e) { if (suffixComboBox2.Text.Equals(suffixComboBox2.Items[0])) UpdateAllCombos(); }
|
||||
private void suffixComboBox3_SelectedIndexChanged(object s, EventArgs e) { if (suffixComboBox3.Text.Equals(suffixComboBox3.Items[0])) UpdateAllCombos(); }
|
||||
private void suffixComboBox4_SelectedIndexChanged(object s, EventArgs e) { if (suffixComboBox4.Text.Equals(suffixComboBox4.Items[0])) UpdateAllCombos(); }
|
||||
private void suffixComboBox5_SelectedIndexChanged(object s, EventArgs e) { if (suffixComboBox5.Text.Equals(suffixComboBox5.Items[0])) UpdateAllCombos(); }
|
||||
private void suffixComboBox6_SelectedIndexChanged(object s, EventArgs e) { if (suffixComboBox6.Text.Equals(suffixComboBox6.Items[0])) UpdateAllCombos(); }
|
||||
private void suffixComboBox7_SelectedIndexChanged(object s, EventArgs e) { if (suffixComboBox7.Text.Equals(suffixComboBox7.Items[0])) UpdateAllCombos(); }
|
||||
private void suffixComboBox8_SelectedIndexChanged(object s, EventArgs e) { if (suffixComboBox8.Text.Equals(suffixComboBox8.Items[0])) UpdateAllCombos(); }
|
||||
private void suffixComboBox9_SelectedIndexChanged(object s, EventArgs e) { if (suffixComboBox9.Text.Equals(suffixComboBox9.Items[0])) UpdateAllCombos(); }
|
||||
private void suffixComboBox10_SelectedIndexChanged(object s, EventArgs e) { if (suffixComboBox10.Text.Equals(suffixComboBox10.Items[0])) UpdateAllCombos(); }
|
||||
private void suffixComboBox11_SelectedIndexChanged(object s, EventArgs e) { if (suffixComboBox11.Text.Equals(suffixComboBox11.Items[0])) UpdateAllCombos(); }
|
||||
private void suffixComboBox12_SelectedIndexChanged(object s, EventArgs e) { if (suffixComboBox12.Text.Equals(suffixComboBox12.Items[0])) UpdateAllCombos(); }
|
||||
private void suffixComboBox13_SelectedIndexChanged(object s, EventArgs e) { if (suffixComboBox13.Text.Equals(suffixComboBox13.Items[0])) UpdateAllCombos(); }
|
||||
private void suffixComboBox14_SelectedIndexChanged(object s, EventArgs e) { if (suffixComboBox14.Text.Equals(suffixComboBox14.Items[0])) UpdateAllCombos(); }
|
||||
private void suffixComboBox15_SelectedIndexChanged(object s, EventArgs e) { if (suffixComboBox15.Text.Equals(suffixComboBox15.Items[0])) UpdateAllCombos(); }
|
||||
private void suffixComboBox16_SelectedIndexChanged(object s, EventArgs e) { if (suffixComboBox16.Text.Equals(suffixComboBox16.Items[0])) UpdateAllCombos(); }
|
||||
private void suffixComboBox17_SelectedIndexChanged(object s, EventArgs e) { if (suffixComboBox17.Text.Equals(suffixComboBox17.Items[0])) UpdateAllCombos(); }
|
||||
private void suffixComboBox18_SelectedIndexChanged(object s, EventArgs e) { if (suffixComboBox18.Text.Equals(suffixComboBox18.Items[0])) UpdateAllCombos(); }
|
||||
private void suffixComboBox19_SelectedIndexChanged(object s, EventArgs e) { if (suffixComboBox19.Text.Equals(suffixComboBox19.Items[0])) UpdateAllCombos(); }
|
||||
private void suffixComboBox20_SelectedIndexChanged(object s, EventArgs e) { if (suffixComboBox20.Text.Equals(suffixComboBox20.Items[0])) UpdateAllCombos(); }
|
||||
private void suffixComboBox21_SelectedIndexChanged(object s, EventArgs e) { if (suffixComboBox21.Text.Equals(suffixComboBox21.Items[0])) UpdateAllCombos(); }
|
||||
private void suffixComboBox22_SelectedIndexChanged(object s, EventArgs e) { if (suffixComboBox22.Text.Equals(suffixComboBox22.Items[0])) UpdateAllCombos(); }
|
||||
private void suffixComboBox23_SelectedIndexChanged(object s, EventArgs e) { if (suffixComboBox23.Text.Equals(suffixComboBox23.Items[0])) UpdateAllCombos(); }
|
||||
private void suffixComboBox24_SelectedIndexChanged(object s, EventArgs e) { if (suffixComboBox24.Text.Equals(suffixComboBox24.Items[0])) UpdateAllCombos(); }
|
||||
|
||||
/// <summary>
|
||||
/// When one combo box is updated using drop-down menu, all combo boxes
|
||||
/// are updated by this function.
|
||||
/// </summary>
|
||||
private void UpdateAllCombos()
|
||||
{
|
||||
for (int i = 0; i < Math.Min(WMsCount, textBoxesCount); i++)
|
||||
{
|
||||
if (Program.LocalSettings.LastSNTextsCount > i) comboBoxes[i].Text = Program.LocalSettings.LastSNTexts[i];
|
||||
if (Program.LocalSettings.LastAuxSNTextsCount > i) suffixComboBoxes[i].Text = Program.LocalSettings.LastAuxSNTexts[i];
|
||||
checkBoxes[i].Checked = !string.IsNullOrEmpty(comboBoxes[i].Text) || !string.IsNullOrEmpty(suffixComboBoxes[i].Text);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void comboBox1_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox1); }
|
||||
private void comboBox2_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox2); }
|
||||
private void comboBox3_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox3); }
|
||||
private void comboBox4_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox4); }
|
||||
private void comboBox5_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox5); }
|
||||
private void comboBox6_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox6); }
|
||||
private void comboBox7_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox7); }
|
||||
private void comboBox8_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox8); }
|
||||
private void comboBox9_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox9); }
|
||||
private void comboBox10_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox10); }
|
||||
private void comboBox11_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox11); }
|
||||
private void comboBox12_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox12); }
|
||||
private void comboBox13_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox13); }
|
||||
private void comboBox14_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox14); }
|
||||
private void comboBox15_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox15); }
|
||||
private void comboBox16_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox16); }
|
||||
private void comboBox17_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox17); }
|
||||
private void comboBox18_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox18); }
|
||||
private void comboBox19_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox19); }
|
||||
private void comboBox20_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox20); }
|
||||
private void comboBox21_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox21); }
|
||||
private void comboBox22_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox22); }
|
||||
private void comboBox23_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox23); }
|
||||
private void comboBox24_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox24); }
|
||||
private void suffixComboBox1_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, suffixComboBox1); }
|
||||
private void suffixComboBox2_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, suffixComboBox2); }
|
||||
private void suffixComboBox3_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, suffixComboBox3); }
|
||||
private void suffixComboBox4_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, suffixComboBox4); }
|
||||
private void suffixComboBox5_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, suffixComboBox5); }
|
||||
private void suffixComboBox6_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, suffixComboBox6); }
|
||||
private void suffixComboBox7_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, suffixComboBox7); }
|
||||
private void suffixComboBox8_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, suffixComboBox8); }
|
||||
private void suffixComboBox9_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, suffixComboBox9); }
|
||||
private void suffixComboBox10_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, suffixComboBox10); }
|
||||
private void suffixComboBox11_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, suffixComboBox11); }
|
||||
private void suffixComboBox12_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, suffixComboBox12); }
|
||||
private void suffixComboBox13_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, suffixComboBox13); }
|
||||
private void suffixComboBox14_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, suffixComboBox14); }
|
||||
private void suffixComboBox15_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, suffixComboBox15); }
|
||||
private void suffixComboBox16_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, suffixComboBox16); }
|
||||
private void suffixComboBox17_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, suffixComboBox17); }
|
||||
private void suffixComboBox18_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, suffixComboBox18); }
|
||||
private void suffixComboBox19_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, suffixComboBox19); }
|
||||
private void suffixComboBox20_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, suffixComboBox20); }
|
||||
private void suffixComboBox21_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, suffixComboBox21); }
|
||||
private void suffixComboBox22_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, suffixComboBox22); }
|
||||
private void suffixComboBox23_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, suffixComboBox23); }
|
||||
private void suffixComboBox24_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, suffixComboBox24); }
|
||||
|
||||
/// <summary>
|
||||
/// Process a key press within any enabled text boxe
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
/// <param name="currentFocusOwner">TextBox control which received the event</param>
|
||||
private void ProcKeyPress(object sender, KeyPressEventArgs e, ComboBox currentFocusOwner)
|
||||
{
|
||||
if (e.KeyChar == '+')
|
||||
{
|
||||
/// Process '+' key ..... Form completed
|
||||
okButton_Click(sender, e);
|
||||
}
|
||||
if (e.KeyChar == '\r')
|
||||
{
|
||||
/// Process <enter> key ..... Next text field
|
||||
if (enabledComboBoxes.Count < 2) return; /// There is just one enabled textbox
|
||||
|
||||
for (int i = 0; i < enabledComboBoxes.Count; i++)
|
||||
{
|
||||
if (enabledComboBoxes[i] == currentFocusOwner)
|
||||
{
|
||||
/// Change focus to the next enabled text box
|
||||
enabledComboBoxes[(i + 1) % enabledComboBoxes.Count].Focus();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void comboBox1_TextChanged(object sender, EventArgs e) { checkBox1.Checked = true; }
|
||||
private void comboBox2_TextChanged(object sender, EventArgs e) { checkBox2.Checked = true; }
|
||||
private void comboBox3_TextChanged(object sender, EventArgs e) { checkBox3.Checked = true; }
|
||||
private void comboBox4_TextChanged(object sender, EventArgs e) { checkBox4.Checked = true; }
|
||||
private void comboBox5_TextChanged(object sender, EventArgs e) { checkBox5.Checked = true; }
|
||||
private void comboBox6_TextChanged(object sender, EventArgs e) { checkBox6.Checked = true; }
|
||||
private void comboBox7_TextChanged(object sender, EventArgs e) { checkBox7.Checked = true; }
|
||||
private void comboBox8_TextChanged(object sender, EventArgs e) { checkBox8.Checked = true; }
|
||||
private void comboBox9_TextChanged(object sender, EventArgs e) { checkBox9.Checked = true; }
|
||||
private void comboBox10_TextChanged(object sender, EventArgs e) { checkBox10.Checked = true; }
|
||||
private void comboBox11_TextChanged(object sender, EventArgs e) { checkBox11.Checked = true; }
|
||||
private void comboBox12_TextChanged(object sender, EventArgs e) { checkBox12.Checked = true; }
|
||||
private void comboBox13_TextChanged(object sender, EventArgs e) { checkBox13.Checked = true; }
|
||||
private void comboBox14_TextChanged(object sender, EventArgs e) { checkBox14.Checked = true; }
|
||||
private void comboBox15_TextChanged(object sender, EventArgs e) { checkBox15.Checked = true; }
|
||||
private void comboBox16_TextChanged(object sender, EventArgs e) { checkBox16.Checked = true; }
|
||||
private void comboBox17_TextChanged(object sender, EventArgs e) { checkBox17.Checked = true; }
|
||||
private void comboBox18_TextChanged(object sender, EventArgs e) { checkBox18.Checked = true; }
|
||||
private void comboBox19_TextChanged(object sender, EventArgs e) { checkBox19.Checked = true; }
|
||||
private void comboBox20_TextChanged(object sender, EventArgs e) { checkBox20.Checked = true; }
|
||||
private void comboBox21_TextChanged(object sender, EventArgs e) { checkBox21.Checked = true; }
|
||||
private void comboBox22_TextChanged(object sender, EventArgs e) { checkBox22.Checked = true; }
|
||||
private void comboBox23_TextChanged(object sender, EventArgs e) { checkBox23.Checked = true; }
|
||||
private void comboBox24_TextChanged(object sender, EventArgs e) { checkBox24.Checked = true; }
|
||||
private void suffixComboBox1_TextChanged(object sender, EventArgs e) { checkBox1.Checked = true; }
|
||||
private void suffixComboBox2_TextChanged(object sender, EventArgs e) { checkBox2.Checked = true; }
|
||||
private void suffixComboBox3_TextChanged(object sender, EventArgs e) { checkBox3.Checked = true; }
|
||||
private void suffixComboBox4_TextChanged(object sender, EventArgs e) { checkBox4.Checked = true; }
|
||||
private void suffixComboBox5_TextChanged(object sender, EventArgs e) { checkBox5.Checked = true; }
|
||||
private void suffixComboBox6_TextChanged(object sender, EventArgs e) { checkBox6.Checked = true; }
|
||||
private void suffixComboBox7_TextChanged(object sender, EventArgs e) { checkBox7.Checked = true; }
|
||||
private void suffixComboBox8_TextChanged(object sender, EventArgs e) { checkBox8.Checked = true; }
|
||||
private void suffixComboBox9_TextChanged(object sender, EventArgs e) { checkBox9.Checked = true; }
|
||||
private void suffixComboBox10_TextChanged(object sender, EventArgs e) { checkBox10.Checked = true; }
|
||||
private void suffixComboBox11_TextChanged(object sender, EventArgs e) { checkBox11.Checked = true; }
|
||||
private void suffixComboBox12_TextChanged(object sender, EventArgs e) { checkBox12.Checked = true; }
|
||||
private void suffixComboBox13_TextChanged(object sender, EventArgs e) { checkBox13.Checked = true; }
|
||||
private void suffixComboBox14_TextChanged(object sender, EventArgs e) { checkBox14.Checked = true; }
|
||||
private void suffixComboBox15_TextChanged(object sender, EventArgs e) { checkBox15.Checked = true; }
|
||||
private void suffixComboBox16_TextChanged(object sender, EventArgs e) { checkBox16.Checked = true; }
|
||||
private void suffixComboBox17_TextChanged(object sender, EventArgs e) { checkBox17.Checked = true; }
|
||||
private void suffixComboBox18_TextChanged(object sender, EventArgs e) { checkBox18.Checked = true; }
|
||||
private void suffixComboBox19_TextChanged(object sender, EventArgs e) { checkBox19.Checked = true; }
|
||||
private void suffixComboBox20_TextChanged(object sender, EventArgs e) { checkBox20.Checked = true; }
|
||||
private void suffixComboBox21_TextChanged(object sender, EventArgs e) { checkBox21.Checked = true; }
|
||||
private void suffixComboBox22_TextChanged(object sender, EventArgs e) { checkBox22.Checked = true; }
|
||||
private void suffixComboBox23_TextChanged(object sender, EventArgs e) { checkBox23.Checked = true; }
|
||||
private void suffixComboBox24_TextChanged(object sender, EventArgs e) { checkBox24.Checked = true; }
|
||||
|
||||
|
||||
#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);
|
||||
};
|
||||
}
|
||||
|
||||
private void OnForceClose(object sender, EventArgs args)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
+652
@@ -0,0 +1,652 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
namespace TBF.Rig.DataEntry.Fewa
|
||||
{
|
||||
partial class CycleEndForm
|
||||
{
|
||||
/// <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.textBox2 = new System.Windows.Forms.TextBox();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.textBox1 = new System.Windows.Forms.TextBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.okButton = new System.Windows.Forms.Button();
|
||||
this.textBox3 = new System.Windows.Forms.TextBox();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.textBox4 = new System.Windows.Forms.TextBox();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.textBox5 = new System.Windows.Forms.TextBox();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.textBox6 = new System.Windows.Forms.TextBox();
|
||||
this.label6 = new System.Windows.Forms.Label();
|
||||
this.textBox7 = new System.Windows.Forms.TextBox();
|
||||
this.label7 = new System.Windows.Forms.Label();
|
||||
this.textBox8 = new System.Windows.Forms.TextBox();
|
||||
this.label8 = new System.Windows.Forms.Label();
|
||||
this.textBox9 = new System.Windows.Forms.TextBox();
|
||||
this.label9 = new System.Windows.Forms.Label();
|
||||
this.textBox10 = new System.Windows.Forms.TextBox();
|
||||
this.label10 = new System.Windows.Forms.Label();
|
||||
this.textBox11 = new System.Windows.Forms.TextBox();
|
||||
this.label11 = new System.Windows.Forms.Label();
|
||||
this.textBox12 = new System.Windows.Forms.TextBox();
|
||||
this.label12 = new System.Windows.Forms.Label();
|
||||
this.textBox13 = new System.Windows.Forms.TextBox();
|
||||
this.label13 = new System.Windows.Forms.Label();
|
||||
this.textBox14 = new System.Windows.Forms.TextBox();
|
||||
this.label14 = new System.Windows.Forms.Label();
|
||||
this.textBox15 = new System.Windows.Forms.TextBox();
|
||||
this.label15 = new System.Windows.Forms.Label();
|
||||
this.textBox16 = new System.Windows.Forms.TextBox();
|
||||
this.label16 = new System.Windows.Forms.Label();
|
||||
this.textBox17 = new System.Windows.Forms.TextBox();
|
||||
this.label17 = new System.Windows.Forms.Label();
|
||||
this.textBox18 = new System.Windows.Forms.TextBox();
|
||||
this.label18 = new System.Windows.Forms.Label();
|
||||
this.textBox19 = new System.Windows.Forms.TextBox();
|
||||
this.label19 = new System.Windows.Forms.Label();
|
||||
this.textBox20 = new System.Windows.Forms.TextBox();
|
||||
this.label20 = new System.Windows.Forms.Label();
|
||||
this.textBox21 = new System.Windows.Forms.TextBox();
|
||||
this.label21 = new System.Windows.Forms.Label();
|
||||
this.textBox22 = new System.Windows.Forms.TextBox();
|
||||
this.label22 = new System.Windows.Forms.Label();
|
||||
this.textBox23 = new System.Windows.Forms.TextBox();
|
||||
this.label23 = new System.Windows.Forms.Label();
|
||||
this.textBox24 = new System.Windows.Forms.TextBox();
|
||||
this.label24 = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// textBox2
|
||||
//
|
||||
this.textBox2.Location = new System.Drawing.Point(205, 66);
|
||||
this.textBox2.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
|
||||
this.textBox2.Name = "textBox2";
|
||||
this.textBox2.Size = new System.Drawing.Size(169, 27);
|
||||
this.textBox2.TabIndex = 1;
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(38, 71);
|
||||
this.label2.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(62, 18);
|
||||
this.label2.TabIndex = 0;
|
||||
this.label2.Text = "Stand:";
|
||||
//
|
||||
// textBox1
|
||||
//
|
||||
this.textBox1.Location = new System.Drawing.Point(205, 30);
|
||||
this.textBox1.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
|
||||
this.textBox1.Name = "textBox1";
|
||||
this.textBox1.Size = new System.Drawing.Size(169, 27);
|
||||
this.textBox1.TabIndex = 1;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(38, 35);
|
||||
this.label1.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(62, 18);
|
||||
this.label1.TabIndex = 0;
|
||||
this.label1.Text = "Stand:";
|
||||
//
|
||||
// okButton
|
||||
//
|
||||
this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
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(832, 30);
|
||||
this.okButton.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
|
||||
this.okButton.Name = "okButton";
|
||||
this.okButton.Size = new System.Drawing.Size(90, 60);
|
||||
this.okButton.TabIndex = 7;
|
||||
this.okButton.Text = "OK";
|
||||
this.okButton.UseVisualStyleBackColor = true;
|
||||
this.okButton.Click += new System.EventHandler(this.okButton_Click);
|
||||
//
|
||||
// textBox3
|
||||
//
|
||||
this.textBox3.Location = new System.Drawing.Point(205, 102);
|
||||
this.textBox3.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
|
||||
this.textBox3.Name = "textBox3";
|
||||
this.textBox3.Size = new System.Drawing.Size(169, 27);
|
||||
this.textBox3.TabIndex = 1;
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(38, 107);
|
||||
this.label3.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(62, 18);
|
||||
this.label3.TabIndex = 0;
|
||||
this.label3.Text = "Stand:";
|
||||
//
|
||||
// textBox4
|
||||
//
|
||||
this.textBox4.Location = new System.Drawing.Point(205, 138);
|
||||
this.textBox4.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
|
||||
this.textBox4.Name = "textBox4";
|
||||
this.textBox4.Size = new System.Drawing.Size(169, 27);
|
||||
this.textBox4.TabIndex = 1;
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Location = new System.Drawing.Point(38, 143);
|
||||
this.label4.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(62, 18);
|
||||
this.label4.TabIndex = 0;
|
||||
this.label4.Text = "Stand:";
|
||||
//
|
||||
// textBox5
|
||||
//
|
||||
this.textBox5.Location = new System.Drawing.Point(205, 174);
|
||||
this.textBox5.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
|
||||
this.textBox5.Name = "textBox5";
|
||||
this.textBox5.Size = new System.Drawing.Size(169, 27);
|
||||
this.textBox5.TabIndex = 1;
|
||||
//
|
||||
// label5
|
||||
//
|
||||
this.label5.AutoSize = true;
|
||||
this.label5.Location = new System.Drawing.Point(38, 179);
|
||||
this.label5.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
|
||||
this.label5.Name = "label5";
|
||||
this.label5.Size = new System.Drawing.Size(62, 18);
|
||||
this.label5.TabIndex = 0;
|
||||
this.label5.Text = "Stand:";
|
||||
//
|
||||
// textBox6
|
||||
//
|
||||
this.textBox6.Location = new System.Drawing.Point(205, 210);
|
||||
this.textBox6.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
|
||||
this.textBox6.Name = "textBox6";
|
||||
this.textBox6.Size = new System.Drawing.Size(169, 27);
|
||||
this.textBox6.TabIndex = 1;
|
||||
//
|
||||
// label6
|
||||
//
|
||||
this.label6.AutoSize = true;
|
||||
this.label6.Location = new System.Drawing.Point(38, 215);
|
||||
this.label6.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
|
||||
this.label6.Name = "label6";
|
||||
this.label6.Size = new System.Drawing.Size(62, 18);
|
||||
this.label6.TabIndex = 0;
|
||||
this.label6.Text = "Stand:";
|
||||
//
|
||||
// textBox7
|
||||
//
|
||||
this.textBox7.Location = new System.Drawing.Point(205, 246);
|
||||
this.textBox7.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
|
||||
this.textBox7.Name = "textBox7";
|
||||
this.textBox7.Size = new System.Drawing.Size(169, 27);
|
||||
this.textBox7.TabIndex = 9;
|
||||
//
|
||||
// label7
|
||||
//
|
||||
this.label7.AutoSize = true;
|
||||
this.label7.Location = new System.Drawing.Point(38, 251);
|
||||
this.label7.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
|
||||
this.label7.Name = "label7";
|
||||
this.label7.Size = new System.Drawing.Size(62, 18);
|
||||
this.label7.TabIndex = 8;
|
||||
this.label7.Text = "Stand:";
|
||||
//
|
||||
// textBox8
|
||||
//
|
||||
this.textBox8.Location = new System.Drawing.Point(205, 282);
|
||||
this.textBox8.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
|
||||
this.textBox8.Name = "textBox8";
|
||||
this.textBox8.Size = new System.Drawing.Size(169, 27);
|
||||
this.textBox8.TabIndex = 11;
|
||||
//
|
||||
// label8
|
||||
//
|
||||
this.label8.AutoSize = true;
|
||||
this.label8.Location = new System.Drawing.Point(38, 287);
|
||||
this.label8.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
|
||||
this.label8.Name = "label8";
|
||||
this.label8.Size = new System.Drawing.Size(62, 18);
|
||||
this.label8.TabIndex = 10;
|
||||
this.label8.Text = "Stand:";
|
||||
//
|
||||
// textBox9
|
||||
//
|
||||
this.textBox9.Location = new System.Drawing.Point(205, 318);
|
||||
this.textBox9.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
|
||||
this.textBox9.Name = "textBox9";
|
||||
this.textBox9.Size = new System.Drawing.Size(169, 27);
|
||||
this.textBox9.TabIndex = 13;
|
||||
//
|
||||
// label9
|
||||
//
|
||||
this.label9.AutoSize = true;
|
||||
this.label9.Location = new System.Drawing.Point(38, 323);
|
||||
this.label9.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
|
||||
this.label9.Name = "label9";
|
||||
this.label9.Size = new System.Drawing.Size(62, 18);
|
||||
this.label9.TabIndex = 12;
|
||||
this.label9.Text = "Stand:";
|
||||
//
|
||||
// textBox10
|
||||
//
|
||||
this.textBox10.Location = new System.Drawing.Point(205, 354);
|
||||
this.textBox10.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
|
||||
this.textBox10.Name = "textBox10";
|
||||
this.textBox10.Size = new System.Drawing.Size(169, 27);
|
||||
this.textBox10.TabIndex = 15;
|
||||
//
|
||||
// label10
|
||||
//
|
||||
this.label10.AutoSize = true;
|
||||
this.label10.Location = new System.Drawing.Point(38, 359);
|
||||
this.label10.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
|
||||
this.label10.Name = "label10";
|
||||
this.label10.Size = new System.Drawing.Size(62, 18);
|
||||
this.label10.TabIndex = 14;
|
||||
this.label10.Text = "Stand:";
|
||||
//
|
||||
// textBox11
|
||||
//
|
||||
this.textBox11.Location = new System.Drawing.Point(205, 390);
|
||||
this.textBox11.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
|
||||
this.textBox11.Name = "textBox11";
|
||||
this.textBox11.Size = new System.Drawing.Size(169, 27);
|
||||
this.textBox11.TabIndex = 17;
|
||||
//
|
||||
// label11
|
||||
//
|
||||
this.label11.AutoSize = true;
|
||||
this.label11.Location = new System.Drawing.Point(38, 395);
|
||||
this.label11.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
|
||||
this.label11.Name = "label11";
|
||||
this.label11.Size = new System.Drawing.Size(62, 18);
|
||||
this.label11.TabIndex = 16;
|
||||
this.label11.Text = "Stand:";
|
||||
//
|
||||
// textBox12
|
||||
//
|
||||
this.textBox12.Location = new System.Drawing.Point(205, 426);
|
||||
this.textBox12.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
|
||||
this.textBox12.Name = "textBox12";
|
||||
this.textBox12.Size = new System.Drawing.Size(169, 27);
|
||||
this.textBox12.TabIndex = 19;
|
||||
//
|
||||
// label12
|
||||
//
|
||||
this.label12.AutoSize = true;
|
||||
this.label12.Location = new System.Drawing.Point(38, 431);
|
||||
this.label12.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
|
||||
this.label12.Name = "label12";
|
||||
this.label12.Size = new System.Drawing.Size(62, 18);
|
||||
this.label12.TabIndex = 18;
|
||||
this.label12.Text = "Stand:";
|
||||
//
|
||||
// textBox13
|
||||
//
|
||||
this.textBox13.Location = new System.Drawing.Point(623, 30);
|
||||
this.textBox13.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
|
||||
this.textBox13.Name = "textBox13";
|
||||
this.textBox13.Size = new System.Drawing.Size(169, 27);
|
||||
this.textBox13.TabIndex = 21;
|
||||
//
|
||||
// label13
|
||||
//
|
||||
this.label13.AutoSize = true;
|
||||
this.label13.Location = new System.Drawing.Point(456, 35);
|
||||
this.label13.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
|
||||
this.label13.Name = "label13";
|
||||
this.label13.Size = new System.Drawing.Size(62, 18);
|
||||
this.label13.TabIndex = 20;
|
||||
this.label13.Text = "Stand:";
|
||||
//
|
||||
// textBox14
|
||||
//
|
||||
this.textBox14.Location = new System.Drawing.Point(623, 66);
|
||||
this.textBox14.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
|
||||
this.textBox14.Name = "textBox14";
|
||||
this.textBox14.Size = new System.Drawing.Size(169, 27);
|
||||
this.textBox14.TabIndex = 23;
|
||||
//
|
||||
// label14
|
||||
//
|
||||
this.label14.AutoSize = true;
|
||||
this.label14.Location = new System.Drawing.Point(456, 71);
|
||||
this.label14.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
|
||||
this.label14.Name = "label14";
|
||||
this.label14.Size = new System.Drawing.Size(62, 18);
|
||||
this.label14.TabIndex = 22;
|
||||
this.label14.Text = "Stand:";
|
||||
//
|
||||
// textBox15
|
||||
//
|
||||
this.textBox15.Location = new System.Drawing.Point(623, 102);
|
||||
this.textBox15.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
|
||||
this.textBox15.Name = "textBox15";
|
||||
this.textBox15.Size = new System.Drawing.Size(169, 27);
|
||||
this.textBox15.TabIndex = 25;
|
||||
//
|
||||
// label15
|
||||
//
|
||||
this.label15.AutoSize = true;
|
||||
this.label15.Location = new System.Drawing.Point(456, 107);
|
||||
this.label15.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
|
||||
this.label15.Name = "label15";
|
||||
this.label15.Size = new System.Drawing.Size(62, 18);
|
||||
this.label15.TabIndex = 24;
|
||||
this.label15.Text = "Stand:";
|
||||
//
|
||||
// textBox16
|
||||
//
|
||||
this.textBox16.Location = new System.Drawing.Point(623, 138);
|
||||
this.textBox16.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
|
||||
this.textBox16.Name = "textBox16";
|
||||
this.textBox16.Size = new System.Drawing.Size(169, 27);
|
||||
this.textBox16.TabIndex = 27;
|
||||
//
|
||||
// label16
|
||||
//
|
||||
this.label16.AutoSize = true;
|
||||
this.label16.Location = new System.Drawing.Point(456, 143);
|
||||
this.label16.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
|
||||
this.label16.Name = "label16";
|
||||
this.label16.Size = new System.Drawing.Size(62, 18);
|
||||
this.label16.TabIndex = 26;
|
||||
this.label16.Text = "Stand:";
|
||||
//
|
||||
// textBox17
|
||||
//
|
||||
this.textBox17.Location = new System.Drawing.Point(623, 174);
|
||||
this.textBox17.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
|
||||
this.textBox17.Name = "textBox17";
|
||||
this.textBox17.Size = new System.Drawing.Size(169, 27);
|
||||
this.textBox17.TabIndex = 29;
|
||||
//
|
||||
// label17
|
||||
//
|
||||
this.label17.AutoSize = true;
|
||||
this.label17.Location = new System.Drawing.Point(456, 179);
|
||||
this.label17.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
|
||||
this.label17.Name = "label17";
|
||||
this.label17.Size = new System.Drawing.Size(62, 18);
|
||||
this.label17.TabIndex = 28;
|
||||
this.label17.Text = "Stand:";
|
||||
//
|
||||
// textBox18
|
||||
//
|
||||
this.textBox18.Location = new System.Drawing.Point(623, 210);
|
||||
this.textBox18.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
|
||||
this.textBox18.Name = "textBox18";
|
||||
this.textBox18.Size = new System.Drawing.Size(169, 27);
|
||||
this.textBox18.TabIndex = 31;
|
||||
//
|
||||
// label18
|
||||
//
|
||||
this.label18.AutoSize = true;
|
||||
this.label18.Location = new System.Drawing.Point(456, 215);
|
||||
this.label18.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
|
||||
this.label18.Name = "label18";
|
||||
this.label18.Size = new System.Drawing.Size(62, 18);
|
||||
this.label18.TabIndex = 30;
|
||||
this.label18.Text = "Stand:";
|
||||
//
|
||||
// textBox19
|
||||
//
|
||||
this.textBox19.Location = new System.Drawing.Point(623, 246);
|
||||
this.textBox19.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
|
||||
this.textBox19.Name = "textBox19";
|
||||
this.textBox19.Size = new System.Drawing.Size(169, 27);
|
||||
this.textBox19.TabIndex = 33;
|
||||
//
|
||||
// label19
|
||||
//
|
||||
this.label19.AutoSize = true;
|
||||
this.label19.Location = new System.Drawing.Point(456, 251);
|
||||
this.label19.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
|
||||
this.label19.Name = "label19";
|
||||
this.label19.Size = new System.Drawing.Size(62, 18);
|
||||
this.label19.TabIndex = 32;
|
||||
this.label19.Text = "Stand:";
|
||||
//
|
||||
// textBox20
|
||||
//
|
||||
this.textBox20.Location = new System.Drawing.Point(623, 282);
|
||||
this.textBox20.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
|
||||
this.textBox20.Name = "textBox20";
|
||||
this.textBox20.Size = new System.Drawing.Size(169, 27);
|
||||
this.textBox20.TabIndex = 35;
|
||||
//
|
||||
// label20
|
||||
//
|
||||
this.label20.AutoSize = true;
|
||||
this.label20.Location = new System.Drawing.Point(456, 287);
|
||||
this.label20.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
|
||||
this.label20.Name = "label20";
|
||||
this.label20.Size = new System.Drawing.Size(62, 18);
|
||||
this.label20.TabIndex = 34;
|
||||
this.label20.Text = "Stand:";
|
||||
//
|
||||
// textBox21
|
||||
//
|
||||
this.textBox21.Location = new System.Drawing.Point(623, 318);
|
||||
this.textBox21.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
|
||||
this.textBox21.Name = "textBox21";
|
||||
this.textBox21.Size = new System.Drawing.Size(169, 27);
|
||||
this.textBox21.TabIndex = 37;
|
||||
//
|
||||
// label21
|
||||
//
|
||||
this.label21.AutoSize = true;
|
||||
this.label21.Location = new System.Drawing.Point(456, 323);
|
||||
this.label21.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
|
||||
this.label21.Name = "label21";
|
||||
this.label21.Size = new System.Drawing.Size(62, 18);
|
||||
this.label21.TabIndex = 36;
|
||||
this.label21.Text = "Stand:";
|
||||
//
|
||||
// textBox22
|
||||
//
|
||||
this.textBox22.Location = new System.Drawing.Point(623, 354);
|
||||
this.textBox22.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
|
||||
this.textBox22.Name = "textBox22";
|
||||
this.textBox22.Size = new System.Drawing.Size(169, 27);
|
||||
this.textBox22.TabIndex = 39;
|
||||
//
|
||||
// label22
|
||||
//
|
||||
this.label22.AutoSize = true;
|
||||
this.label22.Location = new System.Drawing.Point(456, 359);
|
||||
this.label22.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
|
||||
this.label22.Name = "label22";
|
||||
this.label22.Size = new System.Drawing.Size(62, 18);
|
||||
this.label22.TabIndex = 38;
|
||||
this.label22.Text = "Stand:";
|
||||
//
|
||||
// textBox23
|
||||
//
|
||||
this.textBox23.Location = new System.Drawing.Point(623, 390);
|
||||
this.textBox23.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
|
||||
this.textBox23.Name = "textBox23";
|
||||
this.textBox23.Size = new System.Drawing.Size(169, 27);
|
||||
this.textBox23.TabIndex = 41;
|
||||
//
|
||||
// label23
|
||||
//
|
||||
this.label23.AutoSize = true;
|
||||
this.label23.Location = new System.Drawing.Point(456, 395);
|
||||
this.label23.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
|
||||
this.label23.Name = "label23";
|
||||
this.label23.Size = new System.Drawing.Size(62, 18);
|
||||
this.label23.TabIndex = 40;
|
||||
this.label23.Text = "Stand:";
|
||||
//
|
||||
// textBox24
|
||||
//
|
||||
this.textBox24.Location = new System.Drawing.Point(623, 426);
|
||||
this.textBox24.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
|
||||
this.textBox24.Name = "textBox24";
|
||||
this.textBox24.Size = new System.Drawing.Size(169, 27);
|
||||
this.textBox24.TabIndex = 43;
|
||||
//
|
||||
// label24
|
||||
//
|
||||
this.label24.AutoSize = true;
|
||||
this.label24.Location = new System.Drawing.Point(456, 431);
|
||||
this.label24.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
|
||||
this.label24.Name = "label24";
|
||||
this.label24.Size = new System.Drawing.Size(62, 18);
|
||||
this.label24.TabIndex = 42;
|
||||
this.label24.Text = "Stand:";
|
||||
//
|
||||
// CycleEndForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 18F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.DarkGray;
|
||||
this.ClientSize = new System.Drawing.Size(959, 489);
|
||||
this.Controls.Add(this.textBox24);
|
||||
this.Controls.Add(this.label24);
|
||||
this.Controls.Add(this.textBox23);
|
||||
this.Controls.Add(this.label23);
|
||||
this.Controls.Add(this.textBox22);
|
||||
this.Controls.Add(this.label22);
|
||||
this.Controls.Add(this.textBox21);
|
||||
this.Controls.Add(this.label21);
|
||||
this.Controls.Add(this.textBox20);
|
||||
this.Controls.Add(this.label20);
|
||||
this.Controls.Add(this.textBox19);
|
||||
this.Controls.Add(this.label19);
|
||||
this.Controls.Add(this.textBox18);
|
||||
this.Controls.Add(this.label18);
|
||||
this.Controls.Add(this.textBox17);
|
||||
this.Controls.Add(this.label17);
|
||||
this.Controls.Add(this.textBox16);
|
||||
this.Controls.Add(this.label16);
|
||||
this.Controls.Add(this.textBox15);
|
||||
this.Controls.Add(this.label15);
|
||||
this.Controls.Add(this.textBox14);
|
||||
this.Controls.Add(this.label14);
|
||||
this.Controls.Add(this.textBox13);
|
||||
this.Controls.Add(this.label13);
|
||||
this.Controls.Add(this.textBox12);
|
||||
this.Controls.Add(this.label12);
|
||||
this.Controls.Add(this.textBox11);
|
||||
this.Controls.Add(this.label11);
|
||||
this.Controls.Add(this.textBox10);
|
||||
this.Controls.Add(this.label10);
|
||||
this.Controls.Add(this.textBox9);
|
||||
this.Controls.Add(this.label9);
|
||||
this.Controls.Add(this.textBox8);
|
||||
this.Controls.Add(this.label8);
|
||||
this.Controls.Add(this.textBox7);
|
||||
this.Controls.Add(this.label7);
|
||||
this.Controls.Add(this.textBox6);
|
||||
this.Controls.Add(this.label6);
|
||||
this.Controls.Add(this.textBox5);
|
||||
this.Controls.Add(this.label5);
|
||||
this.Controls.Add(this.textBox4);
|
||||
this.Controls.Add(this.label4);
|
||||
this.Controls.Add(this.textBox3);
|
||||
this.Controls.Add(this.label3);
|
||||
this.Controls.Add(this.textBox2);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.textBox1);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.okButton);
|
||||
this.Font = new System.Drawing.Font("Verdana", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
|
||||
this.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
|
||||
this.Name = "CycleEndForm";
|
||||
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
|
||||
this.Text = "Daten";
|
||||
this.TopMost = true;
|
||||
this.Load += new System.EventHandler(this.CycleEndForm_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TextBox textBox2;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.TextBox textBox1;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Button okButton;
|
||||
private System.Windows.Forms.TextBox textBox3;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.TextBox textBox4;
|
||||
private System.Windows.Forms.Label label4;
|
||||
private System.Windows.Forms.TextBox textBox5;
|
||||
private System.Windows.Forms.Label label5;
|
||||
private System.Windows.Forms.TextBox textBox6;
|
||||
private System.Windows.Forms.Label label6;
|
||||
private System.Windows.Forms.TextBox textBox7;
|
||||
private System.Windows.Forms.Label label7;
|
||||
private System.Windows.Forms.TextBox textBox8;
|
||||
private System.Windows.Forms.Label label8;
|
||||
private System.Windows.Forms.TextBox textBox9;
|
||||
private System.Windows.Forms.Label label9;
|
||||
private System.Windows.Forms.TextBox textBox10;
|
||||
private System.Windows.Forms.Label label10;
|
||||
private System.Windows.Forms.TextBox textBox11;
|
||||
private System.Windows.Forms.Label label11;
|
||||
private System.Windows.Forms.TextBox textBox12;
|
||||
private System.Windows.Forms.Label label12;
|
||||
private System.Windows.Forms.TextBox textBox13;
|
||||
private System.Windows.Forms.Label label13;
|
||||
private System.Windows.Forms.TextBox textBox14;
|
||||
private System.Windows.Forms.Label label14;
|
||||
private System.Windows.Forms.TextBox textBox15;
|
||||
private System.Windows.Forms.Label label15;
|
||||
private System.Windows.Forms.TextBox textBox16;
|
||||
private System.Windows.Forms.Label label16;
|
||||
private System.Windows.Forms.TextBox textBox17;
|
||||
private System.Windows.Forms.Label label17;
|
||||
private System.Windows.Forms.TextBox textBox18;
|
||||
private System.Windows.Forms.Label label18;
|
||||
private System.Windows.Forms.TextBox textBox19;
|
||||
private System.Windows.Forms.Label label19;
|
||||
private System.Windows.Forms.TextBox textBox20;
|
||||
private System.Windows.Forms.Label label20;
|
||||
private System.Windows.Forms.TextBox textBox21;
|
||||
private System.Windows.Forms.Label label21;
|
||||
private System.Windows.Forms.TextBox textBox22;
|
||||
private System.Windows.Forms.Label label22;
|
||||
private System.Windows.Forms.TextBox textBox23;
|
||||
private System.Windows.Forms.Label label23;
|
||||
private System.Windows.Forms.TextBox textBox24;
|
||||
private System.Windows.Forms.Label label24;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,155 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using log4net;
|
||||
using TBF.Resources;
|
||||
|
||||
namespace TBF.Rig.DataEntry.Fewa
|
||||
{
|
||||
public partial class CycleEndForm : Form, GenericDevices.IHasCompleted
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(CycleEndForm));
|
||||
|
||||
/// <summary> Number of text boxes for serial numbers </summary>
|
||||
public readonly int WMsCount;
|
||||
readonly int lineSize;
|
||||
|
||||
// To be retrieved after the form closes
|
||||
public string[] EndStateText;
|
||||
|
||||
// Set to 'true' when the form closes
|
||||
public bool Completed { get { return completed; } }
|
||||
bool completed;
|
||||
|
||||
int textBoxesCount;
|
||||
Label[] labels;
|
||||
TextBox[] textBoxes;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="waterMetersCount">Number of text boxes for serial numbers</param>
|
||||
public CycleEndForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
ControlBox = false;
|
||||
|
||||
labels = new Label[]
|
||||
{
|
||||
label1, label2, label3, label4, label5, label6, label7, label8, label9, label10,
|
||||
label11, label12, label13, label14, label15, label16, label17, label18, label19, label20,
|
||||
label21, label22, label23, label24,
|
||||
};
|
||||
textBoxes = new TextBox[]
|
||||
{
|
||||
textBox1, textBox2, textBox3, textBox4, textBox5, textBox6,
|
||||
textBox7, textBox8, textBox9, textBox10, textBox11, textBox12,
|
||||
textBox13, textBox14, textBox15, textBox16, textBox17, textBox18,
|
||||
textBox19, textBox20, textBox21, textBox22, textBox23, textBox24,
|
||||
};
|
||||
textBoxesCount = textBoxes.Length;
|
||||
this.WMsCount = textBoxesCount;
|
||||
this.lineSize = textBoxesCount / 2;
|
||||
|
||||
completed = false;
|
||||
StartForceCloseHandler();
|
||||
}
|
||||
|
||||
/// <summary> Parameterless constructor for 3 watermeters </summary>
|
||||
public CycleEndForm(int waterMetersCount, int lineSize)
|
||||
: this()
|
||||
{
|
||||
this.WMsCount = waterMetersCount;
|
||||
this.lineSize = lineSize;
|
||||
ShuffleTextBoxes(waterMetersCount, lineSize);
|
||||
EndStateText = new string[WMsCount];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Make sure the layout of labels/text boxes on the screen
|
||||
/// corresponds to the layout of watermeters of the test bench.
|
||||
/// </summary>
|
||||
/// <param name="wmsCount">Number of watermeters</param>
|
||||
/// <param name="lineSize">Number of watermeters in one line</param>
|
||||
void ShuffleTextBoxes(int wmsCount, int lineSize)
|
||||
{
|
||||
if (wmsCount < textBoxesCount && lineSize > 0)
|
||||
{
|
||||
int nrLines = (wmsCount + lineSize - 1) / lineSize;
|
||||
int gap = (textBoxesCount - wmsCount) / nrLines;
|
||||
|
||||
int dest = 0;
|
||||
for (int l = 0; l < nrLines; l++)
|
||||
{
|
||||
for (int i = 0; i < lineSize; i++)
|
||||
{
|
||||
labels[dest] = labels[l * lineSize + l * gap + i];
|
||||
textBoxes[dest] = textBoxes[l * lineSize + l * gap + i];
|
||||
dest++;
|
||||
}
|
||||
}
|
||||
textBoxesCount = wmsCount;
|
||||
}
|
||||
}
|
||||
|
||||
private void CycleEndForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
Localize();
|
||||
|
||||
Height = 60 + 36 * lineSize;
|
||||
|
||||
for (int i = 0; i < textBoxesCount; i++)
|
||||
{
|
||||
if (i >= WMsCount)
|
||||
{
|
||||
labels[i].Visible = false;
|
||||
textBoxes[i].Visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Localize()
|
||||
{
|
||||
Text = Strings.Data;
|
||||
okButton.Text = Strings.OkBtnText;
|
||||
|
||||
for (int i = 0; i < WMsCount; i++)
|
||||
{
|
||||
labels[i].Text = string.Format("{0} {1}:", Strings.Water_Meter, (i + 1).ToString());
|
||||
}
|
||||
}
|
||||
|
||||
private void okButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
for (int i = 0; i < WMsCount; i++)
|
||||
{
|
||||
EndStateText[i] = textBoxes[i].Text;
|
||||
}
|
||||
|
||||
completed = true;
|
||||
Close();
|
||||
}
|
||||
|
||||
#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
|
||||
}
|
||||
}
|
||||
@@ -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>
|
||||
@@ -0,0 +1,20 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using TBF.Rig.GenericDevices;
|
||||
|
||||
namespace TBF.Rig.DataEntry.Fewa
|
||||
{
|
||||
public class EntryForm : EntryFormNoStartEnd, IHasWMStatesForm
|
||||
{
|
||||
public EntryForm()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
|
||||
public EntryForm(Generic.IComponentCfg cfg)
|
||||
: base(cfg)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Xml.Serialization;
|
||||
using TBF.Rig.Generic;
|
||||
|
||||
namespace TBF.Rig.DataEntry.Fewa
|
||||
{
|
||||
public class EntryFormCfg : ComponentCfgBase, Generic.IComponentCfg
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(EntryFormCfg) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
public IComponentCfgCtrl GetControl(IList<Config.Entities.Component> cmpntEntities) { return new EntryFormCfgCtrl(); }
|
||||
|
||||
///
|
||||
/// Serialized parameters
|
||||
///
|
||||
public bool EnterSerialNrsAtTheEnd;
|
||||
public bool ShowCycleEndForm;
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
EntryFormCfg()
|
||||
{
|
||||
Name = "DataEntry-FEWA";
|
||||
ParentName = string.Empty;
|
||||
EnterSerialNrsAtTheEnd = false;
|
||||
ShowCycleEndForm = false;
|
||||
}
|
||||
|
||||
public EntryFormCfg(IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
this.Factory = factory;
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("Name={0}, EnterSNsAtTheEnd={1}, ShowEndForm={2}", Name, EnterSerialNrsAtTheEnd, ShowCycleEndForm);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
using TBF.Rig.Generic;
|
||||
using TBF.Resources;
|
||||
|
||||
namespace TBF.Rig.DataEntry.Fewa
|
||||
{
|
||||
public partial class EntryFormCfgCtrl : UserControl, IComponentCfgCtrl
|
||||
{
|
||||
public bool ShowMore { get { return false; } }
|
||||
|
||||
EntryFormCfg config;
|
||||
public IComponentCfg Config
|
||||
{
|
||||
get { return config as IComponentCfg; }
|
||||
set
|
||||
{
|
||||
config = value as EntryFormCfg;
|
||||
Redraw();
|
||||
}
|
||||
}
|
||||
|
||||
public EntryFormCfgCtrl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void EntryFormCfgCtrl_Load(object sender, EventArgs e)
|
||||
{
|
||||
Localize();
|
||||
Redraw();
|
||||
}
|
||||
|
||||
void Localize()
|
||||
{
|
||||
enterSNsAtTheEndCheckBox.Text = Strings.Enter_SNs_at_the_end;
|
||||
showEndStateFormCheckBox.Text = Strings.Show_cycle_end_form;
|
||||
}
|
||||
|
||||
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;
|
||||
enterSNsAtTheEndCheckBox.Checked = config.EnterSerialNrsAtTheEnd;
|
||||
showEndStateFormCheckBox.Checked = config.ShowCycleEndForm;
|
||||
}
|
||||
|
||||
public void Unlock()
|
||||
{
|
||||
nameTextBox.Enabled = true;
|
||||
enterSNsAtTheEndCheckBox.Enabled = true;
|
||||
showEndStateFormCheckBox.Enabled = true;
|
||||
}
|
||||
|
||||
public CfgUpdateFlags VerifyCfg(ref string message)
|
||||
{
|
||||
CfgUpdateFlags flags = CfgUpdateFlags.None;
|
||||
return flags;
|
||||
}
|
||||
|
||||
public CfgUpdateFlags UpdateCfg()
|
||||
{
|
||||
CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd;
|
||||
|
||||
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
|
||||
|
||||
config.Name = nameTextBox.Text;
|
||||
config.EnterSerialNrsAtTheEnd = enterSNsAtTheEndCheckBox.Checked;
|
||||
config.ShowCycleEndForm = showEndStateFormCheckBox.Checked;
|
||||
|
||||
return flags;
|
||||
}
|
||||
}
|
||||
}
|
||||
+114
@@ -0,0 +1,114 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
namespace TBF.Rig.DataEntry.Fewa
|
||||
{
|
||||
partial class EntryFormCfgCtrl
|
||||
{
|
||||
/// <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 Component 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.nameTextBox = new System.Windows.Forms.TextBox();
|
||||
this.nameLabel = new System.Windows.Forms.Label();
|
||||
this.classNameLabel = new System.Windows.Forms.Label();
|
||||
this.showEndStateFormCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.enterSNsAtTheEndCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// nameTextBox
|
||||
//
|
||||
this.nameTextBox.Enabled = false;
|
||||
this.nameTextBox.Location = new System.Drawing.Point(99, 57);
|
||||
this.nameTextBox.Name = "nameTextBox";
|
||||
this.nameTextBox.Size = new System.Drawing.Size(130, 20);
|
||||
this.nameTextBox.TabIndex = 2;
|
||||
//
|
||||
// nameLabel
|
||||
//
|
||||
this.nameLabel.AutoSize = true;
|
||||
this.nameLabel.Location = new System.Drawing.Point(35, 60);
|
||||
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(96, 33);
|
||||
this.classNameLabel.Name = "classNameLabel";
|
||||
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
|
||||
this.classNameLabel.TabIndex = 0;
|
||||
this.classNameLabel.Text = "ComonentName";
|
||||
//
|
||||
// showEndStateFormCheckBox
|
||||
//
|
||||
this.showEndStateFormCheckBox.AutoSize = true;
|
||||
this.showEndStateFormCheckBox.Enabled = false;
|
||||
this.showEndStateFormCheckBox.Location = new System.Drawing.Point(99, 112);
|
||||
this.showEndStateFormCheckBox.Name = "showEndStateFormCheckBox";
|
||||
this.showEndStateFormCheckBox.Size = new System.Drawing.Size(151, 17);
|
||||
this.showEndStateFormCheckBox.TabIndex = 4;
|
||||
this.showEndStateFormCheckBox.Text = "Watermeter end state form";
|
||||
this.showEndStateFormCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// enterSNsAtTheEndCheckBox
|
||||
//
|
||||
this.enterSNsAtTheEndCheckBox.AutoSize = true;
|
||||
this.enterSNsAtTheEndCheckBox.Enabled = false;
|
||||
this.enterSNsAtTheEndCheckBox.Location = new System.Drawing.Point(99, 89);
|
||||
this.enterSNsAtTheEndCheckBox.Name = "enterSNsAtTheEndCheckBox";
|
||||
this.enterSNsAtTheEndCheckBox.Size = new System.Drawing.Size(167, 17);
|
||||
this.enterSNsAtTheEndCheckBox.TabIndex = 3;
|
||||
this.enterSNsAtTheEndCheckBox.Text = "Enter serial number at the end";
|
||||
this.enterSNsAtTheEndCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// EntryFormCfgCtrl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.enterSNsAtTheEndCheckBox);
|
||||
this.Controls.Add(this.showEndStateFormCheckBox);
|
||||
this.Controls.Add(this.nameTextBox);
|
||||
this.Controls.Add(this.nameLabel);
|
||||
this.Controls.Add(this.classNameLabel);
|
||||
this.Name = "EntryFormCfgCtrl";
|
||||
this.Size = new System.Drawing.Size(300, 200);
|
||||
this.Load += new System.EventHandler(this.EntryFormCfgCtrl_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 showEndStateFormCheckBox;
|
||||
private System.Windows.Forms.CheckBox enterSNsAtTheEndCheckBox;
|
||||
}
|
||||
}
|
||||
@@ -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>
|
||||
@@ -0,0 +1,272 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using Config.Entities;
|
||||
using TBF.Rig;
|
||||
using TBF.Rig.GenericDevices;
|
||||
|
||||
namespace TBF.Rig.DataEntry.Fewa
|
||||
{
|
||||
public class EntryFormNoStartEnd : ComponentBase, IOperation, IDataEntry, IHasCycleBeginForm, IHasCycleEndForm
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(EntryFormNoStartEnd));
|
||||
public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
|
||||
|
||||
public bool UsesCameras() { return false; }
|
||||
|
||||
readonly EntryFormCfg entryFormCfg;
|
||||
IRegReader[] regReaders;
|
||||
|
||||
/// <summary>
|
||||
/// Properties set by the Begin, End and WMStates form
|
||||
/// </summary>
|
||||
bool[] disabled; /// This array is shared between forms
|
||||
|
||||
string[] wmCycleEndState;
|
||||
public string WMCycleEndState(int wmNr) { return (wmNr >= 0 && wmNr < wmCycleEndState.Length) ? wmCycleEndState[wmNr] : string.Empty; }
|
||||
|
||||
double[] wmStartState;
|
||||
public double WMStartState(int wmNr) { return (wmNr >= 0 && wmNr < wmStartState.Length) ? wmStartState[wmNr] : 0; }
|
||||
|
||||
double[] wmEndState;
|
||||
public double WMEndState(int wmNr) { return (wmNr >= 0 && wmNr < wmEndState.Length) ? wmEndState[wmNr] : 0; }
|
||||
|
||||
string[] wmStartStateStr;
|
||||
|
||||
|
||||
System.Windows.Forms.Form modelessDlg;
|
||||
public bool Completed { get { return (modelessDlg is IHasCompleted) ? (modelessDlg as IHasCompleted).Completed : true; } }
|
||||
|
||||
double refVolume;
|
||||
double errLimLo;
|
||||
double errLimHi;
|
||||
|
||||
bool resultSaved; /// Set in Run() when results are saved
|
||||
|
||||
IList<Results.Entities.WaterMeter> waterMeters; /// Reference to ...ProcessData.BatchRslts.WaterMeters[]
|
||||
|
||||
public enum CurrentOp
|
||||
{
|
||||
None,
|
||||
ShowFormAtCycleBeginning,
|
||||
ShowFormAtCycleEnd,
|
||||
EnterTestStartStates,
|
||||
EnterTestEndStates,
|
||||
}
|
||||
|
||||
CurrentOp currentOp;
|
||||
|
||||
|
||||
public EntryFormNoStartEnd() { }
|
||||
|
||||
public EntryFormNoStartEnd(Generic.IComponentCfg cfg)
|
||||
: base(cfg)
|
||||
{
|
||||
entryFormCfg = cfg as EntryFormCfg;
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
disabled = new bool[TBF.Data.WMsCount];
|
||||
wmStartState = new double[TBF.Data.WMsCount];
|
||||
wmStartStateStr = new string[TBF.Data.WMsCount];
|
||||
wmEndState = new double[TBF.Data.WMsCount];
|
||||
wmCycleEndState = new string[TBF.Data.WMsCount];
|
||||
currentOp = CurrentOp.None;
|
||||
log.FatalFormat("{0} initialized: {1}", Name, this);
|
||||
}
|
||||
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowCycleBeginFormOp()
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
currentOp = CurrentOp.ShowFormAtCycleBeginning;
|
||||
this.waterMeters = TBF.Rig.Sequences.ProcessData.BatchRslts.Batch.WaterMeters;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowCycleEndFormOp()
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
currentOp = CurrentOp.ShowFormAtCycleEnd;
|
||||
this.waterMeters = TBF.Rig.Sequences.ProcessData.BatchRslts.Batch.WaterMeters;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowTestStartFormOp(IRegReader[] regReaders)
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
currentOp = CurrentOp.EnterTestStartStates;
|
||||
this.regReaders = regReaders;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowTestEndFormOp(IRegReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
currentOp = CurrentOp.EnterTestEndStates;
|
||||
this.regReaders = regReaders;
|
||||
this.refVolume = refVolume;
|
||||
this.errLimLo = errLimLo;
|
||||
this.errLimHi = errLimHi;
|
||||
return this;
|
||||
}
|
||||
|
||||
delegate void EntryFormDlgt(EntryFormNoStartEnd myRef);
|
||||
///
|
||||
void OpenBeginningDlg(EntryFormNoStartEnd myRef)
|
||||
{
|
||||
myRef.modelessDlg = new CycleBeginningForm(TBF.Data.WMsCount);
|
||||
modelessDlg.Show();
|
||||
}
|
||||
///
|
||||
void OpenEndDlg(EntryFormNoStartEnd myRef)
|
||||
{
|
||||
myRef.modelessDlg = new CycleEndForm(TBF.Data.WMsCount, TBF.Data.LineSize);
|
||||
modelessDlg.Show();
|
||||
}
|
||||
///
|
||||
void OpenTestStartStatesDlg(EntryFormNoStartEnd myRef)
|
||||
{
|
||||
myRef.modelessDlg = new TestStartEndForm(TBF.Data.WMsCount, myRef.regReaders, myRef.disabled);
|
||||
modelessDlg.Show();
|
||||
}
|
||||
///
|
||||
void OpenTestEndStatesDlg(EntryFormNoStartEnd myRef)
|
||||
{
|
||||
myRef.modelessDlg = new TestStartEndForm(TBF.Data.WMsCount, myRef.regReaders, wmStartStateStr, disabled, refVolume, errLimLo, errLimHi);
|
||||
modelessDlg.Show();
|
||||
}
|
||||
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
resultSaved = false;
|
||||
switch (currentOp)
|
||||
{
|
||||
case CurrentOp.ShowFormAtCycleBeginning:
|
||||
if (!entryFormCfg.EnterSerialNrsAtTheEnd)
|
||||
{
|
||||
Program.MainWnd.Invoke(new EntryFormDlgt(OpenBeginningDlg), this);
|
||||
}
|
||||
break;
|
||||
case CurrentOp.ShowFormAtCycleEnd:
|
||||
if (entryFormCfg.EnterSerialNrsAtTheEnd)
|
||||
{
|
||||
Program.MainWnd.Invoke(new EntryFormDlgt(OpenBeginningDlg), this);
|
||||
}
|
||||
else if (entryFormCfg.ShowCycleEndForm)
|
||||
{
|
||||
Program.MainWnd.Invoke(new EntryFormDlgt(OpenEndDlg), this);
|
||||
}
|
||||
break;
|
||||
case CurrentOp.EnterTestStartStates:
|
||||
Program.MainWnd.Invoke(new EntryFormDlgt(OpenTestStartStatesDlg), this);
|
||||
break;
|
||||
case CurrentOp.EnterTestEndStates:
|
||||
Program.MainWnd.Invoke(new EntryFormDlgt(OpenTestEndStatesDlg), this);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
/// <returns>Event.ResultsPrinted</returns>
|
||||
public Event Run()
|
||||
{
|
||||
if ((modelessDlg is IHasCompleted) && !(modelessDlg as IHasCompleted).Completed)
|
||||
{
|
||||
return Event.ModelessFormIsOpen;
|
||||
}
|
||||
|
||||
if (!resultSaved) /// This is to save the result only once
|
||||
{
|
||||
if ((!entryFormCfg.EnterSerialNrsAtTheEnd && currentOp == CurrentOp.ShowFormAtCycleBeginning) ||
|
||||
(entryFormCfg.EnterSerialNrsAtTheEnd && currentOp == CurrentOp.ShowFormAtCycleEnd))
|
||||
{
|
||||
CycleBeginningForm dlg = (modelessDlg as CycleBeginningForm);
|
||||
if (dlg != null)
|
||||
{
|
||||
for (int i = 0; i < Math.Min(dlg.WMsCount, waterMeters.Count); i++)
|
||||
{
|
||||
if (waterMeters[i] != null)
|
||||
{
|
||||
waterMeters[i].Disabled = disabled[i] = dlg.Disabled[i];
|
||||
waterMeters[i].SerialNr = dlg.SNText[i];
|
||||
waterMeters[i].SerialNrAux = dlg.SN2Text[i];
|
||||
if (dlg.PurchaseOrder != null) waterMeters[i].PurchaseOrder = dlg.PurchaseOrder;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (entryFormCfg.ShowCycleEndForm && currentOp == CurrentOp.ShowFormAtCycleEnd)
|
||||
{
|
||||
CycleEndForm dlg = (modelessDlg as CycleEndForm);
|
||||
int count = waterMeters.Count;
|
||||
if ((dlg != null) && (count > dlg.WMsCount)) count = dlg.WMsCount;
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
if (waterMeters[i] != null)
|
||||
{
|
||||
/// In case entryFormCfg.ShowCycleEndForm == false dlg would be null, values would be string.Empty
|
||||
wmCycleEndState[i] = waterMeters[i].EndState = (dlg != null) ? dlg.EndStateText[i] : string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (modelessDlg is TestStartEndForm && currentOp == CurrentOp.EnterTestStartStates)
|
||||
{
|
||||
/// Fixed start test - start
|
||||
TestStartEndForm dlg = (modelessDlg as TestStartEndForm);
|
||||
if (dlg != null)
|
||||
{
|
||||
for (int i = 0; i < dlg.WMsCount; i++)
|
||||
{
|
||||
if (!(((i < disabled.Length) && disabled[i]) || ((i < regReaders.Length) && (regReaders[i] == null))))
|
||||
{
|
||||
wmStartState[i] = dlg.WMStartState[i];
|
||||
wmStartStateStr[i] = dlg.WMStartStateStr[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (modelessDlg is TestStartEndForm && currentOp == CurrentOp.EnterTestEndStates)
|
||||
{
|
||||
/// Fixed start test - end
|
||||
TestStartEndForm dlg = (modelessDlg as TestStartEndForm);
|
||||
if (dlg != null)
|
||||
{
|
||||
for (int i = 0; i < dlg.WMsCount; i++)
|
||||
{
|
||||
if (!(((i < disabled.Length) && disabled[i]) || ((i < regReaders.Length) && (regReaders[i] == null))))
|
||||
{
|
||||
wmEndState[i] = dlg.WMEndState[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
resultSaved = true;
|
||||
modelessDlg = null;
|
||||
}
|
||||
|
||||
return Event.ModelessFormClosed; /// Form closed
|
||||
}
|
||||
|
||||
/// <summary>Stop this operation</summary>
|
||||
public void Stop()
|
||||
{
|
||||
if (modelessDlg is IHasCompleted)
|
||||
{
|
||||
UiBridge.Bridge.OnCloseModelessForm(this, null);
|
||||
modelessDlg = null;
|
||||
}
|
||||
currentOp = CurrentOp.None;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using TBF.Rig.Generic;
|
||||
|
||||
namespace TBF.Rig.DataEntry.Fewa
|
||||
{
|
||||
public class Factory : IComponentFactory
|
||||
{
|
||||
public string ClassName { get { return "DataEntry.Fewa"; } }
|
||||
|
||||
public IComponent DummyComponent() { return new EntryFormNoStartEnd(); }
|
||||
|
||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new EntryForm(cfg); }
|
||||
|
||||
public IComponentCfg DefaultConfig() { return new EntryFormCfg(this); }
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
||||
{
|
||||
return ComponentCfgBase.CreateFromDbEntity(EntryFormCfg.Serializer, component, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using TBF.Rig.Generic;
|
||||
|
||||
namespace TBF.Rig.DataEntry.Fewa
|
||||
{
|
||||
public class FactoryNoStartEnd : IComponentFactory
|
||||
{
|
||||
public string ClassName { get { return "DataEntry.Fewa.NoStartEnd"; } }
|
||||
|
||||
public IComponent DummyComponent() { return new EntryFormNoStartEnd(); }
|
||||
|
||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new EntryFormNoStartEnd(cfg); }
|
||||
|
||||
public IComponentCfg DefaultConfig() { return new EntryFormCfg(this); }
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
||||
{
|
||||
return ComponentCfgBase.CreateFromDbEntity(EntryFormCfg.Serializer, component, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,533 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
using log4net;
|
||||
using TBF.Rig.GenericDevices;
|
||||
using TBF.Resources;
|
||||
|
||||
namespace TBF.Rig.DataEntry.Fewa
|
||||
{
|
||||
public partial class TestStartEndForm : Form, GenericDevices.IHasCompleted
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(TestStartEndForm));
|
||||
|
||||
// Set to 'true' when the form closes
|
||||
public bool Completed { get { return completed; } }
|
||||
bool completed;
|
||||
|
||||
/// <summary> Number of text boxes for serial numbers </summary>
|
||||
public readonly int WMsCount;
|
||||
readonly IRegReader[] regReaders;
|
||||
readonly bool[] disabled;
|
||||
|
||||
// To be retrieved after the form closes
|
||||
public double[] WMStartState;
|
||||
|
||||
// To be retrieved after the form closes
|
||||
public readonly string[] WMStartStateStr;
|
||||
|
||||
// To be retrieved after the form closes
|
||||
public double[] WMEndState;
|
||||
|
||||
bool endStates; /// false=start states, true=end states
|
||||
double refVolume;
|
||||
double warningLimLo; /// limit to display exclamation mark, typically 2x errLimLo
|
||||
double warningLimHi; /// limit to display exclamation mark, typically 2x errLimHi
|
||||
bool fixedErrorLimits; /// false in case of calculated error limits
|
||||
|
||||
int TextBoxesCount;
|
||||
///
|
||||
Label[] labels;
|
||||
TextBox[] startTextBoxes;
|
||||
TextBox[] endTextBoxes;
|
||||
Label[] exclamations;
|
||||
|
||||
IList<TextBox> activeTextBoxes;
|
||||
IList<int> activeWmNrs;
|
||||
|
||||
/// <summary>
|
||||
/// Parameterless constructor initializing common part for start and endstate form
|
||||
/// </summary>
|
||||
public TestStartEndForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
ControlBox = false;
|
||||
|
||||
TextBoxesCount = 24;
|
||||
|
||||
labels = new Label[]
|
||||
{
|
||||
label1, label2, label3, label4, label5, label6, label7, label8, label9, label10,
|
||||
label11, label12, label13, label14, label15, label16, label17, label18, label19, label20,
|
||||
label21, label22, label23, label24,
|
||||
};
|
||||
startTextBoxes = new TextBox[]
|
||||
{
|
||||
startTextBox1, startTextBox2, startTextBox3, startTextBox4, startTextBox5, startTextBox6,
|
||||
startTextBox7, startTextBox8, startTextBox9, startTextBox10, startTextBox11, startTextBox12,
|
||||
startTextBox13, startTextBox14, startTextBox15, startTextBox16, startTextBox17, startTextBox18,
|
||||
startTextBox19, startTextBox20, startTextBox21, startTextBox22, startTextBox23, startTextBox24,
|
||||
};
|
||||
endTextBoxes = new TextBox[]
|
||||
{
|
||||
endTextBox1, endTextBox2, endTextBox3, endTextBox4, endTextBox5, endTextBox6,
|
||||
endTextBox7, endTextBox8, endTextBox9, endTextBox10, endTextBox11, endTextBox12,
|
||||
endTextBox13, endTextBox14, endTextBox15, endTextBox16, endTextBox17, endTextBox18,
|
||||
endTextBox19, endTextBox20, endTextBox21, endTextBox22, endTextBox23, endTextBox24,
|
||||
};
|
||||
exclamations = new Label[]
|
||||
{
|
||||
exclamation1, exclamation2, exclamation3, exclamation4, exclamation5, exclamation6,
|
||||
exclamation7, exclamation8, exclamation9, exclamation10, exclamation11, exclamation12,
|
||||
exclamation13, exclamation14, exclamation15, exclamation16, exclamation17, exclamation18,
|
||||
exclamation19, exclamation20, exclamation21, exclamation22, exclamation23, exclamation24,
|
||||
};
|
||||
|
||||
activeTextBoxes = new List<TextBox>();
|
||||
activeWmNrs = new List<int>();
|
||||
|
||||
completed = false;
|
||||
StartForceCloseHandler();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor to fill in start states
|
||||
/// </summary>
|
||||
/// <param name="waterMetersCount">Number of water meters</param>
|
||||
/// <param name="disabled">Information from CycleBeginningForm about availability of water meters</param>
|
||||
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, bool[] disabled)
|
||||
: this()
|
||||
{
|
||||
endStates = false;
|
||||
|
||||
this.WMsCount = waterMetersCount;
|
||||
this.regReaders = regReaders;
|
||||
this.disabled = disabled;
|
||||
|
||||
ShuffleTextBoxes();
|
||||
|
||||
WMStartState = new double[waterMetersCount];
|
||||
WMStartStateStr = new string[waterMetersCount];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor to fill in end states
|
||||
/// </summary>
|
||||
/// <param name="waterMetersCount">Number of water meters</param>
|
||||
/// <param name="wmStartStateStr">Information entered on test start</param>
|
||||
/// <param name="disabled">Information from CycleBeginningForm about availability of water meters</param>
|
||||
/// <param name="refVolume">Reference volume, it is used to verify the end state, show/hide exclamation if necessary</param>
|
||||
/// <param name="errLimLo">Error limit low, it is used to verify the end state, show/hide exclamation if necessary</param>
|
||||
/// <param name="errLimHi">Error limit high, it is used to verify the end state, show/hide exclamation if necessary</param>
|
||||
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, string[] wmStartStateStr, bool[] disabled,
|
||||
double refVolume, double errLimLo, double errLimHi)
|
||||
: this()
|
||||
{
|
||||
endStates = true;
|
||||
|
||||
this.WMsCount = waterMetersCount;
|
||||
this.regReaders = regReaders;
|
||||
if (wmStartStateStr == null || wmStartStateStr.Length != waterMetersCount)
|
||||
throw (new Exception("Invalid 'wmStartStateStr' argument"));
|
||||
this.WMStartStateStr = wmStartStateStr;
|
||||
this.disabled = disabled;
|
||||
this.refVolume = refVolume;
|
||||
this.warningLimLo = 2 * errLimLo;
|
||||
this.warningLimHi = 2 * errLimHi;
|
||||
this.fixedErrorLimits = (errLimHi > errLimLo);
|
||||
|
||||
ShuffleTextBoxes();
|
||||
|
||||
WMEndState = new double[waterMetersCount];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Make sure the layout of labels/text boxes on the screen
|
||||
/// corresponds to the layout of watermeters of the test bench.
|
||||
/// </summary>
|
||||
void ShuffleTextBoxes()
|
||||
{
|
||||
if (TextBoxesCount > WMsCount)
|
||||
{
|
||||
int nrLines = WMsCount / TBF.Data.LineSize;
|
||||
int gap = (TextBoxesCount - WMsCount) / nrLines;
|
||||
|
||||
int dest = 0;
|
||||
for (int l = 0; l < nrLines; l++)
|
||||
{
|
||||
for (int i = 0; i < TBF.Data.LineSize; i++)
|
||||
{
|
||||
labels[dest] = labels[l * TBF.Data.LineSize + l * gap + i];
|
||||
startTextBoxes[dest] = startTextBoxes[l * TBF.Data.LineSize + l * gap + i];
|
||||
endTextBoxes[dest] = endTextBoxes[l * TBF.Data.LineSize + l * gap + i];
|
||||
exclamations[dest] = exclamations[l * TBF.Data.LineSize + l * gap + i];
|
||||
dest++;
|
||||
}
|
||||
}
|
||||
TextBoxesCount = WMsCount;
|
||||
}
|
||||
}
|
||||
|
||||
private void CycleEndForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
Localize();
|
||||
|
||||
//Height = 115 + 90 * WaterMetersCount;
|
||||
|
||||
for (int i = 0; i < TextBoxesCount; i++)
|
||||
{
|
||||
if (i < WMsCount)
|
||||
{
|
||||
labels[i].Visible = startTextBoxes[i].Visible = endTextBoxes[i].Visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (endStates)
|
||||
{
|
||||
/// End of test
|
||||
for (int i = 0; i < TextBoxesCount; i++)
|
||||
{
|
||||
if (WMStartStateStr != null && i < WMStartStateStr.Length)
|
||||
{
|
||||
startTextBoxes[i].Text = WMStartStateStr[i];
|
||||
}
|
||||
|
||||
if (((i < disabled.Length) && disabled[i]) || ((i < regReaders.Length) && (regReaders[i] == null)))
|
||||
{
|
||||
endTextBoxes[i].Enabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
endTextBoxes[i].Enabled = true;
|
||||
activeTextBoxes.Add(endTextBoxes[i]);
|
||||
activeWmNrs.Add(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/// Start of test
|
||||
for (int i = 0; i < TextBoxesCount; i++)
|
||||
{
|
||||
if (((i < disabled.Length) && disabled[i]) || ((i < regReaders.Length) && (regReaders[i] == null)))
|
||||
{
|
||||
startTextBoxes[i].Enabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
startTextBoxes[i].Enabled = true;
|
||||
activeTextBoxes.Add(startTextBoxes[i]);
|
||||
activeWmNrs.Add(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((activeTextBoxes.Count > 0) && (activeWmNrs.Count > 0))
|
||||
{
|
||||
activeTextBoxes[0].Focus();
|
||||
largeTextBox.Text = string.Format("{0} {1}: {2}", Strings.Water_Meter, activeWmNrs[0] + 1, string.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
void Localize()
|
||||
{
|
||||
Text = Strings.Water_Meter_States;
|
||||
for (int i = 0; i < TextBoxesCount; i++)
|
||||
{
|
||||
labels[i].Text = string.Format("{0} {1}", Strings.Water_Meter, i + 1);
|
||||
}
|
||||
startLabel.Text = startLabel2.Text = Strings.Start;
|
||||
endLabel.Text = endLabel2.Text = Strings.End;
|
||||
okButton.Text = Strings.OkBtnText;
|
||||
}
|
||||
|
||||
private void okButton_Click(object sender, EventArgs eArgs)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (endStates)
|
||||
{
|
||||
for (int i = 0; i < Math.Min(WMsCount, TextBoxesCount); i++)
|
||||
{
|
||||
if (endTextBoxes[i].Visible && endTextBoxes[i].Enabled)
|
||||
{
|
||||
WMEndState[i] = Utils.ParseUDouble(endTextBoxes[i].Text);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < Math.Min(WMsCount, TextBoxesCount); i++)
|
||||
{
|
||||
if (startTextBoxes[i].Visible && startTextBoxes[i].Enabled)
|
||||
{
|
||||
WMStartStateStr[i] = startTextBoxes[i].Text;
|
||||
WMStartState[i] = Utils.ParseUDouble(startTextBoxes[i].Text);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
log.ErrorFormat("Exception: {0}", e.Message);
|
||||
return;
|
||||
}
|
||||
|
||||
completed = true;
|
||||
Close();
|
||||
}
|
||||
|
||||
#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
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Calculate the approximate error and verify whether it is within limits.
|
||||
/// Make an exclamation mark visible if out of range.
|
||||
/// Similar event handler is implemented for all endTextBoxes (1..24).
|
||||
/// </summary>
|
||||
private void ProcEndTextChanged(object sender, EventArgs e, TextBox endTBox)
|
||||
{
|
||||
int wmIx = -1;
|
||||
for (int i = 0; i < endTextBoxes.Length; i++)
|
||||
{
|
||||
if (endTextBoxes[i] == endTBox)
|
||||
{
|
||||
wmIx = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
double err = 0;
|
||||
try
|
||||
{
|
||||
double endState = Utils.ParseUDouble(endTextBoxes[wmIx].Text);
|
||||
double startState = Utils.ParseUDouble(startTextBoxes[wmIx].Text);
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
|
||||
bool errorOoR = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
exclamations[wmIx].Visible = errorOoR;
|
||||
largeExclamationLabel.Visible = errorOoR;
|
||||
largeTextBox.Text = string.Format("{0} {1}: {2}", Strings.Water_Meter, wmIx + 1, endTextBoxes[wmIx].Text);
|
||||
}
|
||||
|
||||
private void endTextBox1_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox1); }
|
||||
private void endTextBox2_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox2); }
|
||||
private void endTextBox3_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox3); }
|
||||
private void endTextBox4_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox4); }
|
||||
private void endTextBox5_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox5); }
|
||||
private void endTextBox6_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox6); }
|
||||
private void endTextBox7_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox7); }
|
||||
private void endTextBox8_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox8); }
|
||||
private void endTextBox9_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox9); }
|
||||
private void endTextBox10_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox10); }
|
||||
private void endTextBox11_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox11); }
|
||||
private void endTextBox12_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox12); }
|
||||
private void endTextBox13_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox13); }
|
||||
private void endTextBox14_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox14); }
|
||||
private void endTextBox15_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox15); }
|
||||
private void endTextBox16_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox16); }
|
||||
private void endTextBox17_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox17); }
|
||||
private void endTextBox18_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox18); }
|
||||
private void endTextBox19_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox19); }
|
||||
private void endTextBox20_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox20); }
|
||||
private void endTextBox21_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox21); }
|
||||
private void endTextBox22_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox22); }
|
||||
private void endTextBox23_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox23); }
|
||||
private void endTextBox24_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox24); }
|
||||
|
||||
private void endTextBox1_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox1); }
|
||||
private void endTextBox2_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox2); }
|
||||
private void endTextBox3_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox3); }
|
||||
private void endTextBox4_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox4); }
|
||||
private void endTextBox5_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox5); }
|
||||
private void endTextBox6_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox6); }
|
||||
private void endTextBox7_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox7); }
|
||||
private void endTextBox8_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox8); }
|
||||
private void endTextBox9_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox9); }
|
||||
private void endTextBox10_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox10); }
|
||||
private void endTextBox11_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox11); }
|
||||
private void endTextBox12_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox12); }
|
||||
private void endTextBox13_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox13); }
|
||||
private void endTextBox14_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox14); }
|
||||
private void endTextBox15_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox15); }
|
||||
private void endTextBox16_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox16); }
|
||||
private void endTextBox17_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox17); }
|
||||
private void endTextBox18_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox18); }
|
||||
private void endTextBox19_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox19); }
|
||||
private void endTextBox20_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox20); }
|
||||
private void endTextBox21_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox21); }
|
||||
private void endTextBox22_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox22); }
|
||||
private void endTextBox23_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox23); }
|
||||
private void endTextBox24_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox24); }
|
||||
|
||||
/// <summary>
|
||||
/// Process a key press within any enabled text boxe
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
/// <param name="currentFocusOwner">TextBox control which received the event</param>
|
||||
private void ProcKeyPress(object sender, KeyPressEventArgs e, TextBox currentFocusOwner)
|
||||
{
|
||||
if (e.KeyChar == '+')
|
||||
{
|
||||
/// Process '+' key ..... Form completed
|
||||
okButton_Click(sender, e);
|
||||
}
|
||||
|
||||
if (e.KeyChar == '\r')
|
||||
{
|
||||
/// Process <enter> key ..... Next text field
|
||||
if (activeTextBoxes.Count < 2) return; /// There is just one enabled textbox
|
||||
|
||||
for (int i = 0; i < activeTextBoxes.Count; i++)
|
||||
{
|
||||
if (activeTextBoxes[i] == currentFocusOwner)
|
||||
{
|
||||
/// Change focus to the next enabled text box
|
||||
int newTBIdx = (i + 1) % activeTextBoxes.Count;
|
||||
activeTextBoxes[newTBIdx].Focus();
|
||||
largeTextBox.Text = string.Format("{0} {1}: {2}", Strings.Water_Meter, activeWmNrs[newTBIdx] + 1, activeTextBoxes[newTBIdx].Text);
|
||||
largeExclamationLabel.Visible = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void startTextBox1_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, startTextBox1); }
|
||||
private void startTextBox2_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, startTextBox2); }
|
||||
private void startTextBox3_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, startTextBox3); }
|
||||
private void startTextBox4_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, startTextBox4); }
|
||||
private void startTextBox5_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, startTextBox5); }
|
||||
private void startTextBox6_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, startTextBox6); }
|
||||
private void startTextBox7_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, startTextBox7); }
|
||||
private void startTextBox8_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, startTextBox8); }
|
||||
private void startTextBox9_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, startTextBox9); }
|
||||
private void startTextBox10_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, startTextBox10); }
|
||||
private void startTextBox11_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, startTextBox11); }
|
||||
private void startTextBox12_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, startTextBox12); }
|
||||
private void startTextBox13_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, startTextBox13); }
|
||||
private void startTextBox14_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, startTextBox14); }
|
||||
private void startTextBox15_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, startTextBox15); }
|
||||
private void startTextBox16_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, startTextBox16); }
|
||||
private void startTextBox17_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, startTextBox17); }
|
||||
private void startTextBox18_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, startTextBox18); }
|
||||
private void startTextBox19_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, startTextBox19); }
|
||||
private void startTextBox20_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, startTextBox20); }
|
||||
private void startTextBox21_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, startTextBox21); }
|
||||
private void startTextBox22_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, startTextBox22); }
|
||||
private void startTextBox23_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, startTextBox23); }
|
||||
private void startTextBox24_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, startTextBox24); }
|
||||
|
||||
private void endTextBox1_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox1); }
|
||||
private void endTextBox2_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox2); }
|
||||
private void endTextBox3_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox3); }
|
||||
private void endTextBox4_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox4); }
|
||||
private void endTextBox5_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox5); }
|
||||
private void endTextBox6_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox6); }
|
||||
private void endTextBox7_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox7); }
|
||||
private void endTextBox8_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox8); }
|
||||
private void endTextBox9_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox9); }
|
||||
private void endTextBox10_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox10); }
|
||||
private void endTextBox11_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox11); }
|
||||
private void endTextBox12_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox12); }
|
||||
private void endTextBox13_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox13); }
|
||||
private void endTextBox14_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox14); }
|
||||
private void endTextBox15_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox15); }
|
||||
private void endTextBox16_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox16); }
|
||||
private void endTextBox17_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox17); }
|
||||
private void endTextBox18_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox18); }
|
||||
private void endTextBox19_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox19); }
|
||||
private void endTextBox20_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox20); }
|
||||
private void endTextBox21_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox21); }
|
||||
private void endTextBox22_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox22); }
|
||||
private void endTextBox23_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox23); }
|
||||
private void endTextBox24_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox24); }
|
||||
|
||||
|
||||
private void ProcStartTextChanged(object sender, EventArgs e, TextBox startTBox)
|
||||
{
|
||||
for (int i = 0; i < startTextBoxes.Length; i++)
|
||||
{
|
||||
if (startTextBoxes[i] == startTBox)
|
||||
{
|
||||
largeTextBox.Text = string.Format("{0} {1}: {2}", Strings.Water_Meter, i + 1, startTextBoxes[i].Text);
|
||||
largeExclamationLabel.Visible = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void startTextBox1_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox1); }
|
||||
private void startTextBox2_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox2); }
|
||||
private void startTextBox3_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox3); }
|
||||
private void startTextBox4_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox4); }
|
||||
private void startTextBox5_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox5); }
|
||||
private void startTextBox6_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox6); }
|
||||
private void startTextBox7_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox7); }
|
||||
private void startTextBox8_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox8); }
|
||||
private void startTextBox9_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox9); }
|
||||
private void startTextBox10_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox10); }
|
||||
private void startTextBox11_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox11); }
|
||||
private void startTextBox12_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox12); }
|
||||
private void startTextBox13_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox13); }
|
||||
private void startTextBox14_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox14); }
|
||||
private void startTextBox15_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox15); }
|
||||
private void startTextBox16_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox16); }
|
||||
private void startTextBox17_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox17); }
|
||||
private void startTextBox18_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox18); }
|
||||
private void startTextBox19_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox19); }
|
||||
private void startTextBox20_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox20); }
|
||||
private void startTextBox21_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox21); }
|
||||
private void startTextBox22_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox22); }
|
||||
private void startTextBox23_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox23); }
|
||||
private void startTextBox24_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox24); }
|
||||
|
||||
private void startTextBox1_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox1); }
|
||||
private void startTextBox2_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox2); }
|
||||
private void startTextBox3_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox3); }
|
||||
private void startTextBox4_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox4); }
|
||||
private void startTextBox5_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox5); }
|
||||
private void startTextBox6_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox6); }
|
||||
private void startTextBox7_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox7); }
|
||||
private void startTextBox8_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox8); }
|
||||
private void startTextBox9_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox9); }
|
||||
private void startTextBox10_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox10); }
|
||||
private void startTextBox11_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox11); }
|
||||
private void startTextBox12_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox12); }
|
||||
private void startTextBox13_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox13); }
|
||||
private void startTextBox14_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox14); }
|
||||
private void startTextBox15_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox15); }
|
||||
private void startTextBox16_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox16); }
|
||||
private void startTextBox17_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox17); }
|
||||
private void startTextBox18_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox18); }
|
||||
private void startTextBox19_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox19); }
|
||||
private void startTextBox20_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox20); }
|
||||
private void startTextBox21_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox21); }
|
||||
private void startTextBox22_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox22); }
|
||||
private void startTextBox23_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox23); }
|
||||
private void startTextBox24_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox24); }
|
||||
}
|
||||
}
|
||||
+1614
File diff suppressed because it is too large
Load Diff
@@ -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>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user