Merge branch 'master-2' of 10.42.130.13:/srv/git/tbf into master-2
This commit is contained in:
commit
7d2da63071
@ -214,9 +214,9 @@ namespace Config
|
||||
/// </summary>
|
||||
public static double ErrorFromVolumes(double measuredVolume, double trueVolume)
|
||||
{
|
||||
if (trueVolume <= float.Epsilon)
|
||||
if (-float.Epsilon <= trueVolume && trueVolume <= float.Epsilon)
|
||||
{
|
||||
if (measuredVolume <= float.Epsilon)
|
||||
if (-float.Epsilon <= measuredVolume && measuredVolume <= float.Epsilon)
|
||||
{
|
||||
log.WarnFormat("ErrorFromVolumes({0},{1}) returns {2}", measuredVolume, trueVolume, -100.0);
|
||||
return -100.0;
|
||||
|
||||
@ -24,6 +24,8 @@ namespace Results.Entities
|
||||
public virtual int UserNumber { get; set; }
|
||||
public virtual string ProcedureName { get; set; }
|
||||
public virtual bool IsRemoteProcedure { get; set; } /// Stara Tura, not mapped to DB
|
||||
public virtual string PurchaseOrder { get; set; } /// Stara Tura, Nanjing, not mapped to DB
|
||||
public virtual string Workflow { get; set; } /// Stara Tura, Nanjing, not mapped to DB
|
||||
public virtual string ProcedureDescription { get; set; } /// CEVAK, not mapped to DB
|
||||
public virtual int ProcedureRevision { get; set; }
|
||||
public virtual string WatermetersStr { get; set; } /// CEVAK, not mapped to DB
|
||||
|
||||
@ -109,7 +109,13 @@ namespace Results.Entities
|
||||
///
|
||||
/// Wrappers
|
||||
///
|
||||
public virtual string ProductName() { return WaterMeterData.ProductName; }
|
||||
public virtual string GetEndStateAux() { return Compound() ? EndStateAux : string.Empty; }
|
||||
public virtual void SetEndStateAux(string s) { if (Compound()) EndStateAux = s; }
|
||||
|
||||
public virtual string GetStartState() { return Compound() ? string.Empty : EndStateAux; }
|
||||
public virtual void SetStartState(string s) { if (!Compound()) EndStateAux = s; }
|
||||
|
||||
public virtual string ProductName() { return WaterMeterData.ProductName; }
|
||||
public virtual string Producer() { return WaterMeterData.Producer; }
|
||||
public virtual string MetrologicalClass() { return WaterMeterData.MetrologicalClass; }
|
||||
public virtual string ApprovalInfo() { return WaterMeterData.ApprovalInfo; }
|
||||
|
||||
@ -231,6 +231,27 @@ namespace TBF
|
||||
public string LastText3;
|
||||
public string LastRemark;
|
||||
|
||||
/// DataEntry.Uni history
|
||||
public string[] LastBgComm1;
|
||||
public string[] LastBgComm2;
|
||||
public string[] LastBgComm3;
|
||||
///
|
||||
public string[] LastBgColA;
|
||||
public string[] LastBgColB;
|
||||
public string[] LastBgColC;
|
||||
public string[] LastBgColD;
|
||||
public string[] LastBgColE;
|
||||
///
|
||||
public string[] LastEnComm1;
|
||||
public string[] LastEnComm2;
|
||||
public string[] LastEnComm3;
|
||||
///
|
||||
public string[] LastEnColA;
|
||||
public string[] LastEnColB;
|
||||
public string[] LastEnColC;
|
||||
public string[] LastEnColD;
|
||||
public string[] LastEnColE;
|
||||
|
||||
/// Purchase order history
|
||||
public string[] PurchaseOrderHistory;
|
||||
[XmlIgnore]
|
||||
|
||||
@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("2.33.2061.0")]
|
||||
[assembly: AssemblyFileVersion("2.33.2061.0")]
|
||||
[assembly: AssemblyVersion("2.33.2070.0")]
|
||||
[assembly: AssemblyFileVersion("2.33.2070.0")]
|
||||
|
||||
95
TBF/Rig/DataEntry/DEItem.cs
Normal file
95
TBF/Rig/DataEntry/DEItem.cs
Normal file
@ -0,0 +1,95 @@
|
||||
///
|
||||
/// Copyright (c) 2023 Sensus Slovensko a.s.
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using Common;
|
||||
|
||||
namespace TBF.Rig.DataEntry
|
||||
{
|
||||
///
|
||||
/// Ac = Action
|
||||
///
|
||||
public enum Ac
|
||||
{
|
||||
[Description("Clear")] Clear, /// Clear when the form is open, save on OK
|
||||
[Description("Last from history")] HistoryLast,
|
||||
[Description("Load")] Load, /// Load from water meters when the form is open, save on OK
|
||||
[Description("Load (readonly)")] LoadReadOnly, /// Load from water meters when the form is open, prevent changes, do not save
|
||||
Count,
|
||||
}
|
||||
|
||||
///
|
||||
/// Ct = Content
|
||||
///
|
||||
public enum Ct
|
||||
{
|
||||
[Description("None")] None,
|
||||
[Description("Serial nr.")] SerialNr,
|
||||
[Description("Serial nr. aux")] SerialNrAux,
|
||||
[Description("Radio address")] RadioAddress,
|
||||
[Description("Year of calibration")] YearOfCalibration,
|
||||
[Description("Start state")] StartState,
|
||||
[Description("End state")] EndState,
|
||||
[Description("Archive path")] ArchivePath,
|
||||
[Description("WM Order")] WmOrder,
|
||||
[Description("Batch order")] BatchOrder,
|
||||
[Description("Batch and WM order")] BatchAndWmOrder,
|
||||
[Description("WM Remark")] WmRemark,
|
||||
[Description("Batch remark")] BatchRemark,
|
||||
[Description("Batch and WM remark")] BatchAndWmRemark,
|
||||
#if ORACLE_DB
|
||||
[Description("Prefix")] Prefix,
|
||||
[Description("Suffix")] Suffix,
|
||||
#endif
|
||||
Count
|
||||
}
|
||||
|
||||
public class DEItem
|
||||
{
|
||||
public readonly Ct Content;
|
||||
public readonly string Caption;
|
||||
public readonly Ac Action;
|
||||
public readonly int Width;
|
||||
|
||||
public DEItem(Ct content, string caption, Ac action, int width)
|
||||
{
|
||||
Content = content;
|
||||
Caption = caption;
|
||||
Action = action;
|
||||
Width = width;
|
||||
}
|
||||
|
||||
|
||||
static IList<DEItem> items = new List<DEItem>();
|
||||
///
|
||||
public static void ClearItems() { items.Clear(); }
|
||||
public static void AddItem(DEItem item) { items.Add(item); }
|
||||
public static void AddItem(Ct content, string caption, Ac action, int width)
|
||||
{
|
||||
items.Add(new DEItem(content, caption, action, width));
|
||||
}
|
||||
public static IList<DEItem> GetItems() { return items; }
|
||||
|
||||
|
||||
static IList<DEItem> columns = new List<DEItem>();
|
||||
///
|
||||
public static void ClearColumns() { columns.Clear(); }
|
||||
public static void AddColumn(DEItem column) { columns.Add(column); }
|
||||
public static void AddColumn(Ct content, string caption, Ac action, int width)
|
||||
{
|
||||
columns.Add(new DEItem(content, caption, action, width));
|
||||
}
|
||||
public static IList<DEItem> GetColumns() { return columns; }
|
||||
|
||||
|
||||
static IList<DEItem> summaryColumns = new List<DEItem>();
|
||||
///
|
||||
public static void ClearSummaryColumns() { summaryColumns.Clear(); }
|
||||
public static void AddSummaryColumn(DEItem column) { summaryColumns.Add(column); }
|
||||
public static void AddSummaryColumn(Ct content, string caption, Ac action, int width)
|
||||
{
|
||||
summaryColumns.Add(new DEItem(content, caption, action, width));
|
||||
}
|
||||
public static IList<DEItem> GetSummaryColumns() { return summaryColumns; }
|
||||
}
|
||||
}
|
||||
@ -1,13 +1,85 @@
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2018-2023 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using Results.Entities;
|
||||
|
||||
namespace TBF.Rig.DataEntry
|
||||
{
|
||||
public class DEUtils
|
||||
{
|
||||
public static string GetContent(Ct content, WaterMeter wm)
|
||||
{
|
||||
if (wm == null) return string.Empty;
|
||||
|
||||
switch (content)
|
||||
{
|
||||
default:
|
||||
case Ct.None: return string.Empty;
|
||||
case Ct.SerialNr: return (!wm.Disabled && wm.SerialNr != null) ? wm.SerialNr : string.Empty;
|
||||
case Ct.SerialNrAux: return (!wm.Disabled && wm.SerialNrAux != null) ? wm.SerialNrAux : string.Empty;
|
||||
case Ct.RadioAddress: return (!wm.Disabled && wm.RadioAddress != null) ? wm.RadioAddress : string.Empty;
|
||||
case Ct.YearOfCalibration: return (!wm.Disabled) ? wm.YearOfProduction.ToString() : string.Empty;
|
||||
case Ct.StartState: return (!wm.Disabled && wm.GetStartState() != null) ? wm.GetStartState() : string.Empty;
|
||||
case Ct.EndState: return (!wm.Disabled && wm.EndState != null) ? wm.EndState : string.Empty;
|
||||
case Ct.ArchivePath: return (!wm.Disabled && wm.ArchivePath != null) ? wm.ArchivePath : string.Empty;
|
||||
|
||||
case Ct.WmOrder: return (!wm.Disabled && wm.PurchaseOrder != null) ? wm.PurchaseOrder : string.Empty;
|
||||
case Ct.BatchOrder: return (wm.Batch != null && wm.Batch.PurchaseOrder != null) ? wm.Batch.PurchaseOrder : string.Empty;
|
||||
case Ct.BatchAndWmOrder: return (wm.Batch != null && wm.Batch.PurchaseOrder != null) ? wm.Batch.PurchaseOrder : string.Empty;
|
||||
|
||||
case Ct.WmRemark: return (!wm.Disabled && wm.Remark != null) ? wm.Remark : string.Empty;
|
||||
case Ct.BatchRemark: return (wm.Batch != null && wm.Batch.Remark != null) ? wm.Batch.Remark : string.Empty;
|
||||
case Ct.BatchAndWmRemark: return (wm.Batch != null && wm.Batch.Remark != null) ? wm.Batch.Remark : string.Empty;
|
||||
#if ORACLE_DB
|
||||
case Ct.Prefix: return (!wm.Disabled && wm.Prefix != null) ? wm.Prefix : string.Empty;
|
||||
case Ct.Suffix: return (!wm.Disabled && wm.Suffix != null) ? wm.Suffix : string.Empty;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
public static void PutContent(Ct content, WaterMeter wm, string value)
|
||||
{
|
||||
if (wm == null || wm.Disabled) return;
|
||||
|
||||
int year;
|
||||
|
||||
switch (content)
|
||||
{
|
||||
default:
|
||||
case Ct.None: return;
|
||||
case Ct.SerialNr: wm.SerialNr = value; return;
|
||||
case Ct.SerialNrAux: wm.SerialNrAux = value; return;
|
||||
case Ct.RadioAddress: wm.RadioAddress = value; return;
|
||||
case Ct.YearOfCalibration: if (int.TryParse(value, out year)) wm.YearOfProduction = year; return;
|
||||
case Ct.StartState: wm.SetStartState(value); return;
|
||||
case Ct.EndState: wm.EndState = value; return;
|
||||
case Ct.ArchivePath: wm.ArchivePath = value; return;
|
||||
|
||||
case Ct.WmOrder:
|
||||
wm.PurchaseOrder = value;
|
||||
return;
|
||||
|
||||
case Ct.BatchOrder:
|
||||
case Ct.BatchAndWmOrder:
|
||||
if (wm.Batch != null) wm.Batch.PurchaseOrder = value;
|
||||
return;
|
||||
|
||||
case Ct.WmRemark:
|
||||
wm.Remark = value;
|
||||
return;
|
||||
|
||||
case Ct.BatchRemark:
|
||||
case Ct.BatchAndWmRemark:
|
||||
if (wm.Batch != null) wm.Batch.Remark = value;
|
||||
return;
|
||||
#if ORACLE_DB
|
||||
case Ct.Prefix: wm.Prefix = value; return;
|
||||
case Ct.Suffix: wm.Suffix = value; return;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load Purchase order combo box items from the LocalSettings PurchaseOrderHistory array
|
||||
/// </summary>
|
||||
|
||||
736
TBF/Rig/DataEntry/Uni/CycleBgEnForm.cs
Normal file
736
TBF/Rig/DataEntry/Uni/CycleBgEnForm.cs
Normal file
@ -0,0 +1,736 @@
|
||||
///
|
||||
/// Copyright (c) 2023 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using log4net;
|
||||
using Results.Entities;
|
||||
using TBF.Resources;
|
||||
|
||||
namespace TBF.Rig.DataEntry.Uni
|
||||
{
|
||||
public partial class CycleBgEnForm : Form, GenericDevices.IHasCompleted
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(CycleBgEnForm));
|
||||
|
||||
/// Arguments
|
||||
public readonly IList<WaterMeter> WaterMeters;
|
||||
readonly int lineSize;
|
||||
readonly Sz sz;
|
||||
readonly bool isLrOrder; /// true = controls obtain focus after ENTER key in left-right order, false = top-down order
|
||||
readonly IList<DEItem> commonItems;
|
||||
readonly IList<DEItem> colItems;
|
||||
readonly bool isEnd;
|
||||
readonly string formCloseKeys;
|
||||
|
||||
/// Derived from arguments in the constructor
|
||||
readonly WaterMeter firstValidWM;
|
||||
readonly int wmsCount;
|
||||
readonly int linesCount;
|
||||
readonly int commonItemsCount;
|
||||
|
||||
/// Size and layout related values
|
||||
readonly Font font;
|
||||
readonly int meterHeight;
|
||||
readonly int meterWidth;
|
||||
readonly int margin;
|
||||
readonly int spacing;
|
||||
readonly int buttonsWidth;
|
||||
readonly int hdrHeight;
|
||||
readonly int labelWid;
|
||||
readonly int checkBoxWid;
|
||||
|
||||
/// UI elements
|
||||
readonly Label[] commonLabels;
|
||||
readonly ComboBox[] commonComboBoxes;
|
||||
readonly Label[] labels; /// Labels for water meter numbers
|
||||
readonly ComboBox[,] comboBoxes; /// Combo boxes for values in columns
|
||||
readonly CheckBox[] checkBoxes; /// Check boxes for water meter enable/disable
|
||||
|
||||
readonly LocalSettings ls;
|
||||
|
||||
bool isHandlersEnabled; /// Initially false, set to true after ComboBoxes are filled with data
|
||||
|
||||
/// Set to 'true' when the form closes
|
||||
public bool Completed { get { return completed; } }
|
||||
bool completed;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Parameterless constructor for common functionality
|
||||
/// </summary>
|
||||
public CycleBgEnForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
ControlBox = false;
|
||||
completed = false;
|
||||
StartForceCloseHandler();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="waterMeters">Water meters</param>
|
||||
/// <param name="lineSize">Number of water meters in one (test bencch) line</param>
|
||||
/// <param name="title">Form title</param>
|
||||
/// <param name="sz">Font size</param>
|
||||
/// <param name="isLrOrder">true = controls obtain focus in left-right order, forls = top-down order</param>
|
||||
/// <param name="formCloseKeys">String containing keys to close this form</param>
|
||||
/// <param name="commonItems">Common items displayed in the upper part of the form</param>
|
||||
/// <param name="colItems">Water meter items displayed in columns (in the matrix in the main part of the form)</param>
|
||||
/// <param name="isEnd">true = This form is displayed at the end of cycle</param>
|
||||
public CycleBgEnForm(IList<WaterMeter> waterMeters, int lineSize, string title, Sz sz, bool isLrOrder, string formCloseKeys,
|
||||
IList<DEItem> commonItems, IList<DEItem> colItems, bool isEnd = false)
|
||||
: this()
|
||||
{
|
||||
/// Arguments
|
||||
this.WaterMeters = waterMeters;
|
||||
this.lineSize = lineSize;
|
||||
this.Text = !string.IsNullOrEmpty(title) ? title : string.Empty;
|
||||
this.sz = sz;
|
||||
this.isLrOrder = isLrOrder;
|
||||
this.formCloseKeys = !string.IsNullOrEmpty(formCloseKeys) ? formCloseKeys : string.Empty;
|
||||
this.commonItems = commonItems;
|
||||
this.colItems = colItems;
|
||||
this.isEnd = isEnd;
|
||||
|
||||
/// Preserve column items for use in SummaryResults
|
||||
if (!isEnd)
|
||||
{
|
||||
/// cycle beginning
|
||||
DEItem.ClearSummaryColumns();
|
||||
foreach (var it in colItems) if (it.Content != Ct.SerialNr) DEItem.AddSummaryColumn(it);
|
||||
}
|
||||
else
|
||||
{
|
||||
/// cycle end
|
||||
foreach (var it in colItems) if (it.Content != Ct.SerialNr) DEItem.AddSummaryColumn(it);
|
||||
}
|
||||
|
||||
ls = Program.LocalSettings;
|
||||
|
||||
/// Readonly variables derived from arguments
|
||||
commonItemsCount = (commonItems == null) ? 0 : commonItems.Count;
|
||||
wmsCount = (waterMeters == null) ? 0 : waterMeters.Count;
|
||||
linesCount = (wmsCount + Math.Max(1, lineSize) - 1) / Math.Max(1, lineSize);
|
||||
firstValidWM = (waterMeters != null) ? waterMeters.FirstOrDefault(x => (x != null && !x.Disabled)) : null;
|
||||
///
|
||||
commonLabels = new Label[commonItemsCount];
|
||||
commonComboBoxes = new ComboBox[commonItemsCount];
|
||||
labels = new Label[wmsCount];
|
||||
comboBoxes = new ComboBox[colItems.Count, wmsCount];
|
||||
checkBoxes = new CheckBox[wmsCount];
|
||||
|
||||
/// Layout related readonly variables derived from argument 'sz'
|
||||
switch (sz)
|
||||
{
|
||||
case Sz.S:
|
||||
font = new Font("Verdana", 12, FontStyle.Regular);
|
||||
meterHeight = 26; /// Height of a ComboBox control
|
||||
margin = 20;
|
||||
spacing = 8;
|
||||
buttonsWidth = 350;
|
||||
hdrHeight = 120;
|
||||
labelWid = 31;
|
||||
checkBoxWid = 23;
|
||||
break;
|
||||
|
||||
default:
|
||||
case Sz.M:
|
||||
font = new Font("Verdana", 14, FontStyle.Regular);
|
||||
meterHeight = 31; /// Height of a ComboBox control
|
||||
margin = 25;
|
||||
spacing = 10;
|
||||
buttonsWidth = 350;
|
||||
hdrHeight = 140;
|
||||
labelWid = 34;
|
||||
checkBoxWid = 23;
|
||||
break;
|
||||
|
||||
case Sz.L:
|
||||
font = new Font("Verdana", 18, FontStyle.Regular);
|
||||
meterHeight = 37; /// Height of a ComboBox control
|
||||
margin = 30;
|
||||
spacing = 12;
|
||||
buttonsWidth = 350;
|
||||
hdrHeight = 160;
|
||||
labelWid = 40;
|
||||
checkBoxWid = 23;
|
||||
break;
|
||||
}
|
||||
meterWidth = labelWid + checkBoxWid + spacing;
|
||||
foreach (var ci in colItems) { meterWidth += ci.Width + spacing; }
|
||||
|
||||
int tabIndex = 1;
|
||||
|
||||
///
|
||||
/// Group box with common items
|
||||
///
|
||||
int groupBoxWidth = 0;
|
||||
int groupBoxHeight = 0;
|
||||
if (commonItemsCount > 0)
|
||||
{
|
||||
var groupBox = new GroupBox();
|
||||
|
||||
int labelsWidth = 0;
|
||||
for (int ix = 0; ix < commonItemsCount; ix++)
|
||||
{
|
||||
int oneLabelWidth = Convert.ToInt32(Graphics.FromImage(new Bitmap(1, 1)).MeasureString(commonItems[ix].Caption, font).Width);
|
||||
var oneLabel = new Label
|
||||
{
|
||||
Text = commonItems[ix].Caption,
|
||||
Font = font,
|
||||
Location = new Point(margin, (ix + 2) * spacing + ix * meterHeight),
|
||||
Size = new Size(oneLabelWidth + spacing, meterHeight),
|
||||
TextAlign = ContentAlignment.MiddleLeft,
|
||||
TabIndex = tabIndex++,
|
||||
Parent = groupBox,
|
||||
};
|
||||
groupBox.Controls.Add(oneLabel);
|
||||
labelsWidth = Math.Max(labelsWidth, oneLabelWidth);
|
||||
}
|
||||
|
||||
int combosWidth = 0;
|
||||
for (int ix = 0; ix < commonItemsCount; ix++)
|
||||
{
|
||||
var cb = new ComboBox
|
||||
{
|
||||
Name = string.Format("-1~{0}", ix + 1),
|
||||
Location = new Point(margin + spacing + labelsWidth, (ix + 2) * spacing + ix * meterHeight),
|
||||
Size = new Size(commonItems[ix].Width, meterHeight),
|
||||
Enabled = (commonItems[ix].Action != Ac.LoadReadOnly),
|
||||
Font = font,
|
||||
TabIndex = tabIndex++,
|
||||
Parent = groupBox,
|
||||
};
|
||||
|
||||
cb.SelectedIndexChanged += new System.EventHandler(comboBox_SelectedIndexChanged);
|
||||
cb.TextChanged += new System.EventHandler(comboBox_TextChanged);
|
||||
cb.KeyPress += new System.Windows.Forms.KeyPressEventHandler(comboBox_KeyPress);
|
||||
|
||||
switch (ix)
|
||||
{
|
||||
case 0: AddHistoryToCombo(cb, isEnd ? ls.LastEnComm1 : ls.LastBgComm1); break;
|
||||
case 1: AddHistoryToCombo(cb, isEnd ? ls.LastEnComm2 : ls.LastBgComm2); break;
|
||||
case 2: AddHistoryToCombo(cb, isEnd ? ls.LastEnComm3 : ls.LastBgComm3); break;
|
||||
}
|
||||
|
||||
commonComboBoxes[ix] = cb;
|
||||
groupBox.Controls.Add(cb);
|
||||
combosWidth = Math.Max(combosWidth, commonItems[ix].Width);
|
||||
}
|
||||
///
|
||||
groupBox.Location = new Point(margin, margin - spacing);
|
||||
groupBoxWidth = labelsWidth + combosWidth + 2 * margin + spacing;
|
||||
groupBoxHeight = commonItemsCount * meterHeight + (commonItemsCount + 2) * spacing;
|
||||
groupBox.Size = new Size(groupBoxWidth, groupBoxHeight);
|
||||
groupBox.Font = font;
|
||||
groupBox.TabIndex = tabIndex++;
|
||||
groupBox.Parent = this;
|
||||
this.Controls.Add(groupBox);
|
||||
}
|
||||
|
||||
///
|
||||
/// Table
|
||||
///
|
||||
int columnsTop = Math.Max(hdrHeight, groupBoxHeight + 2 * margin + spacing);
|
||||
for (int j = 0; j < linesCount; j++)
|
||||
{
|
||||
/// Captions
|
||||
int capX = margin + j * (meterWidth + margin / 2) + labelWid + spacing;
|
||||
int capY = columnsTop - meterHeight;
|
||||
for (int k = 0; k < colItems.Count; k++)
|
||||
{
|
||||
int labelWidth = Convert.ToInt32(Graphics.FromImage(new Bitmap(1, 1)).MeasureString(colItems[k].Caption, font).Width);
|
||||
var label = new Label
|
||||
{
|
||||
Text = colItems[k].Caption,
|
||||
Location = new Point(capX, capY),
|
||||
Size = new Size(labelWidth + spacing, meterHeight),
|
||||
Font = font,
|
||||
TabIndex = tabIndex++,
|
||||
Parent = this,
|
||||
};
|
||||
capX += colItems[k].Width + spacing;
|
||||
}
|
||||
|
||||
/// Water meters
|
||||
for (int i = 0; i < lineSize; i++)
|
||||
{
|
||||
int wmPos0 = i + lineSize * j;
|
||||
if (wmPos0 > wmsCount) continue;
|
||||
|
||||
int left = margin + j * (meterWidth + margin / 2);
|
||||
int top = columnsTop + i * (meterHeight + spacing);
|
||||
|
||||
var label = new Label
|
||||
{
|
||||
Text = (wmPos0 + 1).ToString(),
|
||||
Location = new Point(left, top),
|
||||
Size = new Size(labelWid, meterHeight),
|
||||
Font = font,
|
||||
TextAlign = ContentAlignment.MiddleLeft,
|
||||
TabIndex = tabIndex++,
|
||||
Parent = this,
|
||||
};
|
||||
left += labelWid + spacing / 2;
|
||||
labels[wmPos0] = label;
|
||||
this.Controls.Add(label);
|
||||
|
||||
/// Columns
|
||||
for (int k = 0; k < colItems.Count; k++)
|
||||
{
|
||||
DEItem ci = colItems[k];
|
||||
var comboBox = new ComboBox
|
||||
{
|
||||
Name = string.Format("{0}~{1}", k, wmPos0),
|
||||
Location = new Point(left, top),
|
||||
Size = new Size(ci.Width, meterHeight),
|
||||
Enabled = (ci.Action != Ac.LoadReadOnly && !waterMeters[wmPos0].Disabled),
|
||||
Font = font,
|
||||
TabIndex = tabIndex++,
|
||||
Parent = this,
|
||||
};
|
||||
|
||||
comboBox.SelectedIndexChanged += new System.EventHandler(this.comboBox_SelectedIndexChanged);
|
||||
comboBox.TextChanged += new System.EventHandler(this.comboBox_TextChanged);
|
||||
comboBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.comboBox_KeyPress);
|
||||
|
||||
var lastVals = GetHistoryFromLS(isEnd, k);
|
||||
comboBox.Items.Add(lastVals.Length > wmPos0 ? lastVals[wmPos0] : string.Empty); /// History in drop-down menu
|
||||
|
||||
left += ci.Width + spacing;
|
||||
comboBoxes[k, wmPos0] = comboBox;
|
||||
this.Controls.Add(comboBox);
|
||||
}
|
||||
|
||||
var checkBox = new CheckBox
|
||||
{
|
||||
Location = new Point(left, top + 6),
|
||||
Size = new Size(checkBoxWid, 23),
|
||||
TabIndex = tabIndex++,
|
||||
Parent = this,
|
||||
};
|
||||
checkBoxes[wmPos0] = checkBox;
|
||||
this.Controls.Add(checkBox);
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// Adjust window size
|
||||
///
|
||||
Rectangle screenRectangle = this.RectangleToScreen(this.ClientRectangle);
|
||||
int titleBarHeight = screenRectangle.Top - this.Top;
|
||||
Size = new Size(Math.Max(meterWidth * linesCount + margin * (linesCount + 1), margin + groupBoxWidth + buttonsWidth),
|
||||
titleBarHeight + columnsTop + lineSize * (meterHeight + spacing) + margin);
|
||||
|
||||
Localize();
|
||||
InitializeBoxes();
|
||||
|
||||
/// Set focus to the first enabled ComboBox
|
||||
bool activeControlFound = false;
|
||||
for (int ix = 0; ix < commonItemsCount; ix++)
|
||||
{
|
||||
if (commonComboBoxes[ix].Enabled)
|
||||
{
|
||||
ActiveControl = commonComboBoxes[ix];
|
||||
activeControlFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!activeControlFound)
|
||||
{
|
||||
/// Initialize k,j so that after the 1st increment k = 0 and j = 0
|
||||
int k, j;
|
||||
if (isLrOrder) { k = -1; j = 0; }
|
||||
else { k = 0; j = -1; }
|
||||
|
||||
/// Change focus
|
||||
if (FindNextEnabledCombo(comboBoxes, ref k, ref j, isLrOrder))
|
||||
{
|
||||
ActiveControl = okButton;
|
||||
}
|
||||
else
|
||||
{
|
||||
ActiveControl = comboBoxes[k, j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add combo box items from a history stored in a string array (obtained usually from LocalSettings)
|
||||
/// </summary>
|
||||
/// <param name="comboBox">ComboBox to prepare</param>
|
||||
/// <param name="history">String array with a history</param>
|
||||
void AddHistoryToCombo(ComboBox comboBox, string[] history)
|
||||
{
|
||||
if (history != null)
|
||||
{
|
||||
for (int i = 0; i < history.Length; i++) comboBox.Items.Add(history[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns an array of strings from ls.
|
||||
/// Never returns null, null is converted to new string[0].
|
||||
/// </summary>
|
||||
/// <param name="isEnd">false = Beginning of cycle, true = End of cycle</param>
|
||||
/// <param name="k">Column number (0-based)</param>
|
||||
/// <returns>Array of strings</returns>
|
||||
string[] GetHistoryFromLS(bool isEnd, int k)
|
||||
{
|
||||
if (isEnd)
|
||||
{
|
||||
switch (k)
|
||||
{
|
||||
case 0: if (ls.LastEnColA == null) ls.LastEnColA = new string[0]; return ls.LastEnColA;
|
||||
case 1: if (ls.LastEnColB == null) ls.LastEnColB = new string[0]; return ls.LastEnColB;
|
||||
case 2: if (ls.LastEnColC == null) ls.LastEnColC = new string[0]; return ls.LastEnColC;
|
||||
case 3: if (ls.LastEnColD == null) ls.LastEnColD = new string[0]; return ls.LastEnColD;
|
||||
case 4: if (ls.LastEnColE == null) ls.LastEnColE = new string[0]; return ls.LastEnColE;
|
||||
default: return new string[0];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (k)
|
||||
{
|
||||
case 0: if (ls.LastBgColA == null) ls.LastBgColA = new string[0]; return ls.LastBgColA;
|
||||
case 1: if (ls.LastBgColB == null) ls.LastBgColB = new string[0]; return ls.LastBgColB;
|
||||
case 2: if (ls.LastBgColC == null) ls.LastBgColC = new string[0]; return ls.LastBgColC;
|
||||
case 3: if (ls.LastBgColD == null) ls.LastBgColD = new string[0]; return ls.LastBgColD;
|
||||
case 4: if (ls.LastBgColE == null) ls.LastBgColE = new string[0]; return ls.LastBgColE;
|
||||
default: return new string[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Localize()
|
||||
{
|
||||
okButton.Text = Strings.OkBtnText;
|
||||
clearButton.Text = Strings.ClearBtnText;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initialize combo boxes state defined by related 'Action'.
|
||||
/// Clear check boxes.
|
||||
/// </summary>
|
||||
void InitializeBoxes()
|
||||
{
|
||||
isHandlersEnabled = false;
|
||||
|
||||
/// Common combo boxes
|
||||
for (int ix = 0; ix < commonItemsCount; ix++)
|
||||
{
|
||||
switch (commonItems[ix].Action)
|
||||
{
|
||||
default:
|
||||
case Ac.Clear:
|
||||
commonComboBoxes[ix].Text = string.Empty;
|
||||
break;
|
||||
|
||||
case Ac.HistoryLast:
|
||||
commonComboBoxes[ix].Text = (commonComboBoxes[ix].Items.Count > 0)
|
||||
? commonComboBoxes[ix].Items[0].ToString()
|
||||
: string.Empty;
|
||||
break;
|
||||
|
||||
case Ac.Load:
|
||||
case Ac.LoadReadOnly:
|
||||
commonComboBoxes[ix].Text = DEUtils.GetContent(commonItems[ix].Content, firstValidWM);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// Table
|
||||
for (int k = 0; k < colItems.Count; k++)
|
||||
{
|
||||
switch (colItems[k].Action)
|
||||
{
|
||||
default:
|
||||
case Ac.Clear:
|
||||
for (int i = 0; i < wmsCount; i++) comboBoxes[k, i].Text = string.Empty;
|
||||
break;
|
||||
|
||||
case Ac.HistoryLast:
|
||||
for (int i = 0; i < wmsCount; i++)
|
||||
{
|
||||
comboBoxes[k, i].Text = comboBoxes[k, i].Items.Count > 0 ? comboBoxes[k, i].Items[0].ToString() : string.Empty;
|
||||
}
|
||||
break;
|
||||
|
||||
case Ac.Load:
|
||||
case Ac.LoadReadOnly:
|
||||
for (int i = 0; i < wmsCount; i++)
|
||||
{
|
||||
comboBoxes[k, i].Text = DEUtils.GetContent(colItems[k].Content, WaterMeters[i]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < wmsCount; i++)
|
||||
{
|
||||
checkBoxes[i].Checked = isEnd ? (WaterMeters[i] != null && !WaterMeters[i].Disabled) : false;
|
||||
}
|
||||
|
||||
isHandlersEnabled = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// When one combo box is updated using drop-down menu, all combo boxes
|
||||
/// are updated by this function.
|
||||
/// </summary>
|
||||
void UpdateWMsFromBoxes()
|
||||
{
|
||||
for (int ix = 0; ix < commonItemsCount; ix++ )
|
||||
{
|
||||
DEUtils.PutContent(commonItems[ix].Content, firstValidWM, commonComboBoxes[ix].Text);
|
||||
if (commonItems[ix].Action != Ac.LoadReadOnly)
|
||||
{
|
||||
if (isEnd)
|
||||
{
|
||||
switch (ix)
|
||||
{
|
||||
case 0: ls.UpdateHistory(commonComboBoxes[ix].Text, ref ls.LastEnComm1); break;
|
||||
case 1: ls.UpdateHistory(commonComboBoxes[ix].Text, ref ls.LastEnComm2); break;
|
||||
case 2: ls.UpdateHistory(commonComboBoxes[ix].Text, ref ls.LastEnComm3); break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (ix)
|
||||
{
|
||||
case 0: ls.UpdateHistory(commonComboBoxes[ix].Text, ref ls.LastBgComm1); break;
|
||||
case 1: ls.UpdateHistory(commonComboBoxes[ix].Text, ref ls.LastBgComm2); break;
|
||||
case 2: ls.UpdateHistory(commonComboBoxes[ix].Text, ref ls.LastBgComm3); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// Propagate common (batch) values to water meters in case of
|
||||
/// Content.BatchAndWmOrder, Content.BatchAndWmRemark, Content.YearOfCalibration and Content.ArchivePath
|
||||
///
|
||||
foreach (var wm in WaterMeters)
|
||||
{
|
||||
if (wm != null && !wm.Disabled)
|
||||
{
|
||||
switch (commonItems[ix].Content)
|
||||
{
|
||||
case Ct.BatchAndWmOrder: wm.PurchaseOrder = firstValidWM.Batch.PurchaseOrder; break;
|
||||
case Ct.BatchAndWmRemark: wm.Remark = firstValidWM.Batch.Remark; break;
|
||||
case Ct.YearOfCalibration: wm.YearOfProduction = firstValidWM.YearOfProduction; break;
|
||||
case Ct.ArchivePath: wm.ArchivePath = firstValidWM.ArchivePath; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int k = 0; k < colItems.Count; k++)
|
||||
{
|
||||
/// Store values to water meters and prepare an array for a history in the LocalSettings
|
||||
var currentVals = new string[wmsCount];
|
||||
for (int i = 0; i < wmsCount; i++)
|
||||
{
|
||||
DEUtils.PutContent(colItems[k].Content, WaterMeters[i], comboBoxes[k, i].Text);
|
||||
currentVals[i] = comboBoxes[k, i].Text;
|
||||
}
|
||||
|
||||
/// Update history
|
||||
if (colItems[k].Action != Ac.LoadReadOnly)
|
||||
{
|
||||
if (isEnd)
|
||||
{
|
||||
switch (k)
|
||||
{
|
||||
case 0: ls.LastEnColA = currentVals; break;
|
||||
case 1: ls.LastEnColB = currentVals; break;
|
||||
case 2: ls.LastEnColC = currentVals; break;
|
||||
case 3: ls.LastEnColD = currentVals; break;
|
||||
case 4: ls.LastEnColE = currentVals; break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (k)
|
||||
{
|
||||
case 0: ls.LastBgColA = currentVals; break;
|
||||
case 1: ls.LastBgColB = currentVals; break;
|
||||
case 2: ls.LastBgColC = currentVals; break;
|
||||
case 3: ls.LastBgColD = currentVals; break;
|
||||
case 4: ls.LastBgColE = currentVals; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < wmsCount; i++)
|
||||
{
|
||||
if (WaterMeters[i] != null) WaterMeters[i].Disabled = !checkBoxes[i].Checked;
|
||||
}
|
||||
}
|
||||
|
||||
private void clearButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
InitializeBoxes();
|
||||
}
|
||||
|
||||
private void okButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
UpdateWMsFromBoxes();
|
||||
|
||||
completed = true;
|
||||
Close();
|
||||
}
|
||||
private void comboBox_SelectedIndexChanged(object sndr, EventArgs e)
|
||||
{
|
||||
if (!isHandlersEnabled) return;
|
||||
|
||||
string[] kj = (sndr as ComboBox).Name.Split(new char[] { '~' });
|
||||
int k = int.Parse(kj[0]);
|
||||
int j = int.Parse(kj[1]);
|
||||
|
||||
isHandlersEnabled = false;
|
||||
|
||||
if (k >= 0 && comboBoxes[k, j].Text == comboBoxes[k, j].Items[0].ToString())
|
||||
{
|
||||
for (int i = 0; i < wmsCount; i++)
|
||||
{
|
||||
comboBoxes[k, i].Text = comboBoxes[k, i].Items[0].ToString();
|
||||
if (!string.IsNullOrEmpty(comboBoxes[k, i].Text)) checkBoxes[i].Checked = true;
|
||||
}
|
||||
}
|
||||
|
||||
isHandlersEnabled = true;
|
||||
}
|
||||
|
||||
private void comboBox_KeyPress(object sndr, KeyPressEventArgs e)
|
||||
{
|
||||
if (!isHandlersEnabled) return;
|
||||
|
||||
string[] kj = (sndr as ComboBox).Name.Split(new char[] { '~' });
|
||||
int k = int.Parse(kj[0]);
|
||||
int j = int.Parse(kj[1]);
|
||||
|
||||
/// Close the form if any 'form close key' was pressed
|
||||
for (int ix = 0; ix < formCloseKeys.Length; ix++)
|
||||
{
|
||||
if (e.KeyChar == formCloseKeys[ix])
|
||||
{
|
||||
okButton_Click(sndr, e);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (e.KeyChar == '\r')
|
||||
{
|
||||
if (k < 0)
|
||||
{
|
||||
for (int ix = j; ix < commonItemsCount; ix++)
|
||||
{
|
||||
if (commonComboBoxes[ix].Enabled)
|
||||
{
|
||||
commonComboBoxes[ix].Focus();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/// No next enabled common item found:
|
||||
/// Initialize k,j so that after the 1st increment k = 0 and j = 0
|
||||
if (isLrOrder) { k = -1; j = 0; }
|
||||
else { k = 0; j = -1; }
|
||||
}
|
||||
|
||||
/// Change focus
|
||||
if (FindNextEnabledCombo(comboBoxes, ref k, ref j, isLrOrder))
|
||||
{
|
||||
okButton.Focus();
|
||||
}
|
||||
else
|
||||
{
|
||||
comboBoxes[k, j].Focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void comboBox_TextChanged(object sndr, EventArgs e)
|
||||
{
|
||||
if (!isHandlersEnabled) return;
|
||||
|
||||
string[] kj = (sndr as ComboBox).Name.Split(new char[] { '~' });
|
||||
int k = int.Parse(kj[0]);
|
||||
int j = int.Parse(kj[1]);
|
||||
|
||||
if (k >= 0) checkBoxes[j].Checked = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Find the next enabled combo box, update k and i.
|
||||
/// Return true (=pastTheEndOfArray) when there is no such next combo box.
|
||||
/// </summary>
|
||||
/// <param name="comboBoxes">2-dimensional array of combo boxes</param>
|
||||
/// <param name="k">0-nased column </param>
|
||||
/// <param name="i">0-based row</param>
|
||||
/// <param name="isLrOrder">Order of progress to the next combo: true = left-right, false = top-down</param>
|
||||
/// <returns>true (=pastTheEndOfArray) when there is no such next combo box, otherwise false</returns>
|
||||
bool FindNextEnabledCombo(ComboBox[,] comboBoxes, ref int k, ref int i, bool isLrOrder)
|
||||
{
|
||||
bool pastTheEndOfArray = false;
|
||||
do
|
||||
{
|
||||
if (isLrOrder)
|
||||
{
|
||||
if (++k == comboBoxes.GetLength(0))
|
||||
{
|
||||
k = 0;
|
||||
if (++i == comboBoxes.GetLength(1))
|
||||
{
|
||||
i = 0;
|
||||
pastTheEndOfArray = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (++i == comboBoxes.GetLength(1))
|
||||
{
|
||||
i = 0;
|
||||
if (++k == comboBoxes.GetLength(0))
|
||||
{
|
||||
k = 0;
|
||||
pastTheEndOfArray = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
while (!comboBoxes[k, i].Enabled);
|
||||
|
||||
return pastTheEndOfArray;
|
||||
}
|
||||
|
||||
#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
|
||||
}
|
||||
}
|
||||
75
TBF/Rig/DataEntry/Uni/CycleBgEnForm.designer.cs
generated
Normal file
75
TBF/Rig/DataEntry/Uni/CycleBgEnForm.designer.cs
generated
Normal file
@ -0,0 +1,75 @@
|
||||
///
|
||||
/// Copyright (c) 2023 Sensus Slovensko a.s.
|
||||
///
|
||||
namespace TBF.Rig.DataEntry.Uni
|
||||
{
|
||||
partial class CycleBgEnForm
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CycleBgEnForm));
|
||||
this.okButton = new System.Windows.Forms.Button();
|
||||
this.clearButton = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// okButton
|
||||
//
|
||||
resources.ApplyResources(this.okButton, "okButton");
|
||||
this.okButton.ForeColor = System.Drawing.Color.Black;
|
||||
this.okButton.Name = "okButton";
|
||||
this.okButton.UseVisualStyleBackColor = true;
|
||||
this.okButton.Click += new System.EventHandler(this.okButton_Click);
|
||||
//
|
||||
// clearButton
|
||||
//
|
||||
resources.ApplyResources(this.clearButton, "clearButton");
|
||||
this.clearButton.ForeColor = System.Drawing.Color.Black;
|
||||
this.clearButton.Name = "clearButton";
|
||||
this.clearButton.UseVisualStyleBackColor = true;
|
||||
this.clearButton.Click += new System.EventHandler(this.clearButton_Click);
|
||||
//
|
||||
// CycleBgEnForm
|
||||
//
|
||||
resources.ApplyResources(this, "$this");
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.DarkGray;
|
||||
this.Controls.Add(this.clearButton);
|
||||
this.Controls.Add(this.okButton);
|
||||
this.ForeColor = System.Drawing.Color.Black;
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
|
||||
this.Name = "CycleBgEnForm";
|
||||
this.TopMost = true;
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button okButton;
|
||||
private System.Windows.Forms.Button clearButton;
|
||||
}
|
||||
}
|
||||
210
TBF/Rig/DataEntry/Uni/CycleBgEnForm.resx
Normal file
210
TBF/Rig/DataEntry/Uni/CycleBgEnForm.resx
Normal file
@ -0,0 +1,210 @@
|
||||
<?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>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="okButton.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Right</value>
|
||||
</data>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="okButton.Font" type="System.Drawing.Font, System.Drawing">
|
||||
<value>Verdana, 14.25pt</value>
|
||||
</data>
|
||||
<data name="okButton.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>942, 26</value>
|
||||
</data>
|
||||
<data name="okButton.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>112, 63</value>
|
||||
</data>
|
||||
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="okButton.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>7</value>
|
||||
</data>
|
||||
<data name="okButton.Text" xml:space="preserve">
|
||||
<value>OK</value>
|
||||
</data>
|
||||
<data name=">>okButton.Name" xml:space="preserve">
|
||||
<value>okButton</value>
|
||||
</data>
|
||||
<data name=">>okButton.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>okButton.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>okButton.ZOrder" xml:space="preserve">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="clearButton.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Right</value>
|
||||
</data>
|
||||
<data name="clearButton.Font" type="System.Drawing.Font, System.Drawing">
|
||||
<value>Verdana, 14.25pt</value>
|
||||
</data>
|
||||
<data name="clearButton.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="clearButton.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>795, 26</value>
|
||||
</data>
|
||||
<data name="clearButton.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>112, 63</value>
|
||||
</data>
|
||||
<data name="clearButton.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>8</value>
|
||||
</data>
|
||||
<data name="clearButton.Text" xml:space="preserve">
|
||||
<value>Clear</value>
|
||||
</data>
|
||||
<data name=">>clearButton.Name" xml:space="preserve">
|
||||
<value>clearButton</value>
|
||||
</data>
|
||||
<data name=">>clearButton.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>clearButton.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>clearButton.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
|
||||
<value>6, 13</value>
|
||||
</data>
|
||||
<data name="$this.AutoSizeMode" type="System.Windows.Forms.AutoSizeMode, System.Windows.Forms">
|
||||
<value>GrowAndShrink</value>
|
||||
</data>
|
||||
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
|
||||
<value>1094, 561</value>
|
||||
</data>
|
||||
<data name="$this.MaximumSize" type="System.Drawing.Size, System.Drawing">
|
||||
<value>10000, 10000</value>
|
||||
</data>
|
||||
<data name="$this.Text" xml:space="preserve">
|
||||
<value>Batch data</value>
|
||||
</data>
|
||||
<data name=">>$this.Name" xml:space="preserve">
|
||||
<value>CycleBgEnForm</value>
|
||||
</data>
|
||||
<data name=">>$this.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
</root>
|
||||
20
TBF/Rig/DataEntry/Uni/EntryForm.cs
Normal file
20
TBF/Rig/DataEntry/Uni/EntryForm.cs
Normal file
@ -0,0 +1,20 @@
|
||||
///
|
||||
/// Copyright (c) 2023 Sensus Slovensko a.s.
|
||||
///
|
||||
using TBF.Rig.GenericDevices;
|
||||
|
||||
namespace TBF.Rig.DataEntry.Uni
|
||||
{
|
||||
public class EntryForm : EntryFormNoStartEnd, IHasWMStatesForm
|
||||
{
|
||||
public EntryForm()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
|
||||
public EntryForm(Generic.IComponentCfg cfg)
|
||||
: base(cfg)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
1012
TBF/Rig/DataEntry/Uni/EntryFormCfg.cs
Normal file
1012
TBF/Rig/DataEntry/Uni/EntryFormCfg.cs
Normal file
File diff suppressed because it is too large
Load Diff
305
TBF/Rig/DataEntry/Uni/EntryFormNoStartEnd.cs
Normal file
305
TBF/Rig/DataEntry/Uni/EntryFormNoStartEnd.cs
Normal file
@ -0,0 +1,305 @@
|
||||
///
|
||||
/// Copyright (c) 2023 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using TBF.Rig.GenericDevices;
|
||||
|
||||
namespace TBF.Rig.DataEntry.Uni
|
||||
{
|
||||
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 myCfg;
|
||||
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; } }
|
||||
|
||||
Common.Unit volumeUnit;
|
||||
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)
|
||||
{
|
||||
myCfg = 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];
|
||||
volumeUnit = (TBF.Rig.Sequences.ProcessData.BenchInfo != null) ? TBF.Rig.Sequences.ProcessData.BenchInfo.VolumeUnit : Common.Unit.l;
|
||||
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;
|
||||
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;
|
||||
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.waterMeters = TBF.Rig.Sequences.ProcessData.BatchRslts.Batch.WaterMeters;
|
||||
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.waterMeters = TBF.Rig.Sequences.ProcessData.BatchRslts.Batch.WaterMeters;
|
||||
this.regReaders = regReaders;
|
||||
this.refVolume = refVolume;
|
||||
this.errLimLo = errLimLo;
|
||||
this.errLimHi = errLimHi;
|
||||
return this;
|
||||
}
|
||||
|
||||
public IOperation ShowAdvancedTestStartFormOp(IRegReader[] regReaders, IList<Results.Entities.WaterMeter> waterMeters, bool isCondOp = false)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
delegate void EntryFormDlgt(EntryFormNoStartEnd myRef);
|
||||
///
|
||||
void OpenBeginningDlg(EntryFormNoStartEnd myRef)
|
||||
{
|
||||
DEItem.ClearItems();
|
||||
for (int i = 0; i < myCfg.GetBgItemsCount(); i++)
|
||||
{
|
||||
if (myCfg.BgItemContent[i] != Ct.None)
|
||||
{
|
||||
DEItem.AddItem(myCfg.BgItemContent[i], myCfg.BgItemCaption[i], myCfg.BgItemAction[i], myCfg.BgItemWidth[i]);
|
||||
}
|
||||
}
|
||||
|
||||
DEItem.ClearColumns();
|
||||
for (int i = 0; i < myCfg.GetBgColumnsCount(); i++)
|
||||
{
|
||||
if (myCfg.BgColumnContent[i] != Ct.None)
|
||||
{
|
||||
DEItem.AddColumn(myCfg.BgColumnContent[i], myCfg.BgColumnCaption[i], myCfg.BgColumnAction[i], myCfg.BgColumnWidth[i]);
|
||||
}
|
||||
}
|
||||
|
||||
modelessDlg = new CycleBgEnForm(waterMeters, TBF.Data.LineSize, myCfg.BgTitle, myCfg.BgSize, myCfg.BgIsLrOrder, myCfg.BgFormCloseKeys,
|
||||
DEItem.GetItems(), DEItem.GetColumns(), false);
|
||||
modelessDlg.Show();
|
||||
}
|
||||
///
|
||||
void OpenEndDlg(EntryFormNoStartEnd myRef)
|
||||
{
|
||||
DEItem.ClearItems();
|
||||
for (int i = 0; i < myCfg.GetEnItemsCount(); i++)
|
||||
{
|
||||
if (myCfg.EnItemContent[i] != Ct.None)
|
||||
{
|
||||
DEItem.AddItem(myCfg.EnItemContent[i], myCfg.EnItemCaption[i], myCfg.EnItemAction[i], myCfg.EnItemWidth[i]);
|
||||
}
|
||||
}
|
||||
|
||||
DEItem.ClearColumns();
|
||||
for (int i = 0; i < myCfg.GetEnColumnsCount(); i++)
|
||||
{
|
||||
if (myCfg.EnColumnContent[i] != Ct.None)
|
||||
{
|
||||
DEItem.AddColumn(myCfg.EnColumnContent[i], myCfg.EnColumnCaption[i], myCfg.EnColumnAction[i], myCfg.EnColumnWidth[i]);
|
||||
}
|
||||
}
|
||||
|
||||
modelessDlg = new CycleBgEnForm(waterMeters, TBF.Data.LineSize, myCfg.EnTitle, myCfg.EnSize, myCfg.EnIsLrOrder, myCfg.EnFormCloseKeys,
|
||||
DEItem.GetItems(), DEItem.GetColumns(), true);
|
||||
modelessDlg.Show();
|
||||
}
|
||||
///
|
||||
void OpenTestStartStatesDlg(EntryFormNoStartEnd myRef)
|
||||
{
|
||||
DEItem.ClearColumns();
|
||||
for (int i = 0; i < myCfg.GetTestColumnsCount(); i++)
|
||||
{
|
||||
if (myCfg.TestColumnContent[i] != Ct.None)
|
||||
{
|
||||
DEItem.AddColumn(myCfg.TestColumnContent[i], myCfg.TestColumnCaption[i], myCfg.TestColumnAction[i], myCfg.TestColumnWidth[i]);
|
||||
}
|
||||
}
|
||||
|
||||
modelessDlg = new TestStartEndForm(waterMeters, myRef.regReaders, TBF.Data.LineSize, myCfg.TestTitle, myCfg.TestSize,
|
||||
myCfg.TestStartBoxAlwaysEn, myCfg.TestIsLrOrder, myCfg.TestFormCloseKeys, DEItem.GetColumns(),
|
||||
volumeUnit);
|
||||
modelessDlg.Show();
|
||||
}
|
||||
///
|
||||
void OpenTestEndStatesDlg(EntryFormNoStartEnd myRef)
|
||||
{
|
||||
DEItem.ClearColumns();
|
||||
for (int i = 0; i < myCfg.GetTestColumnsCount(); i++)
|
||||
{
|
||||
if (myCfg.TestColumnContent[i] != Ct.None)
|
||||
{
|
||||
DEItem.AddColumn(myCfg.TestColumnContent[i], myCfg.TestColumnCaption[i], myCfg.TestColumnAction[i], myCfg.TestColumnWidth[i]);
|
||||
}
|
||||
}
|
||||
|
||||
modelessDlg = new TestStartEndForm(waterMeters, myRef.regReaders, TBF.Data.LineSize, myCfg.TestTitle, myCfg.TestSize,
|
||||
myCfg.TestStartBoxAlwaysEn, myCfg.TestIsLrOrder, myCfg.TestFormCloseKeys, DEItem.GetColumns(),
|
||||
volumeUnit, wmStartStateStr, refVolume, errLimLo, errLimHi);
|
||||
modelessDlg.Show();
|
||||
}
|
||||
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
resultSaved = false;
|
||||
switch (currentOp)
|
||||
{
|
||||
case CurrentOp.ShowFormAtCycleBeginning:
|
||||
if (myCfg.BgShowForm)
|
||||
{
|
||||
Program.MainWnd.Invoke(new EntryFormDlgt(OpenBeginningDlg), this);
|
||||
}
|
||||
break;
|
||||
case CurrentOp.ShowFormAtCycleEnd:
|
||||
if (myCfg.EnShowForm)
|
||||
{
|
||||
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 (modelessDlg is TestStartEndForm && currentOp == CurrentOp.EnterTestStartStates)
|
||||
{
|
||||
/// Fixed start test - start
|
||||
TestStartEndForm dlg = (modelessDlg as TestStartEndForm);
|
||||
if (dlg != null)
|
||||
{
|
||||
volumeUnit = dlg.VolumeUnit;
|
||||
for (int i = 0; i < waterMeters.Count; i++)
|
||||
{
|
||||
if (!((i < waterMeters.Count && waterMeters[i].Disabled) || (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)
|
||||
{
|
||||
volumeUnit = dlg.VolumeUnit;
|
||||
for (int i = 0; i < waterMeters.Count; i++)
|
||||
{
|
||||
if (!((i < waterMeters.Count && waterMeters[i].Disabled) || (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;
|
||||
}
|
||||
}
|
||||
}
|
||||
25
TBF/Rig/DataEntry/Uni/Factory.cs
Normal file
25
TBF/Rig/DataEntry/Uni/Factory.cs
Normal file
@ -0,0 +1,25 @@
|
||||
///
|
||||
/// Copyright (c) 2023 Sensus Slovensko a.s.
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using TBF.Rig.Generic;
|
||||
|
||||
namespace TBF.Rig.DataEntry.Uni
|
||||
{
|
||||
public class Factory : IComponentFactory
|
||||
{
|
||||
public string ClassName { get { return GetType().Namespace.Substring(8); } }
|
||||
public override string ToString() { return ClassName; }
|
||||
|
||||
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, GetType().Namespace.Substring(8)); }
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
||||
{
|
||||
return ComponentCfgBase.CreateFromDbEntity(EntryFormCfg.Serializer, component, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
24
TBF/Rig/DataEntry/Uni/FactoryNoStartEnd.cs
Normal file
24
TBF/Rig/DataEntry/Uni/FactoryNoStartEnd.cs
Normal file
@ -0,0 +1,24 @@
|
||||
///
|
||||
/// Copyright (c) 2023 Sensus Slovensko a.s.
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using TBF.Rig.Generic;
|
||||
|
||||
namespace TBF.Rig.DataEntry.Uni
|
||||
{
|
||||
public class FactoryNoStartEnd : IComponentFactory
|
||||
{
|
||||
public string ClassName { get { return GetType().Namespace.Substring(8) + "-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, GetType().Namespace.Substring(8) + "-NoStartEnd"); }
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
||||
{
|
||||
return ComponentCfgBase.CreateFromDbEntity(EntryFormCfg.Serializer, component, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
600
TBF/Rig/DataEntry/Uni/TestStartEndForm.cs
Normal file
600
TBF/Rig/DataEntry/Uni/TestStartEndForm.cs
Normal file
@ -0,0 +1,600 @@
|
||||
///
|
||||
/// Copyright (c) 2023 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using log4net;
|
||||
using Common;
|
||||
using Results.Entities;
|
||||
using TBF.Rig.GenericDevices;
|
||||
using TBF.Resources;
|
||||
|
||||
namespace TBF.Rig.DataEntry.Uni
|
||||
{
|
||||
public partial class TestStartEndForm : Form, GenericDevices.IHasCompleted
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(TestStartEndForm));
|
||||
|
||||
/// Arguments
|
||||
public readonly IList<WaterMeter> waterMeters;
|
||||
readonly IRegReader[] regReaders;
|
||||
readonly int lineSize;
|
||||
readonly Sz sz;
|
||||
readonly bool isStartBoxAlwaysEn;
|
||||
readonly bool isLrOrder; /// true = controls obtain focus after ENTER key in left-right order, false = top-down order
|
||||
readonly IList<DEItem> colItems;
|
||||
readonly string formCloseKeys;
|
||||
public readonly string[] WMStartStateStr;
|
||||
readonly double refVolume;
|
||||
readonly double warningLimLo; /// limit to display exclamation mark, typically 2x errLimLo
|
||||
readonly double warningLimHi; /// limit to display exclamation mark, typically 2x errLimHi
|
||||
|
||||
/// Derived from arguments in the constructor
|
||||
readonly bool isEnd;
|
||||
readonly WaterMeter firstValidWM;
|
||||
readonly int wmsCount;
|
||||
readonly int linesCount;
|
||||
readonly bool fixedErrorLimits; /// false in case of calculated error limits
|
||||
|
||||
/// To be retrieved after the form closes
|
||||
public double[] WMStartState;
|
||||
public double[] WMEndState;
|
||||
public Unit VolumeUnit;
|
||||
int startStateColumn;
|
||||
int endStateColumn;
|
||||
|
||||
/// Size and layout related values
|
||||
readonly int meterHeight;
|
||||
readonly int meterWidth;
|
||||
readonly int margin;
|
||||
readonly int spacing;
|
||||
readonly int hdrHeight;
|
||||
readonly int labelWid;
|
||||
readonly int checkBoxWid;
|
||||
|
||||
/// UI elements
|
||||
readonly Label[] labels; /// Labels for water meter numbers
|
||||
readonly TextBox[,] textBoxes; /// Text boxes for values in columns
|
||||
readonly Label[] exclamations;
|
||||
|
||||
readonly LocalSettings ls;
|
||||
|
||||
bool isHandlersEnabled; /// Initially false, set to true after ComboBoxes are filled with data
|
||||
|
||||
// Set to 'true' when the form closes
|
||||
public bool Completed { get { return completed; } }
|
||||
bool completed;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Parameterless constructor for common functionality
|
||||
/// </summary>
|
||||
public TestStartEndForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
ControlBox = false;
|
||||
completed = false;
|
||||
StartForceCloseHandler();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="waterMeters">Water meters</param>
|
||||
/// <param name="regReaders">Array of register readers</param>
|
||||
/// <param name="lineSize">Number of water meters in one (test bencch) line</param>
|
||||
/// <param name="title">Form title</param>
|
||||
/// <param name="sz">Font size</param>
|
||||
/// <param name="isLrOrder">true = controls obtain focus in left-right order, forls = top-down order</param>
|
||||
/// <param name="formCloseKeys">String containing keys to close this form</param>
|
||||
/// <param name="colItems">Water meter items displayed in columns (in the matrix in the main part of the form)</param>
|
||||
/// <param name="initialVolumeUnit">Volume unit preset initially</param>
|
||||
/// <param name="wmStartStateStr">Information entered on test start</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(IList<WaterMeter> waterMeters, IRegReader[] regReaders, int lineSize, string title, Sz sz,
|
||||
bool isStartBoxAlwaysEn, bool isLrOrder, string formCloseKeys, IList<DEItem> colItems,
|
||||
Unit initialVolumeUnit, string[] wmStartStateStr = null,
|
||||
double refVolume = 0, double errLimLo = 0, double errLimHi = 0)
|
||||
: this()
|
||||
{
|
||||
this.waterMeters = waterMeters;
|
||||
this.regReaders = regReaders;
|
||||
this.lineSize = lineSize;
|
||||
this.Text = !string.IsNullOrEmpty(title) ? title : string.Empty;
|
||||
this.sz = sz;
|
||||
this.isStartBoxAlwaysEn = isStartBoxAlwaysEn;
|
||||
this.isLrOrder = isLrOrder;
|
||||
this.formCloseKeys = !string.IsNullOrEmpty(formCloseKeys) ? formCloseKeys : string.Empty;
|
||||
this.colItems = colItems;
|
||||
this.VolumeUnit = initialVolumeUnit;
|
||||
this.WMStartStateStr = wmStartStateStr;
|
||||
this.refVolume = refVolume;
|
||||
this.warningLimLo = 2 * errLimLo;
|
||||
this.warningLimHi = 2 * errLimHi;
|
||||
|
||||
if (waterMeters == null || regReaders == null ||
|
||||
(wmStartStateStr != null && wmStartStateStr.Length != waterMeters.Count))
|
||||
{
|
||||
throw new Exception("Invalid argument");
|
||||
}
|
||||
|
||||
ls = Program.LocalSettings;
|
||||
|
||||
/// Readonly variables derived from arguments
|
||||
isEnd = (wmStartStateStr != null);
|
||||
wmsCount = waterMeters.Count;
|
||||
if (WMStartStateStr == null) WMStartStateStr = new string[wmsCount];
|
||||
fixedErrorLimits = (errLimHi > errLimLo);
|
||||
linesCount = (wmsCount + Math.Max(1, lineSize) - 1) / Math.Max(1, lineSize);
|
||||
firstValidWM = waterMeters.FirstOrDefault(x => (x != null && !x.Disabled));
|
||||
WMStartState = new double[wmsCount];
|
||||
WMEndState = new double[wmsCount];
|
||||
///
|
||||
unitComboBox.Text = VolumeUnit.ToDescription();
|
||||
labels = new Label[wmsCount];
|
||||
textBoxes = new TextBox[colItems.Count, wmsCount];
|
||||
exclamations = new Label[wmsCount];
|
||||
|
||||
/// Layout related readonly variables derived from argument 'sz'
|
||||
Font font;
|
||||
Font exclamationFont;
|
||||
switch (sz)
|
||||
{
|
||||
case Sz.S:
|
||||
font = new Font("Verdana", 12, FontStyle.Regular);
|
||||
//exclamationFont = new Font("Verdana", 24F, FontStyle.Bold, GraphicsUnit.Point, ((byte)(238)));
|
||||
exclamationFont = new Font("Verdana", 18, FontStyle.Bold);
|
||||
meterHeight = 26; /// Height of a ComboBox control
|
||||
margin = 20;
|
||||
spacing = 8;
|
||||
hdrHeight = 160;
|
||||
labelWid = 31;
|
||||
checkBoxWid = 23;
|
||||
break;
|
||||
|
||||
default:
|
||||
case Sz.M:
|
||||
font = new Font("Verdana", 14, FontStyle.Regular);
|
||||
exclamationFont = new Font("Verdana", 20, FontStyle.Bold);
|
||||
meterHeight = 31; /// Height of a ComboBox control
|
||||
margin = 25;
|
||||
spacing = 10;
|
||||
hdrHeight = 160;
|
||||
labelWid = 34;
|
||||
checkBoxWid = 23;
|
||||
break;
|
||||
|
||||
case Sz.L:
|
||||
font = new Font("Verdana", 18, FontStyle.Regular);
|
||||
exclamationFont = new Font("Verdana", 24, FontStyle.Bold);
|
||||
meterHeight = 37; /// Height of a ComboBox control
|
||||
margin = 30;
|
||||
spacing = 12;
|
||||
hdrHeight = 160;
|
||||
labelWid = 40;
|
||||
checkBoxWid = 23;
|
||||
break;
|
||||
}
|
||||
meterWidth = labelWid + checkBoxWid + spacing;
|
||||
foreach (var ci in colItems) { meterWidth += ci.Width + spacing; }
|
||||
|
||||
int tabIndex = 1;
|
||||
|
||||
///
|
||||
/// Table
|
||||
///
|
||||
int columnsTop = hdrHeight;
|
||||
for (int j = 0; j < linesCount; j++)
|
||||
{
|
||||
/// Captions
|
||||
int capX = margin + j * (meterWidth + margin / 2) + labelWid + spacing;
|
||||
int capY = columnsTop - meterHeight;
|
||||
for (int k = 0; k < colItems.Count; k++)
|
||||
{
|
||||
int labelWidth = Convert.ToInt32(Graphics.FromImage(new Bitmap(1, 1)).MeasureString(colItems[k].Caption, font).Width);
|
||||
var label = new Label
|
||||
{
|
||||
Text = colItems[k].Caption,
|
||||
Location = new Point(capX, capY),
|
||||
Size = new Size(labelWidth + spacing, meterHeight),
|
||||
Font = font,
|
||||
TabIndex = tabIndex++,
|
||||
Parent = this,
|
||||
};
|
||||
capX += colItems[k].Width + spacing;
|
||||
}
|
||||
|
||||
/// Water meters
|
||||
for (int i = 0; i < lineSize; i++)
|
||||
{
|
||||
int wmPos0 = i + lineSize * j;
|
||||
if (wmPos0 > wmsCount) continue;
|
||||
|
||||
int left = margin + j * (meterWidth + margin / 2);
|
||||
int top = columnsTop + i * (meterHeight + spacing);
|
||||
|
||||
var label = new Label
|
||||
{
|
||||
Text = (wmPos0 + 1).ToString(),
|
||||
Location = new Point(left, top),
|
||||
Size = new Size(labelWid, meterHeight),
|
||||
Font = font,
|
||||
TextAlign = ContentAlignment.MiddleLeft,
|
||||
TabIndex = tabIndex++,
|
||||
Parent = this,
|
||||
};
|
||||
left += labelWid + spacing / 2;
|
||||
labels[wmPos0] = label;
|
||||
this.Controls.Add(label);
|
||||
|
||||
/// Columns
|
||||
for (int k = 0; k < colItems.Count; k++)
|
||||
{
|
||||
DEItem ci = colItems[k];
|
||||
var textBox = new TextBox
|
||||
{
|
||||
Name = string.Format("{0}~{1}", k, wmPos0),
|
||||
Location = new Point(left, top),
|
||||
Size = new Size(ci.Width, meterHeight),
|
||||
Enabled = (ci.Action != Ac.LoadReadOnly && !waterMeters[wmPos0].Disabled),
|
||||
Font = font,
|
||||
TabIndex = tabIndex++,
|
||||
Parent = this,
|
||||
};
|
||||
|
||||
textBox.TextChanged += new System.EventHandler(textBox_TextChanged);
|
||||
textBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(textBox_KeyPress);
|
||||
textBox.MouseClick += new System.Windows.Forms.MouseEventHandler(textBox_MouseClick);
|
||||
|
||||
left += ci.Width + spacing;
|
||||
textBoxes[k, wmPos0] = textBox;
|
||||
this.Controls.Add(textBox);
|
||||
}
|
||||
|
||||
var exclamation = new Label
|
||||
{
|
||||
AutoSize = true,
|
||||
Font = exclamationFont,
|
||||
ForeColor = System.Drawing.Color.Red,
|
||||
Location = new Point(left, top),
|
||||
Parent = this,
|
||||
TabIndex = tabIndex++,
|
||||
Text = "!",
|
||||
Visible = false,
|
||||
};
|
||||
exclamations[wmPos0] = exclamation;
|
||||
this.Controls.Add(exclamation);
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// Adjust window size
|
||||
///
|
||||
Rectangle screenRectangle = this.RectangleToScreen(this.ClientRectangle);
|
||||
int titleBarHeight = screenRectangle.Top - this.Top;
|
||||
Size = new Size(Math.Max(meterWidth * linesCount + margin * (linesCount + 1), 1300),
|
||||
titleBarHeight + columnsTop + lineSize * (meterHeight + spacing) + margin);
|
||||
|
||||
Localize();
|
||||
InitializeBoxes();
|
||||
|
||||
/// Set focus to the first enabled ComboBox
|
||||
}
|
||||
|
||||
void Localize()
|
||||
{
|
||||
okButton.Text = Strings.OkBtnText;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initialize combo boxes state defined by related 'Action'.
|
||||
/// Clear check boxes.
|
||||
/// </summary>
|
||||
void InitializeBoxes()
|
||||
{
|
||||
isHandlersEnabled = false;
|
||||
|
||||
/// Table
|
||||
startStateColumn = -1;
|
||||
endStateColumn = -1;
|
||||
for (int k = 0; k < colItems.Count; k++)
|
||||
{
|
||||
if (colItems[k].Content == Ct.StartState)
|
||||
{
|
||||
startStateColumn = k;
|
||||
for (int i = 0; i < wmsCount; i++)
|
||||
{
|
||||
textBoxes[k, i].Text = (!isEnd || waterMeters[i] == null
|
||||
|| waterMeters[i].Disabled
|
||||
|| i >= regReaders.Length
|
||||
|| regReaders[i] == null
|
||||
|| string.IsNullOrEmpty(WMStartStateStr[i])) ? string.Empty : WMStartStateStr[i];
|
||||
|
||||
textBoxes[k, i].Enabled = (isStartBoxAlwaysEn || !isEnd) && waterMeters[i] != null && !waterMeters[i].Disabled
|
||||
&& i < regReaders.Length && regReaders[i] != null;
|
||||
}
|
||||
}
|
||||
else if (colItems[k].Content == Ct.EndState)
|
||||
{
|
||||
endStateColumn = k;
|
||||
for (int i = 0; i < wmsCount; i++)
|
||||
{
|
||||
textBoxes[k, i].Text = string.Empty;
|
||||
textBoxes[k, i].Enabled = isEnd && waterMeters[i] != null && !waterMeters[i].Disabled
|
||||
&& i < regReaders.Length && regReaders[i] != null;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (colItems[k].Action)
|
||||
{
|
||||
default:
|
||||
case Ac.Clear:
|
||||
case Ac.HistoryLast:
|
||||
for (int i = 0; i < wmsCount; i++) textBoxes[k, i].Text = string.Empty;
|
||||
break;
|
||||
|
||||
case Ac.Load:
|
||||
case Ac.LoadReadOnly:
|
||||
for (int i = 0; i < wmsCount; i++)
|
||||
{
|
||||
textBoxes[k, i].Text = DEUtils.GetContent(colItems[k].Content, waterMeters[i]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isEnd && isStartBoxAlwaysEn)
|
||||
{
|
||||
int k = 0;
|
||||
int j = 0;
|
||||
if (!FindNextEnabledTextBox(textBoxes, ref k, ref j, isLrOrder, true))
|
||||
{
|
||||
ActiveControl = textBoxes[k, j];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
isHandlersEnabled = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// When one combo box is updated using drop-down menu, all combo boxes
|
||||
/// are updated by this function.
|
||||
/// </summary>
|
||||
void UpdateWMsFromBoxes()
|
||||
{
|
||||
for (int k = 0; k < colItems.Count; k++)
|
||||
{
|
||||
for (int i = 0; i < wmsCount; i++)
|
||||
{
|
||||
if (colItems[k].Content == Ct.StartState)
|
||||
{
|
||||
/// Water meter start state
|
||||
double startVol;
|
||||
if (textBoxes[k, i].Enabled && Utils.TryParseUDouble(textBoxes[k, i].Text, out startVol))
|
||||
{
|
||||
WMStartStateStr[i] = textBoxes[k, i].Text;
|
||||
WMStartState[i] = Units.ConvertFrom(VolumeUnit, startVol);
|
||||
}
|
||||
}
|
||||
else if (colItems[k].Content == Ct.EndState)
|
||||
{
|
||||
/// Water meter end state
|
||||
double endVol;
|
||||
if (textBoxes[k, i].Enabled && Utils.TryParseUDouble(textBoxes[k, i].Text, out endVol))
|
||||
{
|
||||
WMEndState[i] = Units.ConvertFrom(VolumeUnit, endVol);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/// Other value - store values to a water meter structure
|
||||
DEUtils.PutContent(colItems[k].Content, waterMeters[i], textBoxes[k, i].Text);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void okButton_Click(object sender, EventArgs eArgs)
|
||||
{
|
||||
UpdateWMsFromBoxes();
|
||||
|
||||
completed = true;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void unitComboBox_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
unitComboBox_SelectedIndexChanged(sender, e);
|
||||
}
|
||||
|
||||
private void unitComboBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
var newUnit = Units.FromDescription(unitComboBox.Text);
|
||||
|
||||
if (Units.IsVolume(newUnit))
|
||||
{
|
||||
VolumeUnit = newUnit;
|
||||
|
||||
if (!isHandlersEnabled) return;
|
||||
|
||||
/// Update exclamation marks
|
||||
if (isEnd && startStateColumn >= 0 && endStateColumn >= 0)
|
||||
{
|
||||
for (int i = 0; i < wmsCount; i++)
|
||||
{
|
||||
double startVol, endVol;
|
||||
|
||||
if (Utils.TryParseUDouble(textBoxes[startStateColumn, i].Text, out startVol) &&
|
||||
Utils.TryParseUDouble(textBoxes[endStateColumn, i].Text, out endVol))
|
||||
{
|
||||
double startState = Units.ConvertFrom(VolumeUnit, startVol);
|
||||
double endState = Units.ConvertFrom(VolumeUnit, endVol);
|
||||
double err = (refVolume != 0) ? 100.0 * (endState - startState - refVolume) / refVolume : 1000.0;
|
||||
exclamations[i].Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
else
|
||||
{
|
||||
exclamations[i].Visible = !string.IsNullOrEmpty(textBoxes[endStateColumn, i].Text);
|
||||
}
|
||||
}
|
||||
|
||||
largeTextBox.Text = string.Empty;
|
||||
largeExclamationLabel.Visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void textBox_KeyPress(object sndr, KeyPressEventArgs e)
|
||||
{
|
||||
if (!isHandlersEnabled) return;
|
||||
|
||||
string[] kj = (sndr as TextBox).Name.Split(new char[] { '~' });
|
||||
int k = int.Parse(kj[0]);
|
||||
int j = int.Parse(kj[1]);
|
||||
|
||||
/// Close the form if any 'form close key' was pressed
|
||||
if (!string.IsNullOrEmpty(formCloseKeys))
|
||||
{
|
||||
/// Close the form if any 'close form key' was pressed
|
||||
for (int ix = 0; ix < formCloseKeys.Length; ix++)
|
||||
{
|
||||
if (e.KeyChar == formCloseKeys[ix])
|
||||
{
|
||||
okButton_Click(sndr, e);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (e.KeyChar == '\r')
|
||||
{
|
||||
/// Change focus
|
||||
if (FindNextEnabledTextBox(textBoxes, ref k, ref j, isLrOrder))
|
||||
{
|
||||
okButton.Focus();
|
||||
}
|
||||
else
|
||||
{
|
||||
textBoxes[k, j].Focus();
|
||||
largeTextBox.Text = string.Format("{0}: {1}", j + 1, textBoxes[k, j].Text);
|
||||
largeExclamationLabel.Visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Handle mouse clicks so that the large text box and the large exclamation mark are updated
|
||||
private void textBox_MouseClick(object sndr, MouseEventArgs e)
|
||||
{
|
||||
textBox_TextChanged(sndr, e);
|
||||
}
|
||||
|
||||
private void textBox_TextChanged(object sndr, EventArgs e)
|
||||
{
|
||||
if (!isHandlersEnabled) return;
|
||||
|
||||
string[] kj = (sndr as TextBox).Name.Split(new char[] { '~' });
|
||||
int k = int.Parse(kj[0]);
|
||||
int j = int.Parse(kj[1]);
|
||||
|
||||
largeTextBox.Text = string.Format("{0}: {1}", j + 1, textBoxes[k, j].Text);
|
||||
|
||||
if (isEnd && (k == startStateColumn || k == endStateColumn))
|
||||
{
|
||||
double startVol, endVol;
|
||||
|
||||
if (startStateColumn >= 0 && Utils.TryParseUDouble(textBoxes[startStateColumn, j].Text, out startVol) &&
|
||||
endStateColumn >= 0 && Utils.TryParseUDouble(textBoxes[endStateColumn, j].Text, out endVol))
|
||||
{
|
||||
double startState = Units.ConvertFrom(VolumeUnit, startVol);
|
||||
double endState = Units.ConvertFrom(VolumeUnit, endVol);
|
||||
double err = (refVolume != 0) ? 100.0 * (endState - startState - refVolume) / refVolume : 1000.0;
|
||||
largeExclamationLabel.Visible =
|
||||
exclamations[j].Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
else
|
||||
{
|
||||
largeExclamationLabel.Visible =
|
||||
exclamations[j].Visible = !string.IsNullOrEmpty(textBoxes[endStateColumn, j].Text);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
largeExclamationLabel.Visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Find the next enabled combo box, update k and i.
|
||||
/// Return true (=pastTheEndOfArray) when there is no such next combo box.
|
||||
/// </summary>
|
||||
/// <param name="textBoxes">2-dimensional array of combo boxes</param>
|
||||
/// <param name="k">0-nased column </param>
|
||||
/// <param name="i">0-based row</param>
|
||||
/// <param name="isLrOrder">Order of progress to the next combo: true = left-right, false = top-down</param>
|
||||
/// <returns>true (=pastTheEndOfArray) when there is no such next combo box, otherwise false</returns>
|
||||
bool FindNextEnabledTextBox(TextBox[,] textBoxes, ref int k, ref int i, bool isLrOrder, bool skipStartColumn = false)
|
||||
{
|
||||
bool pastTheEndOfArray = false;
|
||||
do
|
||||
{
|
||||
if (isLrOrder)
|
||||
{
|
||||
if (++k == textBoxes.GetLength(0))
|
||||
{
|
||||
k = 0;
|
||||
if (++i == textBoxes.GetLength(1))
|
||||
{
|
||||
i = 0;
|
||||
pastTheEndOfArray = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (++i == textBoxes.GetLength(1))
|
||||
{
|
||||
i = 0;
|
||||
if (++k == textBoxes.GetLength(0))
|
||||
{
|
||||
k = 0;
|
||||
pastTheEndOfArray = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
while (!textBoxes[k, i].Enabled || (skipStartColumn && k == startStateColumn));
|
||||
|
||||
return pastTheEndOfArray;
|
||||
}
|
||||
|
||||
#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
|
||||
}
|
||||
}
|
||||
114
TBF/Rig/DataEntry/Uni/TestStartEndForm.designer.cs
generated
Normal file
114
TBF/Rig/DataEntry/Uni/TestStartEndForm.designer.cs
generated
Normal file
@ -0,0 +1,114 @@
|
||||
///
|
||||
/// Copyright (c) 2023 Sensus Slovensko a.s.
|
||||
///
|
||||
namespace TBF.Rig.DataEntry.Uni
|
||||
{
|
||||
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.okButton = new System.Windows.Forms.Button();
|
||||
this.largeTextBox = new System.Windows.Forms.TextBox();
|
||||
this.largeExclamationLabel = new System.Windows.Forms.Label();
|
||||
this.unitComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// 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(1120, 29);
|
||||
this.okButton.Name = "okButton";
|
||||
this.okButton.Size = new System.Drawing.Size(123, 63);
|
||||
this.okButton.TabIndex = 100;
|
||||
this.okButton.Text = "OK";
|
||||
this.okButton.UseVisualStyleBackColor = true;
|
||||
this.okButton.Click += new System.EventHandler(this.okButton_Click);
|
||||
//
|
||||
// largeTextBox
|
||||
//
|
||||
this.largeTextBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 48F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.largeTextBox.Location = new System.Drawing.Point(35, 29);
|
||||
this.largeTextBox.Name = "largeTextBox";
|
||||
this.largeTextBox.Size = new System.Drawing.Size(849, 80);
|
||||
this.largeTextBox.TabIndex = 101;
|
||||
//
|
||||
// largeExclamationLabel
|
||||
//
|
||||
this.largeExclamationLabel.AutoSize = true;
|
||||
this.largeExclamationLabel.Font = new System.Drawing.Font("Verdana", 48F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.largeExclamationLabel.ForeColor = System.Drawing.Color.Red;
|
||||
this.largeExclamationLabel.Location = new System.Drawing.Point(890, 28);
|
||||
this.largeExclamationLabel.Name = "largeExclamationLabel";
|
||||
this.largeExclamationLabel.Size = new System.Drawing.Size(59, 78);
|
||||
this.largeExclamationLabel.TabIndex = 102;
|
||||
this.largeExclamationLabel.Text = "!";
|
||||
this.largeExclamationLabel.Visible = false;
|
||||
//
|
||||
// unitComboBox
|
||||
//
|
||||
this.unitComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.unitComboBox.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.unitComboBox.FormattingEnabled = true;
|
||||
this.unitComboBox.Location = new System.Drawing.Point(962, 46);
|
||||
this.unitComboBox.Name = "unitComboBox";
|
||||
this.unitComboBox.Size = new System.Drawing.Size(123, 31);
|
||||
this.unitComboBox.TabIndex = 103;
|
||||
this.unitComboBox.SelectedIndexChanged += new System.EventHandler(this.unitComboBox_SelectedIndexChanged);
|
||||
this.unitComboBox.TextChanged += new System.EventHandler(this.unitComboBox_TextChanged);
|
||||
//
|
||||
// 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(1284, 676);
|
||||
this.Controls.Add(this.unitComboBox);
|
||||
this.Controls.Add(this.largeExclamationLabel);
|
||||
this.Controls.Add(this.largeTextBox);
|
||||
this.Controls.Add(this.okButton);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
|
||||
this.Name = "TestStartEndForm";
|
||||
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "End States";
|
||||
this.TopMost = true;
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button okButton;
|
||||
private System.Windows.Forms.TextBox largeTextBox;
|
||||
private System.Windows.Forms.Label largeExclamationLabel;
|
||||
private System.Windows.Forms.ComboBox unitComboBox;
|
||||
|
||||
}
|
||||
}
|
||||
120
TBF/Rig/DataEntry/Uni/TestStartEndForm.resx
Normal file
120
TBF/Rig/DataEntry/Uni/TestStartEndForm.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@ -273,6 +273,8 @@ namespace TBF.Rig.Sequences
|
||||
if (cmpnt is ISessionDataMngmnt) (cmpnt as ISessionDataMngmnt).StartSession();
|
||||
}
|
||||
|
||||
DataEntry.DEItem.ClearSummaryColumns();
|
||||
|
||||
IsQ2PreCorrectionCalculated = false;
|
||||
CalculatedQ2PreCorrectionLR = 0;
|
||||
CalculatedQ2PreCorrectionRL = 0;
|
||||
|
||||
@ -8,6 +8,7 @@ using log4net;
|
||||
using Common;
|
||||
using Config;
|
||||
using Config.Entities;
|
||||
using TBF.Rig.DataEntry;
|
||||
using TBF.Rig.GenericDevices;
|
||||
using TBF.Rig.Operations;
|
||||
using TBF.Boxes;
|
||||
@ -1352,31 +1353,35 @@ namespace TBF.Rig.Sequences
|
||||
//sb.Append(";"); sb.Append((tstRslt.TotalPulsesMstr != 0) ? tstRslt.TotalPulsesMstr.ToString() : " "); /// CD - '' - pre druhy (Prolonged : celkovy pocet)
|
||||
sb.Append(";"); sb.Append(1000 * tstRslt.TestTimeCorrection); /// CD [ms] Diverter test time correction
|
||||
|
||||
for (int i = 0; i < ProcessData.BatchRslts.WMPositionsCount; i++)
|
||||
var smryItems = DEItem.GetSummaryColumns();
|
||||
|
||||
for (int i = 0; i < BatchRslts.WMPositionsCount; i++)
|
||||
{
|
||||
if (ProcessData.BatchRslts.Batch.WaterMeters != null &&
|
||||
ProcessData.BatchRslts.Batch.WaterMeters.Count > i &&
|
||||
ProcessData.BatchRslts.Batch.WaterMeters[i] != null &&
|
||||
!ProcessData.BatchRslts.Batch.WaterMeters[i].Disabled)
|
||||
if (BatchRslts.Batch.WaterMeters != null &&
|
||||
BatchRslts.Batch.WaterMeters.Count > i &&
|
||||
BatchRslts.Batch.WaterMeters[i] != null &&
|
||||
!BatchRslts.Batch.WaterMeters[i].Disabled)
|
||||
{
|
||||
if (!ProcessData.BatchRslts.Batch.WaterMeters[i].Compound() && !ProcessData.BatchRslts.Batch.WaterMeters[i].HeatMeter())
|
||||
var wm = BatchRslts.Batch.WaterMeters[i];
|
||||
|
||||
if (!wm.Compound() && !wm.HeatMeter())
|
||||
{
|
||||
/// If this is a single meter
|
||||
|
||||
Results.Entities.MeterTestRslt mtrRslt = ProcessData.BatchRslts.GetMeterTestRslt(tstRslt.Name(), i, CompoundMeterId.Single);
|
||||
Results.Entities.MeterTestRslt mtrRslt = BatchRslts.GetMeterTestRslt(tstRslt.Name(), i, CompoundMeterId.Single);
|
||||
|
||||
if (mtrRslt != null)
|
||||
{
|
||||
bool isCamera = (mtrRslt.RegReaderType == (int)RegisterReaderType.Camera);
|
||||
|
||||
sb.Append(";"); sb.Append(ProcessData.BatchRslts.Batch.WaterMeters[i].SerialNr);/// CE WM Ser.No.
|
||||
sb.Append(";"); sb.Append(wm.SerialNr);/// CE WM Ser.No.
|
||||
sb.Append(";"); sb.Append(mtrRslt.VolumeStart); /// CF WM Vstart - pociatocny stav pri pevnom starte alebo zachyteny pri data streame
|
||||
sb.Append(";"); sb.Append(mtrRslt.VolumeEnd); /// CG WM Vend - konecny stav pri pevnom starte alebo zachyteny pri data streame
|
||||
sb.Append(";"); sb.Append(mtrRslt.VolumeMeter); /// CH WM Vmer - objem namerany vodomerom
|
||||
sb.Append(";"); sb.Append(mtrRslt.VolumeRef); /// CI WM Vref - objem namerany stanicou
|
||||
sb.Append(";"); sb.Append(mtrRslt.Error); /// CJ WM Emt - chyba vodomerom nameraneho objemu
|
||||
#if IPERL
|
||||
sb.Append(";"); sb.Append(ProcessData.BatchRslts.Batch.WaterMeters[i].CalibFactor); /// CK iPerl calibration factor used during the test / ...
|
||||
sb.Append(";"); sb.Append(wm.CalibFactor); /// CK iPerl calibration factor used during the test / ...
|
||||
#else
|
||||
sb.Append(";"); sb.Append(" "); /// CK nechat prazdne
|
||||
#endif
|
||||
@ -1391,7 +1396,7 @@ namespace TBF.Rig.Sequences
|
||||
#endif
|
||||
sb.Append(";"); sb.Append(isCamera
|
||||
? mtrRslt.VolumeStart * mtrRslt.PulsesPerLiter /// CQ WM Phi_start (pri hodnotach z kamery)
|
||||
: ProcessData.BatchRslts.Batch.WaterMeters[i].WMPosition); /// CQ WMPosition (normalne)
|
||||
: wm.WMPosition); /// CQ WMPosition (normalne)
|
||||
sb.Append(";"); sb.Append(isCamera
|
||||
? mtrRslt.VolumeEnd * mtrRslt.PulsesPerLiter /// CR WM Phi_end (pri hodnotach z kamery)
|
||||
: 0); /// CR not used/spare (normalne)
|
||||
@ -1399,15 +1404,15 @@ namespace TBF.Rig.Sequences
|
||||
sb.Append(";"); sb.Append(mtrRslt.TimestampStart); /// CS WM Time_start - ' ' -
|
||||
sb.Append(";"); sb.Append(mtrRslt.TimestampEnd); /// CT WM Time_end - ' ' -
|
||||
|
||||
sb.Append(";"); sb.Append(isCamera ? mtrRslt.PulsesPerLiter : 0); /// CU WM Degree per liter
|
||||
|
||||
sb.Append(";"); sb.Append(0); /// CV Analog out 1 (max mA)
|
||||
sb.Append(";"); sb.Append(0); /// CW Analog out 2 (V)
|
||||
sb.Append(";"); sb.Append(0); /// CX Analog out 3 (min mA)
|
||||
sb.Append(";"); sb.Append(0); /// CY Analog out 4 (max Q)
|
||||
//sb.Append(";"); sb.Append(isCamera ? mtrRslt.PulsesPerLiter : 0); /// CU camera: WM Degree per liter
|
||||
sb.Append(";"); sb.Append(smryItems.Count < 1 ? "0" : DEUtils.GetContent(smryItems[0].Content, wm)); /// CU
|
||||
sb.Append(";"); sb.Append(smryItems.Count < 2 ? "0" : DEUtils.GetContent(smryItems[1].Content, wm)); /// CV
|
||||
sb.Append(";"); sb.Append(smryItems.Count < 3 ? "0" : DEUtils.GetContent(smryItems[2].Content, wm)); /// CW
|
||||
sb.Append(";"); sb.Append(smryItems.Count < 4 ? "0" : DEUtils.GetContent(smryItems[3].Content, wm)); /// CX
|
||||
sb.Append(";"); sb.Append(smryItems.Count < 5 ? "0" : DEUtils.GetContent(smryItems[4].Content, wm)); /// CY
|
||||
}
|
||||
}
|
||||
else if (ProcessData.BatchRslts.Batch.WaterMeters[i].Compound())
|
||||
else if (wm.Compound())
|
||||
{
|
||||
/// Else if this is a compound meter
|
||||
|
||||
@ -1421,13 +1426,13 @@ namespace TBF.Rig.Sequences
|
||||
switch ((CompoundMeterId)b)
|
||||
{
|
||||
case CompoundMeterId.CompoundMain:
|
||||
sb.Append(ProcessData.BatchRslts.Batch.WaterMeters[i].SerialNr); /// CE
|
||||
sb.Append(wm.SerialNr); /// CE
|
||||
break;
|
||||
case CompoundMeterId.CompoundAux:
|
||||
sb.Append(ProcessData.BatchRslts.Batch.WaterMeters[i].SerialNrAux); /// CE
|
||||
sb.Append(wm.SerialNrAux); /// CE
|
||||
break;
|
||||
case CompoundMeterId.Compound:
|
||||
sb.Append(ProcessData.BatchRslts.Batch.WaterMeters[i].SerialNr); /// CE
|
||||
sb.Append(wm.SerialNr); /// CE
|
||||
break;
|
||||
}
|
||||
sb.Append(";"); sb.Append(mtrRslt.VolumeStart); /// CF WM Vinit - pri pevnom starte pociatocny stav natukany alebo cez inteligentny system
|
||||
@ -1456,7 +1461,7 @@ namespace TBF.Rig.Sequences
|
||||
}
|
||||
}
|
||||
}
|
||||
else /// if (ProcessData.BatchRslts.WaterMeters[i].HeatMeter())
|
||||
else /// if (wm.HeatMeter())
|
||||
{
|
||||
/// Else this is a heat meter
|
||||
|
||||
@ -1465,14 +1470,14 @@ namespace TBF.Rig.Sequences
|
||||
|
||||
if (volumeMtr != null)
|
||||
{
|
||||
sb.Append(";"); sb.Append(ProcessData.BatchRslts.Batch.WaterMeters[i].SerialNr); /// WM Ser.No.
|
||||
sb.Append(";"); sb.Append(wm.SerialNr); /// WM Ser.No.
|
||||
sb.Append(";"); sb.Append(volumeMtr.VolumeStart); /// WM Vstart - pociatocny stav pri pevnom starte alebo zachyteny pri data streame
|
||||
sb.Append(";"); sb.Append(volumeMtr.VolumeEnd); /// WM Vend - konecny stav pri pevnom starte alebo zachyteny pri data streame
|
||||
sb.Append(";"); sb.Append(volumeMtr.VolumeMeter); /// WM Vmer - objem namerany vodomerom
|
||||
sb.Append(";"); sb.Append(volumeMtr.VolumeRef); /// WM Vref - objem namerany stanicou
|
||||
sb.Append(";"); sb.Append(volumeMtr.Error); /// WM Emt - chyba vodomerom nameraneho objemu
|
||||
#if IPERL
|
||||
sb.Append(";"); sb.Append(ProcessData.BatchRslts.Batch.WaterMeters[i].CalibFactor); /// iPerl calibration factor used during the test / ...
|
||||
sb.Append(";"); sb.Append(wm.CalibFactor); /// iPerl calibration factor used during the test / ...
|
||||
#else
|
||||
sb.Append(";"); sb.Append(" "); /// nechat prazdne
|
||||
#endif
|
||||
@ -1500,7 +1505,7 @@ namespace TBF.Rig.Sequences
|
||||
sb.Append(";"); sb.Append(energyMtr.VolumeRef); /// WM Vref - objem namerany stanicou
|
||||
sb.Append(";"); sb.Append(energyMtr.Error); /// WM Emt - chyba vodomerom nameraneho objemu
|
||||
#if IPERL
|
||||
sb.Append(";"); sb.Append(ProcessData.BatchRslts.Batch.WaterMeters[i].CalibFactor); /// iPerl calibration factor used during the test / ...
|
||||
sb.Append(";"); sb.Append(wm.CalibFactor); /// iPerl calibration factor used during the test / ...
|
||||
#else
|
||||
sb.Append(";"); sb.Append(" "); /// nechat prazdne
|
||||
#endif
|
||||
|
||||
@ -52,6 +52,7 @@ namespace TBF.Rig
|
||||
|
||||
/// Public components
|
||||
public static Elde.ControlBoardDev ControlBoard;
|
||||
public static IWaterMeter WaterMeterCmpnt;
|
||||
public static GenericDevices.IAmbient Ambient;
|
||||
public static IOperation BenchWaitingOp;
|
||||
public static IOperation BenchErrorOp;
|
||||
@ -358,7 +359,9 @@ namespace TBF.Rig
|
||||
}
|
||||
}
|
||||
|
||||
if (cmpnt is IScaleOrTank)
|
||||
if (WaterMeterCmpnt == null && cmpnt is IWaterMeter) WaterMeterCmpnt = cmpnt as IWaterMeter;
|
||||
|
||||
if (cmpnt is IScaleOrTank)
|
||||
{
|
||||
IScaleOrTank tank = cmpnt as IScaleOrTank;
|
||||
|
||||
|
||||
@ -44,6 +44,7 @@ namespace TBF.Rig
|
||||
Factories.Add(new DataEntry.Standard48.Factory());
|
||||
Factories.Add(new DataEntry.Standard48.FactoryNoStartEnd());
|
||||
Factories.Add(new DataEntry.StandardCamera.Factory());
|
||||
Factories.Add(new DataEntry.Uni.Factory());
|
||||
Factories.Add(new DataEntry.WMStates.EntryFormFactory());
|
||||
Factories.Add(new RegisterReaders.KPackE.DataEntryForRadio.Factory()); /// DataEntry for KPackE radio
|
||||
Factories.Add(new Dummy.Balance.Factory());
|
||||
|
||||
@ -526,11 +526,11 @@ namespace TBF.Rig.TestMethods.DiverterTest
|
||||
|
||||
/// Delay 'TimeFlow2Mass', min. 5 seconds
|
||||
State.Create(string.Format("{0}({1}) : Delay {2}", test.Method, test.Name, divRepetNr))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.AddOperation(new Operations.TimerOp(Math.Max(5, test.TimeFlow2Mass)))
|
||||
.EnterState();
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.AddOperation(new Operations.TimerOp(Math.Max(5, test.TimeFlow2Mass)))
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
|
||||
@ -54,7 +54,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
string payload = "03";
|
||||
RfidCommunicationService rfidCommunicationService = new RfidCommunicationService { ComPort = $"COM{iHead.RfidComPortNr}", WaitTimeAfterFailure = 2200, PassThroughWaitTime = 1500, MaxRetries = 3, TimeOut = 5000 };
|
||||
rfidCommunicationService.RfidWrite(Params.u8_WakeUpInterval, payload);
|
||||
return rfidCommunicationService.RfidRead<string>(Params.u8_WakeUpInterval) == payload? "OK" : "Error";
|
||||
return rfidCommunicationService.RfidRead(Params.u8_WakeUpInterval).ToString() == payload? "OK" : "Error";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -70,7 +70,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
RfidCommunicationService rfidCommunicationService = new RfidCommunicationService { ComPort = $"COM{iHead.RfidComPortNr}", WaitTimeAfterFailure = 2200, PassThroughWaitTime = 1500, MaxRetries = 3, TimeOut = 5000 };
|
||||
rfidCommunicationService.RfidWrite(SystemInfo.u8_system_state, payload);
|
||||
Thread.Sleep(1000); // must be for pass thru params
|
||||
return rfidCommunicationService.RfidRead<string>(SystemInfo.u8_system_state) == payload ? "OK" : "Error";
|
||||
return rfidCommunicationService.RfidRead(SystemInfo.u8_system_state).ToString() == payload ? "OK" : "Error";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -88,7 +88,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
{
|
||||
RfidCommunicationService rfidCommunicationService = new RfidCommunicationService { ComPort = $"COM{iHead.RfidComPortNr}", WaitTimeAfterFailure = 2200, PassThroughWaitTime = 1500, MaxRetries = 3, TimeOut = 5000 };
|
||||
//rfidCommunicationService.RfidWrite(Params.u8_Customer_Text, custText);
|
||||
return rfidCommunicationService.RfidRead<string>(Params.u8_Customer_Text);
|
||||
return rfidCommunicationService.RfidRead(Params.u8_Customer_Text).ToString();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
@ -117,6 +117,7 @@
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\log4net.2.0.2\lib\net40-full\log4net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="Microsoft.VisualBasic">
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
@ -241,6 +242,7 @@
|
||||
<Compile Include="Rig\DataEntry\DataStream\TestStartEndForm.designer.cs">
|
||||
<DependentUpon>TestStartEndForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Rig\DataEntry\DEItem.cs" />
|
||||
<Compile Include="Rig\DataEntry\Double24\CycleBeginningForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
@ -556,6 +558,23 @@
|
||||
<DependentUpon>TestStartEndForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Rig\DataEntry\DEUtils.cs" />
|
||||
<Compile Include="Rig\DataEntry\Uni\CycleBgEnForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Rig\DataEntry\Uni\CycleBgEnForm.designer.cs">
|
||||
<DependentUpon>CycleBgEnForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Rig\DataEntry\Uni\EntryForm.cs" />
|
||||
<Compile Include="Rig\DataEntry\Uni\EntryFormCfg.cs" />
|
||||
<Compile Include="Rig\DataEntry\Uni\EntryFormNoStartEnd.cs" />
|
||||
<Compile Include="Rig\DataEntry\Uni\Factory.cs" />
|
||||
<Compile Include="Rig\DataEntry\Uni\FactoryNoStartEnd.cs" />
|
||||
<Compile Include="Rig\DataEntry\Uni\TestStartEndForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Rig\DataEntry\Uni\TestStartEndForm.designer.cs">
|
||||
<DependentUpon>TestStartEndForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Rig\DataEntry\WMStates\EntryForm.cs" />
|
||||
<Compile Include="Rig\DataEntry\WMStates\EntryFormCfg.cs" />
|
||||
<Compile Include="Rig\DataEntry\WMStates\EntryFormCfgCtrl.cs">
|
||||
@ -2980,6 +2999,12 @@
|
||||
<EmbeddedResource Include="Rig\DataEntry\StandardCamera\TestStartEndForm.resx">
|
||||
<DependentUpon>TestStartEndForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Rig\DataEntry\Uni\CycleBgEnForm.resx">
|
||||
<DependentUpon>CycleBgEnForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Rig\DataEntry\Uni\TestStartEndForm.resx">
|
||||
<DependentUpon>TestStartEndForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Rig\DataEntry\WMStates\EntryFormCfgCtrl.resx">
|
||||
<DependentUpon>EntryFormCfgCtrl.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
||||
@ -194,8 +194,9 @@ namespace TBF.UI.Bench.Metrology
|
||||
double correction; /// Correction in default unit
|
||||
double error = 0;
|
||||
|
||||
if (subItem == 1 && Utils.TryParseEDouble(strValue, out oriMeasurement) && (measurement = Units.ConvertFrom(currentUnit, oriMeasurement)) >= 0)
|
||||
if (subItem == 1 && Utils.TryParseEDouble(strValue, out oriMeasurement))
|
||||
{
|
||||
measurement = Units.ConvertFrom(currentUnit, oriMeasurement);
|
||||
(item.Tag as MeasurementCorrection).Measurement = measurement;
|
||||
|
||||
/// Update error (if possible)
|
||||
|
||||
@ -140,28 +140,31 @@ namespace TBF.UI.Bench.TestProfiles
|
||||
{
|
||||
base.OkBtnClicked();
|
||||
|
||||
using (ITransaction transaction = session.BeginTransaction())
|
||||
if (session != null && session.IsOpen)
|
||||
{
|
||||
try
|
||||
using (ITransaction transaction = session.BeginTransaction())
|
||||
{
|
||||
foreach (var entity in ToBeRemovedItems) session.Delete(entity);
|
||||
ToBeRemovedItems.Clear();
|
||||
|
||||
int itemNr = 0;
|
||||
foreach (var entity in MyItems)
|
||||
try
|
||||
{
|
||||
(entity as Profile).ItemNr = itemNr++;
|
||||
session.SaveOrUpdate(entity);
|
||||
}
|
||||
foreach (var entity in ToBeRemovedItems) session.Delete(entity);
|
||||
ToBeRemovedItems.Clear();
|
||||
|
||||
transaction.Commit();
|
||||
session.Flush();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
transaction.Rollback();
|
||||
log.ErrorFormat("Cannot save changes to DB: {0}", exc.Message);
|
||||
MessageBox.Show(Strings.Cannot_save_changes, Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
int itemNr = 0;
|
||||
foreach (var entity in MyItems)
|
||||
{
|
||||
(entity as Profile).ItemNr = itemNr++;
|
||||
session.SaveOrUpdate(entity);
|
||||
}
|
||||
|
||||
transaction.Commit();
|
||||
session.Flush();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
transaction.Rollback();
|
||||
log.ErrorFormat("Cannot save changes to DB: {0}", exc.Message);
|
||||
MessageBox.Show(Strings.Cannot_save_changes, Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
101
TBF/UI/MainWnd.Designer.cs
generated
101
TBF/UI/MainWnd.Designer.cs
generated
@ -107,6 +107,16 @@ namespace TBF.UI
|
||||
this.resultsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.graphsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.calendarTSMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.profileLabel = new System.Windows.Forms.Label();
|
||||
this.profileComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.producerLabel = new System.Windows.Forms.Label();
|
||||
this.mclassLabel = new System.Windows.Forms.Label();
|
||||
this.q3Label = new System.Windows.Forms.Label();
|
||||
this.dnLabel = new System.Windows.Forms.Label();
|
||||
this.producerComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.mclassComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.q3ComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.dnComboBox = new System.Windows.Forms.ComboBox();
|
||||
((System.ComponentModel.ISupportInitialize)(this.topVerticalSplitContainer)).BeginInit();
|
||||
this.topVerticalSplitContainer.Panel1.SuspendLayout();
|
||||
this.topVerticalSplitContainer.Panel2.SuspendLayout();
|
||||
@ -235,6 +245,16 @@ namespace TBF.UI
|
||||
//
|
||||
// descriptionGroupBox
|
||||
//
|
||||
this.descriptionGroupBox.Controls.Add(this.profileLabel);
|
||||
this.descriptionGroupBox.Controls.Add(this.profileComboBox);
|
||||
this.descriptionGroupBox.Controls.Add(this.producerLabel);
|
||||
this.descriptionGroupBox.Controls.Add(this.mclassLabel);
|
||||
this.descriptionGroupBox.Controls.Add(this.q3Label);
|
||||
this.descriptionGroupBox.Controls.Add(this.dnLabel);
|
||||
this.descriptionGroupBox.Controls.Add(this.producerComboBox);
|
||||
this.descriptionGroupBox.Controls.Add(this.mclassComboBox);
|
||||
this.descriptionGroupBox.Controls.Add(this.q3ComboBox);
|
||||
this.descriptionGroupBox.Controls.Add(this.dnComboBox);
|
||||
this.descriptionGroupBox.Controls.Add(this.descriptionLabel);
|
||||
resources.ApplyResources(this.descriptionGroupBox, "descriptionGroupBox");
|
||||
this.descriptionGroupBox.Name = "descriptionGroupBox";
|
||||
@ -580,10 +600,10 @@ namespace TBF.UI
|
||||
resources.ApplyResources(this.upgradeTSMenuItem, "upgradeTSMenuItem");
|
||||
this.upgradeTSMenuItem.Click += new System.EventHandler(this.upgradeTSMenuItem_Click);
|
||||
//
|
||||
// iPerlHeadsToolStripMenuItem
|
||||
// optoHeadsToolStripMenuItem
|
||||
//
|
||||
this.optoHeadsToolStripMenuItem.Name = "iPerlHeadsToolStripMenuItem";
|
||||
resources.ApplyResources(this.optoHeadsToolStripMenuItem, "iPerlHeadsToolStripMenuItem");
|
||||
this.optoHeadsToolStripMenuItem.Name = "optoHeadsToolStripMenuItem";
|
||||
resources.ApplyResources(this.optoHeadsToolStripMenuItem, "optoHeadsToolStripMenuItem");
|
||||
this.optoHeadsToolStripMenuItem.Click += new System.EventHandler(this.optoHeadsToolStripMenuItem_Click);
|
||||
//
|
||||
// clearCountersToolStripMenuItem
|
||||
@ -651,6 +671,71 @@ namespace TBF.UI
|
||||
resources.ApplyResources(this.calendarTSMenuItem, "calendarTSMenuItem");
|
||||
this.calendarTSMenuItem.Click += new System.EventHandler(this.calendarTSMenuItem_Click);
|
||||
//
|
||||
// profileLabel
|
||||
//
|
||||
resources.ApplyResources(this.profileLabel, "profileLabel");
|
||||
this.profileLabel.Name = "profileLabel";
|
||||
//
|
||||
// profileComboBox
|
||||
//
|
||||
this.profileComboBox.FormattingEnabled = true;
|
||||
resources.ApplyResources(this.profileComboBox, "profileComboBox");
|
||||
this.profileComboBox.Name = "profileComboBox";
|
||||
this.profileComboBox.SelectedIndexChanged += new System.EventHandler(this.profileComboBox_SelectedIndexChanged);
|
||||
this.profileComboBox.TextChanged += new System.EventHandler(this.profileComboBox_TextChanged);
|
||||
//
|
||||
// producerLabel
|
||||
//
|
||||
resources.ApplyResources(this.producerLabel, "producerLabel");
|
||||
this.producerLabel.Name = "producerLabel";
|
||||
//
|
||||
// mclassLabel
|
||||
//
|
||||
resources.ApplyResources(this.mclassLabel, "mclassLabel");
|
||||
this.mclassLabel.Name = "mclassLabel";
|
||||
//
|
||||
// q3Label
|
||||
//
|
||||
resources.ApplyResources(this.q3Label, "q3Label");
|
||||
this.q3Label.Name = "q3Label";
|
||||
//
|
||||
// dnLabel
|
||||
//
|
||||
resources.ApplyResources(this.dnLabel, "dnLabel");
|
||||
this.dnLabel.Name = "dnLabel";
|
||||
//
|
||||
// producerComboBox
|
||||
//
|
||||
this.producerComboBox.FormattingEnabled = true;
|
||||
resources.ApplyResources(this.producerComboBox, "producerComboBox");
|
||||
this.producerComboBox.Name = "producerComboBox";
|
||||
this.producerComboBox.SelectedIndexChanged += new System.EventHandler(this.producerComboBox_SelectedIndexChanged);
|
||||
this.producerComboBox.TextChanged += new System.EventHandler(this.producerComboBox_TextChanged);
|
||||
//
|
||||
// mclassComboBox
|
||||
//
|
||||
this.mclassComboBox.FormattingEnabled = true;
|
||||
resources.ApplyResources(this.mclassComboBox, "mclassComboBox");
|
||||
this.mclassComboBox.Name = "mclassComboBox";
|
||||
this.mclassComboBox.SelectedIndexChanged += new System.EventHandler(this.mclassComboBox_SelectedIndexChanged);
|
||||
this.mclassComboBox.TextChanged += new System.EventHandler(this.mclassComboBox_TextChanged);
|
||||
//
|
||||
// q3ComboBox
|
||||
//
|
||||
this.q3ComboBox.FormattingEnabled = true;
|
||||
resources.ApplyResources(this.q3ComboBox, "q3ComboBox");
|
||||
this.q3ComboBox.Name = "q3ComboBox";
|
||||
this.q3ComboBox.SelectedIndexChanged += new System.EventHandler(this.q3ComboBox_SelectedIndexChanged);
|
||||
this.q3ComboBox.TextChanged += new System.EventHandler(this.q3ComboBox_TextChanged);
|
||||
//
|
||||
// dnComboBox
|
||||
//
|
||||
this.dnComboBox.FormattingEnabled = true;
|
||||
resources.ApplyResources(this.dnComboBox, "dnComboBox");
|
||||
this.dnComboBox.Name = "dnComboBox";
|
||||
this.dnComboBox.SelectedIndexChanged += new System.EventHandler(this.dnComboBox_SelectedIndexChanged);
|
||||
this.dnComboBox.TextChanged += new System.EventHandler(this.dnComboBox_TextChanged);
|
||||
//
|
||||
// MainWnd
|
||||
//
|
||||
resources.ApplyResources(this, "$this");
|
||||
@ -807,6 +892,16 @@ namespace TBF.UI
|
||||
private System.Windows.Forms.ToolStripMenuItem benchUncertaintyTSMItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem calendarTSMenuItem;
|
||||
private System.Windows.Forms.TabPage calendarTabPage;
|
||||
private System.Windows.Forms.Label profileLabel;
|
||||
private System.Windows.Forms.ComboBox profileComboBox;
|
||||
private System.Windows.Forms.Label producerLabel;
|
||||
private System.Windows.Forms.Label mclassLabel;
|
||||
private System.Windows.Forms.Label q3Label;
|
||||
private System.Windows.Forms.Label dnLabel;
|
||||
private System.Windows.Forms.ComboBox producerComboBox;
|
||||
private System.Windows.Forms.ComboBox mclassComboBox;
|
||||
private System.Windows.Forms.ComboBox q3ComboBox;
|
||||
private System.Windows.Forms.ComboBox dnComboBox;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -29,8 +29,17 @@ namespace TBF.UI
|
||||
public static IDictionary<string, int> ProcedureNrs = new Dictionary<string, int>(); /// Used in PreviousResultsDlg
|
||||
|
||||
public BenchControlPanel BenchControlPanel;
|
||||
|
||||
string selectedProfile;
|
||||
float selectedDN;
|
||||
double selectedQ3;
|
||||
string selectedMClass;
|
||||
string selectedProducer;
|
||||
public IList<Procedure> AllProcedures; /// List of all active procedures
|
||||
public IList<Procedure> Procedures; /// List of procedures satisfying filter criteria
|
||||
public ProcedureInfo SelectedProcedure;
|
||||
public Procedure CurrentProcedure;
|
||||
|
||||
public bool IsShutdownDisabled;
|
||||
public bool IsShutdownPCAfterClosingTbf;
|
||||
|
||||
@ -103,8 +112,8 @@ namespace TBF.UI
|
||||
|
||||
Text = string.Format("Test Bench Framework ver. {0} - {1}{2}",
|
||||
Program.Version,
|
||||
TBF.DB.CurrentBench.BenchName,
|
||||
TBF.DB.CurrentBench.IsRealBench ? "" : Strings._offline);
|
||||
DB.CurrentBench.BenchName,
|
||||
DB.CurrentBench.IsRealBench ? "" : Strings._offline);
|
||||
///
|
||||
/// Customize menu items
|
||||
///
|
||||
@ -117,13 +126,13 @@ namespace TBF.UI
|
||||
helpTSMenuItem.Text = Strings.Help;
|
||||
#if CAMERA
|
||||
/// Add 'Camera' menu item
|
||||
cameraTSMItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
cameraTSMItem = new ToolStripMenuItem();
|
||||
|
||||
cameraTSMItem.Name = "cameraTSMItem";
|
||||
cameraTSMItem.Text = Strings.Camera;
|
||||
cameraTSMItem.Click += new System.EventHandler(this.cameraTSMItem_Click);
|
||||
cameraTSMItem.Click += new EventHandler(this.cameraTSMItem_Click);
|
||||
|
||||
mainMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {this.cameraTSMItem});
|
||||
mainMenuStrip.Items.AddRange(new ToolStripItem[] {this.cameraTSMItem});
|
||||
#endif
|
||||
UpdateMenuItemsVisibility();
|
||||
|
||||
@ -133,14 +142,14 @@ namespace TBF.UI
|
||||
IsShutdownDisabled = true;
|
||||
IsShutdownPCAfterClosingTbf = false;
|
||||
|
||||
Rig.StateMachine.MachineState = TBF.DB.CurrentBench.IsRealBench ? Rig.MachineState.StartingUp : Rig.MachineState.Disabled;
|
||||
Rig.StateMachine.MachineState = DB.CurrentBench.IsRealBench ? Rig.MachineState.StartingUp : Rig.MachineState.Disabled;
|
||||
TBF.Data.SetData();
|
||||
///
|
||||
if (Rig.StateMachine.MachineState == Rig.MachineState.StartingUp)
|
||||
{
|
||||
try
|
||||
{
|
||||
startupSession = TBF.DB.ConfigDBSessionFactory.OpenSession();
|
||||
startupSession = DB.ConfigDBSessionFactory.OpenSession();
|
||||
|
||||
/// Load components, initialize the control board, etc.
|
||||
Rig.StateMachine.InitializeBoardEtc(startupSession, ctrlBrdComponent);
|
||||
@ -180,9 +189,41 @@ namespace TBF.UI
|
||||
MessageBox.Show(errMsg, Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
}
|
||||
}
|
||||
|
||||
/// Profile
|
||||
selectedProfile = null;
|
||||
ComboBox cb = profileComboBox;
|
||||
cb.Items.Add(Strings.any);
|
||||
cb.Items.Add(Strings.no_profile);
|
||||
cb.Items.Add(Strings.any_profile);
|
||||
cb.Text = cb.Items[0].ToString();
|
||||
|
||||
/// DN
|
||||
selectedDN = 0;
|
||||
cb = dnComboBox;
|
||||
cb.Items.Add(Strings.any);
|
||||
cb.Text = cb.Items[0].ToString();
|
||||
|
||||
/// Q3 / Qn
|
||||
selectedQ3 = 0;
|
||||
cb = q3ComboBox;
|
||||
cb.Items.Add(Strings.any);
|
||||
cb.Text = cb.Items[0].ToString();
|
||||
|
||||
/// Metrological class
|
||||
selectedMClass = null;
|
||||
cb = mclassComboBox;
|
||||
cb.Items.Add(Strings.any);
|
||||
cb.Text = cb.Items[0].ToString();
|
||||
|
||||
/// Producer
|
||||
selectedProducer = null;
|
||||
cb = producerComboBox;
|
||||
cb.Items.Add(Strings.any);
|
||||
cb.Text = cb.Items[0].ToString();
|
||||
}
|
||||
|
||||
void Localize()
|
||||
void Localize()
|
||||
{
|
||||
procedureGroupBox.Text = Strings.Procedure;
|
||||
activityGroupBox.Text = Strings.Activity;
|
||||
@ -213,7 +254,7 @@ namespace TBF.UI
|
||||
Top = (ls.MainWndTop != 0) ? ls.MainWndTop : 5;
|
||||
}
|
||||
|
||||
if (TBF.Rig.StateMachine.MachineState == TBF.Rig.MachineState.StartingUp)
|
||||
if (Rig.StateMachine.MachineState == Rig.MachineState.StartingUp)
|
||||
{
|
||||
var form = new Shared.ModelessActivityForm()
|
||||
{
|
||||
@ -284,7 +325,7 @@ namespace TBF.UI
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
TBF.Rig.StateMachine.MachineState = TBF.Rig.MachineState.FailedToStart;
|
||||
Rig.StateMachine.MachineState = Rig.MachineState.FailedToStart;
|
||||
|
||||
form.CloseForm(null, new EventArgs());
|
||||
formThread.Join();
|
||||
@ -295,9 +336,7 @@ namespace TBF.UI
|
||||
Environment.NewLine + exc.Message,
|
||||
innerExcMsg);
|
||||
log.Fatal(errMsg);
|
||||
MessageBox.Show(errMsg, Strings.Error,
|
||||
System.Windows.Forms.MessageBoxButtons.OK,
|
||||
System.Windows.Forms.MessageBoxIcon.Exclamation);
|
||||
MessageBox.Show(errMsg, Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
}
|
||||
}
|
||||
|
||||
@ -309,9 +348,9 @@ namespace TBF.UI
|
||||
|
||||
/// Initialize bench control user interface(s)
|
||||
BenchControlPanel = new BenchControlPanel();
|
||||
BenchControlPanel.BalancesCount = TBF.Rig.MettlerToledo.Standard.BalanceDev.BalancesCount
|
||||
+ TBF.Rig.MettlerToledo.Multi.BalanceDev.BalancesCount
|
||||
+ TBF.Rig.Various.TankWithLevelMsrmnt.Tank.TanksCount;
|
||||
BenchControlPanel.BalancesCount = Rig.MettlerToledo.Standard.BalanceDev.BalancesCount
|
||||
+ Rig.MettlerToledo.Multi.BalanceDev.BalancesCount
|
||||
+ Rig.Various.TankWithLevelMsrmnt.Tank.TanksCount;
|
||||
new System.ComponentModel.ComponentResourceManager(typeof(MainWnd)).ApplyResources(BenchControlPanel, "benchControlPanel");
|
||||
BenchControlPanel.Name = "benchControlPanel";
|
||||
rightHorizSplitContainer.Panel2.Controls.Add(BenchControlPanel);
|
||||
@ -324,15 +363,15 @@ namespace TBF.UI
|
||||
UpdateUser();
|
||||
mainTabControl.SelectTab((int)MainTabPageId.Hydraulics);
|
||||
|
||||
if (TBF.Rig.StateMachine.MachineState == TBF.Rig.MachineState.StartingUp)
|
||||
if (Rig.StateMachine.MachineState == Rig.MachineState.StartingUp)
|
||||
{
|
||||
///
|
||||
/// Populate calendar with calendar events from components
|
||||
///
|
||||
var calEvents = new List<Config.CalendarEvent.ICalendarEvent>();
|
||||
foreach (var cmpnt in TBF.Rig.StateMachine.Components)
|
||||
foreach (var cmpnt in Rig.StateMachine.Components)
|
||||
{
|
||||
var cmpntWithEvents = cmpnt as TBF.Rig.GenericDevices.IHasCalendarEvents;
|
||||
var cmpntWithEvents = cmpnt as Rig.GenericDevices.IHasCalendarEvents;
|
||||
if (cmpntWithEvents != null)
|
||||
{
|
||||
foreach (var evnt in cmpntWithEvents.GetCalendarEvents()) calEvents.Add(evnt);
|
||||
@ -345,13 +384,10 @@ namespace TBF.UI
|
||||
Rig.StateMachine.Start();
|
||||
log.Info("Test bench started");
|
||||
}
|
||||
else if (TBF.Rig.StateMachine.MachineState == TBF.Rig.MachineState.FailedToStart)
|
||||
else if (Rig.StateMachine.MachineState == Rig.MachineState.FailedToStart)
|
||||
{
|
||||
BenchControlPanel.OnButtonsEtc(null, new ButtonsEtcEventArgs(ButtonsEtc.None));
|
||||
MessageBox.Show(Strings.Bench_is_not_running,
|
||||
Strings.Warning,
|
||||
System.Windows.Forms.MessageBoxButtons.OK,
|
||||
System.Windows.Forms.MessageBoxIcon.Exclamation);
|
||||
MessageBox.Show(Strings.Bench_is_not_running, Strings.Warning, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
}
|
||||
}
|
||||
|
||||
@ -379,7 +415,7 @@ namespace TBF.UI
|
||||
/// <summary>
|
||||
/// Invoked from the UiBridge to update the activity label.
|
||||
/// </summary>
|
||||
void OnActivity(object sender, UiBridge.ActivityEventArgs args)
|
||||
void OnActivity(object sender, ActivityEventArgs args)
|
||||
{
|
||||
switch (args.Cmd)
|
||||
{
|
||||
@ -407,7 +443,7 @@ namespace TBF.UI
|
||||
void OnStateChanged(object sender, StateChangedEventArgs args)
|
||||
{
|
||||
activityStatusLabel.Text = string.Format("{0}: {1}, {2}",
|
||||
TBF.Resources.Strings.Batch, TBF.Rig.Sequences.ProcessData.BatchNr, args.StateChangedMsg);
|
||||
Strings.Batch, Rig.Sequences.ProcessData.BatchNr, args.StateChangedMsg);
|
||||
}
|
||||
|
||||
void OnTestProgress(object sender, UiBridge.TestProgressEventArgs args)
|
||||
@ -436,9 +472,9 @@ namespace TBF.UI
|
||||
{
|
||||
mainProgressBar.Value = 0;
|
||||
|
||||
if (TBF.Rig.Sequences.ProcessData.BatchRslts != null)
|
||||
if (Rig.Sequences.ProcessData.BatchRslts != null)
|
||||
{
|
||||
var b = TBF.Rig.Sequences.ProcessData.BatchRslts.Batch;
|
||||
var b = Rig.Sequences.ProcessData.BatchRslts.Batch;
|
||||
if (b != null && b.EndTime > b.StartTime)
|
||||
{
|
||||
progressGroupBox.Text = string.Format("{0} @ {1}", Strings.End, b.EndTime.ToShortTimeString());
|
||||
@ -479,17 +515,23 @@ namespace TBF.UI
|
||||
return;
|
||||
}
|
||||
|
||||
procedureComboBox.Enabled = ((args.Flags & ButtonsEtc.ProcedureCmbBoxEn) != 0);
|
||||
optoHeadsToolStripMenuItem.Enabled = ((args.Flags & ButtonsEtc.ProcedureCmbBoxEn) != 0);
|
||||
bool isProcSelectionEnabled = (args.Flags & ButtonsEtc.ProcedureCmbBoxEn) != 0;
|
||||
|
||||
if (procedureComboBox.Enabled) progressGroupBox.Text = Strings.Progress;
|
||||
procedureComboBox.Enabled = isProcSelectionEnabled;
|
||||
|
||||
if (procedureComboBox.Enabled && ProceduresUpdated)
|
||||
profileComboBox.Enabled = dnComboBox.Enabled = q3ComboBox.Enabled =
|
||||
mclassComboBox.Enabled = producerComboBox.Enabled = isProcSelectionEnabled;
|
||||
|
||||
optoHeadsToolStripMenuItem.Enabled = isProcSelectionEnabled;
|
||||
|
||||
if (isProcSelectionEnabled) progressGroupBox.Text = Strings.Progress;
|
||||
|
||||
if (isProcSelectionEnabled && ProceduresUpdated)
|
||||
{
|
||||
ReloadProcedureComboBoxItems();
|
||||
}
|
||||
|
||||
IsShutdownDisabled = ((args.Flags & ButtonsEtc.ProcedureCmbBoxEn) == 0);
|
||||
IsShutdownDisabled = !isProcSelectionEnabled;
|
||||
}
|
||||
|
||||
void OnSaveSettings(object sender, SaveSettingsEventArgs args)
|
||||
@ -623,7 +665,7 @@ namespace TBF.UI
|
||||
{
|
||||
default:
|
||||
case RemoteDBUse.LocalDBOnly:
|
||||
dBase = new ISessionFactory[] { TBF.DB.ConfigDBSessionFactory };
|
||||
dBase = new ISessionFactory[] { DB.ConfigDBSessionFactory };
|
||||
signature = new string[] { "" };
|
||||
break;
|
||||
case RemoteDBUse.RemoteDBOnly:
|
||||
@ -631,11 +673,11 @@ namespace TBF.UI
|
||||
signature = new string[] { "R" };
|
||||
break;
|
||||
case RemoteDBUse.BothDBsLocalFirst:
|
||||
dBase = new ISessionFactory[] { TBF.DB.ConfigDBSessionFactory, TBF.DB.SharedDBSessionFactory };
|
||||
dBase = new ISessionFactory[] { DB.ConfigDBSessionFactory, TBF.DB.SharedDBSessionFactory };
|
||||
signature = new string[] { "L", "R" };
|
||||
break;
|
||||
case RemoteDBUse.BothDBsRemoteFirst:
|
||||
dBase = new ISessionFactory[] { TBF.DB.SharedDBSessionFactory, TBF.DB.ConfigDBSessionFactory };
|
||||
dBase = new ISessionFactory[] { TBF.DB.SharedDBSessionFactory, DB.ConfigDBSessionFactory };
|
||||
signature = new string[] { "R", "L" };
|
||||
break;
|
||||
}
|
||||
@ -658,16 +700,48 @@ namespace TBF.UI
|
||||
|
||||
foreach (var proc in procedures)
|
||||
{
|
||||
string itemText = string.Format("{0}{1}{2}{3}", signature[i], proc.ItemNr + 1, ProcSeparator, proc.Name);
|
||||
procedureComboBox.Items.Add(itemText);
|
||||
if (!ProcedureNrs.ContainsKey(proc.Name)) ProcedureNrs.Add(proc.Name, proc.ItemNr + 1);
|
||||
|
||||
if ((procedureNameToSelect == proc.Name) && !procedureSet)
|
||||
if (Rig.StateMachine.WaterMeterCmpnt != null)
|
||||
{
|
||||
procedureComboBox.Text = itemText;
|
||||
SelectedProcedure = new ProcedureInfo(procedureNameToSelect, (dBase[i] == TBF.DB.SharedDBSessionFactory));
|
||||
BenchControlPanel.ReloadTests(session);
|
||||
procedureSet = true;
|
||||
var waterMeterParams = Rig.StateMachine.WaterMeterCmpnt.Cfg.GetUIProcParamsProvider(proc);
|
||||
Rig.WaterMeters.WaterMeter.ProcParams wmParams = waterMeterParams as TBF.Rig.WaterMeters.WaterMeter.ProcParams;
|
||||
if (wmParams != null)
|
||||
{
|
||||
proc.DN = wmParams.DN;
|
||||
proc.Qn = wmParams.Qn;
|
||||
proc.MClass = wmParams.MetrologicalClass;
|
||||
proc.Producer = wmParams.Producer;
|
||||
|
||||
if (!string.IsNullOrEmpty(proc.AltProcName) && !profileComboBox.Items.Contains(proc.AltProcName))
|
||||
{
|
||||
profileComboBox.Items.Add(proc.AltProcName);
|
||||
}
|
||||
if (!dnComboBox.Items.Contains(wmParams.DN.ToString())) dnComboBox.Items.Add(wmParams.DN.ToString());
|
||||
if (!q3ComboBox.Items.Contains(wmParams.Qn.ToString())) q3ComboBox.Items.Add(wmParams.Qn.ToString());
|
||||
if (!mclassComboBox.Items.Contains(wmParams.MetrologicalClass)) mclassComboBox.Items.Add(wmParams.MetrologicalClass);
|
||||
if (!producerComboBox.Items.Contains(wmParams.Producer)) producerComboBox.Items.Add(wmParams.Producer);
|
||||
}
|
||||
}
|
||||
|
||||
if ((selectedProfile == null ||
|
||||
(selectedProfile == Strings.no_profile && string.IsNullOrEmpty(proc.AltProcName)) ||
|
||||
(selectedProfile == Strings.any_profile && !string.IsNullOrEmpty(proc.AltProcName)) ||
|
||||
selectedProfile == proc.AltProcName) &&
|
||||
(selectedDN == 0 || selectedDN == proc.DN) &&
|
||||
(selectedQ3 == 0 || selectedQ3 == proc.Qn) &&
|
||||
(selectedMClass == null || selectedMClass == proc.MClass) &&
|
||||
(selectedProducer == null || selectedProducer == proc.Producer))
|
||||
{
|
||||
string itemText = string.Format("{0}{1}{2}{3}", signature[i], proc.ItemNr + 1, ProcSeparator, proc.Name);
|
||||
procedureComboBox.Items.Add(itemText);
|
||||
if (!ProcedureNrs.ContainsKey(proc.Name)) ProcedureNrs.Add(proc.Name, proc.ItemNr + 1);
|
||||
|
||||
if ((procedureNameToSelect == proc.Name) && !procedureSet)
|
||||
{
|
||||
procedureComboBox.Text = itemText;
|
||||
SelectedProcedure = new ProcedureInfo(procedureNameToSelect, (dBase[i] == TBF.DB.SharedDBSessionFactory));
|
||||
BenchControlPanel.ReloadTests(session);
|
||||
procedureSet = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -718,7 +792,7 @@ namespace TBF.UI
|
||||
BenchControlPanel.ReloadTests();
|
||||
if (CurrentProcedure != null && CurrentProcedure.Description != null)
|
||||
{
|
||||
descriptionLabel.Text = CurrentProcedure.Description;
|
||||
//descriptionLabel.Text = CurrentProcedure.Description;
|
||||
}
|
||||
if (CurrentProcedure != null && testProgressControls != null)
|
||||
{
|
||||
@ -1047,5 +1121,53 @@ namespace TBF.UI
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void profileComboBox_SelectedIndexChanged(object sender, EventArgs e) { UpdateSelectedProfile(); }
|
||||
private void profileComboBox_TextChanged(object sender, EventArgs e) { UpdateSelectedProfile(); }
|
||||
///
|
||||
void UpdateSelectedProfile()
|
||||
{
|
||||
//selectedProfile = ... TODO
|
||||
selectedProfile = (profileComboBox.Text != Strings.any) ? profileComboBox.Text : null;
|
||||
ReloadProcedureComboBoxItems();
|
||||
}
|
||||
|
||||
private void dnComboBox_SelectedIndexChanged(object sender, EventArgs e) { UpdateSelectedDN(); }
|
||||
private void dnComboBox_TextChanged(object sender, EventArgs e) { UpdateSelectedDN(); }
|
||||
///
|
||||
void UpdateSelectedDN()
|
||||
{
|
||||
uint ival;
|
||||
selectedDN = uint.TryParse(dnComboBox.Text, out ival) ? ival : 0;
|
||||
ReloadProcedureComboBoxItems();
|
||||
}
|
||||
|
||||
private void q3ComboBox_SelectedIndexChanged(object sender, EventArgs e) { UpdateSelectedQn(); }
|
||||
private void q3ComboBox_TextChanged(object sender, EventArgs e) { UpdateSelectedQn(); }
|
||||
///
|
||||
void UpdateSelectedQn()
|
||||
{
|
||||
double fval;
|
||||
selectedQ3 = Utils.TryParseUDouble(q3ComboBox.Text, out fval) ? fval : 0;
|
||||
ReloadProcedureComboBoxItems();
|
||||
}
|
||||
|
||||
private void mclassComboBox_SelectedIndexChanged(object sender, EventArgs e) { UpdateSelectedMClass(); }
|
||||
private void mclassComboBox_TextChanged(object sender, EventArgs e) { UpdateSelectedMClass(); }
|
||||
///
|
||||
void UpdateSelectedMClass()
|
||||
{
|
||||
selectedMClass = (mclassComboBox.Text != Strings.any) ? mclassComboBox.Text : null;
|
||||
ReloadProcedureComboBoxItems();
|
||||
}
|
||||
|
||||
private void producerComboBox_SelectedIndexChanged(object sender, EventArgs e) { UpdateSelectedProducer(); }
|
||||
private void producerComboBox_TextChanged(object sender, EventArgs e) { UpdateSelectedProducer(); }
|
||||
///
|
||||
void UpdateSelectedProducer()
|
||||
{
|
||||
selectedProducer = (producerComboBox.Text != Strings.any) ? producerComboBox.Text : null;
|
||||
ReloadProcedureComboBoxItems();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -429,6 +429,246 @@
|
||||
<data name=">>topHorizontalSplitContainer.Panel1.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<data name="profileLabel.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="profileLabel.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>4, 19</value>
|
||||
</data>
|
||||
<data name="profileLabel.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>36, 13</value>
|
||||
</data>
|
||||
<data name="profileLabel.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>19</value>
|
||||
</data>
|
||||
<data name="profileLabel.Text" xml:space="preserve">
|
||||
<value>Profile</value>
|
||||
</data>
|
||||
<data name=">>profileLabel.Name" xml:space="preserve">
|
||||
<value>profileLabel</value>
|
||||
</data>
|
||||
<data name=">>profileLabel.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>profileLabel.Parent" xml:space="preserve">
|
||||
<value>descriptionGroupBox</value>
|
||||
</data>
|
||||
<data name=">>profileLabel.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<data name="profileComboBox.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>60, 16</value>
|
||||
</data>
|
||||
<data name="profileComboBox.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>133, 21</value>
|
||||
</data>
|
||||
<data name="profileComboBox.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>18</value>
|
||||
</data>
|
||||
<data name=">>profileComboBox.Name" xml:space="preserve">
|
||||
<value>profileComboBox</value>
|
||||
</data>
|
||||
<data name=">>profileComboBox.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>profileComboBox.Parent" xml:space="preserve">
|
||||
<value>descriptionGroupBox</value>
|
||||
</data>
|
||||
<data name=">>profileComboBox.ZOrder" xml:space="preserve">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="producerLabel.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="producerLabel.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>573, 19</value>
|
||||
</data>
|
||||
<data name="producerLabel.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>50, 13</value>
|
||||
</data>
|
||||
<data name="producerLabel.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>17</value>
|
||||
</data>
|
||||
<data name="producerLabel.Text" xml:space="preserve">
|
||||
<value>Producer</value>
|
||||
</data>
|
||||
<data name=">>producerLabel.Name" xml:space="preserve">
|
||||
<value>producerLabel</value>
|
||||
</data>
|
||||
<data name=">>producerLabel.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>producerLabel.Parent" xml:space="preserve">
|
||||
<value>descriptionGroupBox</value>
|
||||
</data>
|
||||
<data name=">>producerLabel.ZOrder" xml:space="preserve">
|
||||
<value>2</value>
|
||||
</data>
|
||||
<data name="mclassLabel.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="mclassLabel.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>449, 19</value>
|
||||
</data>
|
||||
<data name="mclassLabel.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>32, 13</value>
|
||||
</data>
|
||||
<data name="mclassLabel.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>16</value>
|
||||
</data>
|
||||
<data name="mclassLabel.Text" xml:space="preserve">
|
||||
<value>Class</value>
|
||||
</data>
|
||||
<data name=">>mclassLabel.Name" xml:space="preserve">
|
||||
<value>mclassLabel</value>
|
||||
</data>
|
||||
<data name=">>mclassLabel.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>mclassLabel.Parent" xml:space="preserve">
|
||||
<value>descriptionGroupBox</value>
|
||||
</data>
|
||||
<data name=">>mclassLabel.ZOrder" xml:space="preserve">
|
||||
<value>3</value>
|
||||
</data>
|
||||
<data name="q3Label.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="q3Label.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>317, 19</value>
|
||||
</data>
|
||||
<data name="q3Label.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>40, 13</value>
|
||||
</data>
|
||||
<data name="q3Label.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>15</value>
|
||||
</data>
|
||||
<data name="q3Label.Text" xml:space="preserve">
|
||||
<value>Q3/Qn</value>
|
||||
</data>
|
||||
<data name=">>q3Label.Name" xml:space="preserve">
|
||||
<value>q3Label</value>
|
||||
</data>
|
||||
<data name=">>q3Label.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>q3Label.Parent" xml:space="preserve">
|
||||
<value>descriptionGroupBox</value>
|
||||
</data>
|
||||
<data name=">>q3Label.ZOrder" xml:space="preserve">
|
||||
<value>4</value>
|
||||
</data>
|
||||
<data name="dnLabel.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="dnLabel.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>204, 19</value>
|
||||
</data>
|
||||
<data name="dnLabel.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>23, 13</value>
|
||||
</data>
|
||||
<data name="dnLabel.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>14</value>
|
||||
</data>
|
||||
<data name="dnLabel.Text" xml:space="preserve">
|
||||
<value>DN</value>
|
||||
</data>
|
||||
<data name=">>dnLabel.Name" xml:space="preserve">
|
||||
<value>dnLabel</value>
|
||||
</data>
|
||||
<data name=">>dnLabel.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>dnLabel.Parent" xml:space="preserve">
|
||||
<value>descriptionGroupBox</value>
|
||||
</data>
|
||||
<data name=">>dnLabel.ZOrder" xml:space="preserve">
|
||||
<value>5</value>
|
||||
</data>
|
||||
<data name="producerComboBox.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>629, 16</value>
|
||||
</data>
|
||||
<data name="producerComboBox.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>133, 21</value>
|
||||
</data>
|
||||
<data name="producerComboBox.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>13</value>
|
||||
</data>
|
||||
<data name=">>producerComboBox.Name" xml:space="preserve">
|
||||
<value>producerComboBox</value>
|
||||
</data>
|
||||
<data name=">>producerComboBox.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>producerComboBox.Parent" xml:space="preserve">
|
||||
<value>descriptionGroupBox</value>
|
||||
</data>
|
||||
<data name=">>producerComboBox.ZOrder" xml:space="preserve">
|
||||
<value>6</value>
|
||||
</data>
|
||||
<data name="mclassComboBox.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>487, 16</value>
|
||||
</data>
|
||||
<data name="mclassComboBox.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>72, 21</value>
|
||||
</data>
|
||||
<data name="mclassComboBox.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>12</value>
|
||||
</data>
|
||||
<data name=">>mclassComboBox.Name" xml:space="preserve">
|
||||
<value>mclassComboBox</value>
|
||||
</data>
|
||||
<data name=">>mclassComboBox.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>mclassComboBox.Parent" xml:space="preserve">
|
||||
<value>descriptionGroupBox</value>
|
||||
</data>
|
||||
<data name=">>mclassComboBox.ZOrder" xml:space="preserve">
|
||||
<value>7</value>
|
||||
</data>
|
||||
<data name="q3ComboBox.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>363, 16</value>
|
||||
</data>
|
||||
<data name="q3ComboBox.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>72, 21</value>
|
||||
</data>
|
||||
<data name="q3ComboBox.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>11</value>
|
||||
</data>
|
||||
<data name=">>q3ComboBox.Name" xml:space="preserve">
|
||||
<value>q3ComboBox</value>
|
||||
</data>
|
||||
<data name=">>q3ComboBox.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>q3ComboBox.Parent" xml:space="preserve">
|
||||
<value>descriptionGroupBox</value>
|
||||
</data>
|
||||
<data name=">>q3ComboBox.ZOrder" xml:space="preserve">
|
||||
<value>8</value>
|
||||
</data>
|
||||
<data name="dnComboBox.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>233, 16</value>
|
||||
</data>
|
||||
<data name="dnComboBox.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>72, 21</value>
|
||||
</data>
|
||||
<data name="dnComboBox.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>10</value>
|
||||
</data>
|
||||
<data name=">>dnComboBox.Name" xml:space="preserve">
|
||||
<value>dnComboBox</value>
|
||||
</data>
|
||||
<data name=">>dnComboBox.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>dnComboBox.Parent" xml:space="preserve">
|
||||
<value>descriptionGroupBox</value>
|
||||
</data>
|
||||
<data name=">>dnComboBox.ZOrder" xml:space="preserve">
|
||||
<value>9</value>
|
||||
</data>
|
||||
<data name="descriptionLabel.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
@ -454,7 +694,7 @@
|
||||
<value>descriptionGroupBox</value>
|
||||
</data>
|
||||
<data name=">>descriptionLabel.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
<value>10</value>
|
||||
</data>
|
||||
<data name="descriptionGroupBox.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
||||
<value>Fill</value>
|
||||
@ -598,7 +838,7 @@
|
||||
<value>ctrlBrdComponent</value>
|
||||
</data>
|
||||
<data name=">>ctrlBrdComponent.Type" xml:space="preserve">
|
||||
<value>ControlComponent3Munich.UserControl1, ControlComponent3Munich, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>ControlComponent_Torino2015.UserControl1, ControlComponent3U, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>ctrlBrdComponent.Parent" xml:space="preserve">
|
||||
<value>homeTabPage</value>
|
||||
@ -652,7 +892,7 @@
|
||||
<value>processTabPageCtrl</value>
|
||||
</data>
|
||||
<data name=">>processTabPageCtrl.Type" xml:space="preserve">
|
||||
<value>TBF.UI.Process.ProcessTabPageCtrl6, TBF, Version=2.25.1440.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>TBF.UI.Process.ProcessTabPageCtrl24, TBF, Version=2.33.2064.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>processTabPageCtrl.Parent" xml:space="preserve">
|
||||
<value>processTabPage</value>
|
||||
@ -730,7 +970,7 @@
|
||||
<value>resultsTabPageCtrl</value>
|
||||
</data>
|
||||
<data name=">>resultsTabPageCtrl.Type" xml:space="preserve">
|
||||
<value>TBF.UI.ResultsMI.ResultsTabPageCtrl, TBF, Version=2.25.1440.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>TBF.UI.ResultsMI.ResultsTabPageCtrl, TBF, Version=2.33.2064.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>resultsTabPageCtrl.Parent" xml:space="preserve">
|
||||
<value>resultsTabPage</value>
|
||||
@ -781,7 +1021,7 @@
|
||||
<value>graphsTabPageCtrl</value>
|
||||
</data>
|
||||
<data name=">>graphsTabPageCtrl.Type" xml:space="preserve">
|
||||
<value>TBF.UI.Graphs.GraphsTabPageCtrl, TBF, Version=2.25.1440.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>TBF.UI.Graphs.GraphsTabPageCtrl, TBF, Version=2.33.2064.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>graphsTabPageCtrl.Parent" xml:space="preserve">
|
||||
<value>graphsTabPage</value>
|
||||
@ -835,7 +1075,7 @@
|
||||
<value>eventLogsTabPageCtrl</value>
|
||||
</data>
|
||||
<data name=">>eventLogsTabPageCtrl.Type" xml:space="preserve">
|
||||
<value>TBF.UI.EventLogs.EventLogsTabPageCtrl, TBF, Version=2.25.1440.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>TBF.UI.EventLogs.EventLogsTabPageCtrl, TBF, Version=2.33.2064.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>eventLogsTabPageCtrl.Parent" xml:space="preserve">
|
||||
<value>eventLogsTabPage</value>
|
||||
@ -886,7 +1126,7 @@
|
||||
<value>calendarTabPageCtrl</value>
|
||||
</data>
|
||||
<data name=">>calendarTabPageCtrl.Type" xml:space="preserve">
|
||||
<value>TBF.UI.Calendar.CalendarTabPageCtrl, TBF, Version=2.25.1440.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>TBF.UI.Calendar.CalendarTabPageCtrl, TBF, Version=2.33.2064.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>calendarTabPageCtrl.Parent" xml:space="preserve">
|
||||
<value>calendarTabPage</value>
|
||||
@ -937,7 +1177,7 @@
|
||||
<value>picturesTabPageCtrl</value>
|
||||
</data>
|
||||
<data name=">>picturesTabPageCtrl.Type" xml:space="preserve">
|
||||
<value>TBF.UI.Camera.PicturesTabPageCtrl, TBF, Version=2.25.1440.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>TBF.UI.Camera.PicturesTabPageCtrl, TBF, Version=2.33.2064.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>picturesTabPageCtrl.Parent" xml:space="preserve">
|
||||
<value>picturesTabPage</value>
|
||||
@ -1332,10 +1572,10 @@
|
||||
<data name="upgradeTSMenuItem.Text" xml:space="preserve">
|
||||
<value>Upgrade</value>
|
||||
</data>
|
||||
<data name="iPerlHeadsToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<data name="optoHeadsToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>152, 22</value>
|
||||
</data>
|
||||
<data name="iPerlHeadsToolStripMenuItem.Text" xml:space="preserve">
|
||||
<data name="optoHeadsToolStripMenuItem.Text" xml:space="preserve">
|
||||
<value>iPerl Heads</value>
|
||||
</data>
|
||||
<data name="clearCountersToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
|
||||
@ -1584,10 +1824,10 @@
|
||||
<data name=">>upgradeTSMenuItem.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>iPerlHeadsToolStripMenuItem.Name" xml:space="preserve">
|
||||
<value>iPerlHeadsToolStripMenuItem</value>
|
||||
<data name=">>optoHeadsToolStripMenuItem.Name" xml:space="preserve">
|
||||
<value>optoHeadsToolStripMenuItem</value>
|
||||
</data>
|
||||
<data name=">>iPerlHeadsToolStripMenuItem.Type" xml:space="preserve">
|
||||
<data name=">>optoHeadsToolStripMenuItem.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>clearCountersToolStripMenuItem.Name" xml:space="preserve">
|
||||
@ -1644,13 +1884,4 @@
|
||||
<data name=">>$this.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="logsTabPage.Text" xml:space="preserve">
|
||||
<value>Logs</value>
|
||||
</data>
|
||||
<data name="logsTSMenuItem.Text" xml:space="preserve">
|
||||
<value>Logs</value>
|
||||
</data>
|
||||
<data name="editTSMenuItem.Text" xml:space="preserve">
|
||||
<value>Settings</value>
|
||||
</data>
|
||||
</root>
|
||||
@ -268,28 +268,31 @@ namespace TBF.UI.Procedures
|
||||
/// </summary>
|
||||
public void OkBtnClicked()
|
||||
{
|
||||
using (ITransaction transaction = Session.BeginTransaction())
|
||||
if (Session != null && Session.IsOpen)
|
||||
{
|
||||
try
|
||||
using (ITransaction transaction = Session.BeginTransaction())
|
||||
{
|
||||
foreach (var entity in ToBeRemovedProcedures) Session.Delete(entity);
|
||||
ToBeRemovedProcedures.Clear();
|
||||
|
||||
int itemNr = 0;
|
||||
foreach (var proc in AllProcedures)
|
||||
try
|
||||
{
|
||||
(proc as Procedure).ItemNr = itemNr++;
|
||||
Session.SaveOrUpdate(proc);
|
||||
}
|
||||
foreach (var entity in ToBeRemovedProcedures) Session.Delete(entity);
|
||||
ToBeRemovedProcedures.Clear();
|
||||
|
||||
transaction.Commit();
|
||||
Session.Flush();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
transaction.Rollback();
|
||||
log.ErrorFormat("Cannot save changes to DB: {0}", exc.Message);
|
||||
MessageBox.Show(Strings.Cannot_save_changes, Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
int itemNr = 0;
|
||||
foreach (var proc in AllProcedures)
|
||||
{
|
||||
(proc as Procedure).ItemNr = itemNr++;
|
||||
Session.SaveOrUpdate(proc);
|
||||
}
|
||||
|
||||
transaction.Commit();
|
||||
Session.Flush();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
transaction.Rollback();
|
||||
log.ErrorFormat("Cannot save changes to DB: {0}", exc.Message);
|
||||
MessageBox.Show(Strings.Cannot_save_changes, Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
Loading…
Reference in New Issue
Block a user