diff --git a/Results/Forms/ManualEntryConfigCtrl.Designer.cs b/Results/Forms/ManualEntryConfigCtrl.Designer.cs
new file mode 100644
index 000000000..c13797079
--- /dev/null
+++ b/Results/Forms/ManualEntryConfigCtrl.Designer.cs
@@ -0,0 +1,258 @@
+namespace Results.Forms
+{
+ partial class ManualEntryConfigCtrl
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Component Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.availableTabControl = new System.Windows.Forms.TabControl();
+ this.tabPage1 = new System.Windows.Forms.TabPage();
+ this.availableByQuantityTreeView = new System.Windows.Forms.TreeView();
+ this.tabPage2 = new System.Windows.Forms.TabPage();
+ this.availableByCategoryTreeView = new System.Windows.Forms.TreeView();
+ this.tabPage3 = new System.Windows.Forms.TabPage();
+ this.availableAlphabeticTreeView = new System.Windows.Forms.TreeView();
+ this.downButton = new System.Windows.Forms.Button();
+ this.upButton = new System.Windows.Forms.Button();
+ this.selectedResultsListViewEx = new Results.Forms.ListViewEx();
+ this.removeAllButton = new System.Windows.Forms.Button();
+ this.removeButton = new System.Windows.Forms.Button();
+ this.addButton = new System.Windows.Forms.Button();
+ this.selectedItemsLabel = new System.Windows.Forms.Label();
+ this.availableItemsLabel = new System.Windows.Forms.Label();
+ this.availableTabControl.SuspendLayout();
+ this.tabPage1.SuspendLayout();
+ this.tabPage2.SuspendLayout();
+ this.tabPage3.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // availableTabControl
+ //
+ this.availableTabControl.Controls.Add(this.tabPage1);
+ this.availableTabControl.Controls.Add(this.tabPage2);
+ this.availableTabControl.Controls.Add(this.tabPage3);
+ this.availableTabControl.Enabled = false;
+ this.availableTabControl.Location = new System.Drawing.Point(9, 33);
+ this.availableTabControl.Name = "availableTabControl";
+ this.availableTabControl.SelectedIndex = 0;
+ this.availableTabControl.Size = new System.Drawing.Size(206, 453);
+ this.availableTabControl.TabIndex = 59;
+ //
+ // tabPage1
+ //
+ this.tabPage1.Controls.Add(this.availableByQuantityTreeView);
+ this.tabPage1.Location = new System.Drawing.Point(4, 22);
+ this.tabPage1.Name = "tabPage1";
+ this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
+ this.tabPage1.Size = new System.Drawing.Size(198, 427);
+ this.tabPage1.TabIndex = 0;
+ this.tabPage1.Text = "A...Z";
+ this.tabPage1.UseVisualStyleBackColor = true;
+ //
+ // availableByQuantityTreeView
+ //
+ this.availableByQuantityTreeView.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.availableByQuantityTreeView.Location = new System.Drawing.Point(3, 3);
+ this.availableByQuantityTreeView.Name = "availableByQuantityTreeView";
+ this.availableByQuantityTreeView.Size = new System.Drawing.Size(192, 421);
+ this.availableByQuantityTreeView.TabIndex = 0;
+ this.availableByQuantityTreeView.DoubleClick += new System.EventHandler(this.availableByQuantityTreeView_DoubleClick);
+ //
+ // tabPage2
+ //
+ this.tabPage2.Controls.Add(this.availableByCategoryTreeView);
+ this.tabPage2.Location = new System.Drawing.Point(4, 22);
+ this.tabPage2.Name = "tabPage2";
+ this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
+ this.tabPage2.Size = new System.Drawing.Size(198, 427);
+ this.tabPage2.TabIndex = 1;
+ this.tabPage2.Text = "by quantity";
+ this.tabPage2.UseVisualStyleBackColor = true;
+ //
+ // availableByCategoryTreeView
+ //
+ this.availableByCategoryTreeView.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.availableByCategoryTreeView.Location = new System.Drawing.Point(3, 3);
+ this.availableByCategoryTreeView.Name = "availableByCategoryTreeView";
+ this.availableByCategoryTreeView.Size = new System.Drawing.Size(192, 421);
+ this.availableByCategoryTreeView.TabIndex = 0;
+ this.availableByCategoryTreeView.DoubleClick += new System.EventHandler(this.availableByCategoryTreeView_DoubleClick);
+ //
+ // tabPage3
+ //
+ this.tabPage3.Controls.Add(this.availableAlphabeticTreeView);
+ this.tabPage3.Location = new System.Drawing.Point(4, 22);
+ this.tabPage3.Name = "tabPage3";
+ this.tabPage3.Size = new System.Drawing.Size(198, 427);
+ this.tabPage3.TabIndex = 2;
+ this.tabPage3.Text = "by category";
+ this.tabPage3.UseVisualStyleBackColor = true;
+ //
+ // availableAlphabeticTreeView
+ //
+ this.availableAlphabeticTreeView.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.availableAlphabeticTreeView.Location = new System.Drawing.Point(0, 0);
+ this.availableAlphabeticTreeView.Name = "availableAlphabeticTreeView";
+ this.availableAlphabeticTreeView.Size = new System.Drawing.Size(198, 427);
+ this.availableAlphabeticTreeView.TabIndex = 0;
+ this.availableAlphabeticTreeView.DoubleClick += new System.EventHandler(this.availableAlphabeticTreeView_DoubleClick);
+ //
+ // downButton
+ //
+ this.downButton.Enabled = false;
+ this.downButton.Location = new System.Drawing.Point(221, 351);
+ this.downButton.Name = "downButton";
+ this.downButton.Size = new System.Drawing.Size(93, 30);
+ this.downButton.TabIndex = 58;
+ this.downButton.Text = "Down";
+ this.downButton.UseVisualStyleBackColor = true;
+ this.downButton.Click += new System.EventHandler(this.downButton_Click);
+ //
+ // upButton
+ //
+ this.upButton.Enabled = false;
+ this.upButton.Location = new System.Drawing.Point(221, 315);
+ this.upButton.Name = "upButton";
+ this.upButton.Size = new System.Drawing.Size(93, 30);
+ this.upButton.TabIndex = 57;
+ this.upButton.Text = "Up";
+ this.upButton.UseVisualStyleBackColor = true;
+ this.upButton.Click += new System.EventHandler(this.upButton_Click);
+ //
+ // selectedResultsListViewEx
+ //
+ this.selectedResultsListViewEx.AllowColumnReorder = true;
+ this.selectedResultsListViewEx.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+ this.selectedResultsListViewEx.DoubleClickActivation = false;
+ this.selectedResultsListViewEx.Enabled = false;
+ this.selectedResultsListViewEx.FullRowSelect = true;
+ this.selectedResultsListViewEx.GridLines = true;
+ this.selectedResultsListViewEx.Location = new System.Drawing.Point(322, 33);
+ this.selectedResultsListViewEx.Name = "selectedResultsListViewEx";
+ this.selectedResultsListViewEx.Size = new System.Drawing.Size(594, 453);
+ this.selectedResultsListViewEx.TabIndex = 56;
+ this.selectedResultsListViewEx.UseCompatibleStateImageBehavior = false;
+ this.selectedResultsListViewEx.View = System.Windows.Forms.View.Details;
+ this.selectedResultsListViewEx.DoubleClick += new System.EventHandler(this.selectedResultsListViewEx_DoubleClick);
+ //
+ // removeAllButton
+ //
+ this.removeAllButton.Enabled = false;
+ this.removeAllButton.Location = new System.Drawing.Point(221, 223);
+ this.removeAllButton.Name = "removeAllButton";
+ this.removeAllButton.Size = new System.Drawing.Size(94, 30);
+ this.removeAllButton.TabIndex = 55;
+ this.removeAllButton.Text = "<< R&emove all";
+ this.removeAllButton.UseVisualStyleBackColor = true;
+ this.removeAllButton.Visible = false;
+ this.removeAllButton.Click += new System.EventHandler(this.removeAllButton_Click);
+ //
+ // removeButton
+ //
+ this.removeButton.Enabled = false;
+ this.removeButton.Location = new System.Drawing.Point(221, 188);
+ this.removeButton.Name = "removeButton";
+ this.removeButton.Size = new System.Drawing.Size(93, 30);
+ this.removeButton.TabIndex = 54;
+ this.removeButton.Text = "< &Remove";
+ this.removeButton.UseVisualStyleBackColor = true;
+ this.removeButton.Click += new System.EventHandler(this.removeButton_Click);
+ //
+ // addButton
+ //
+ this.addButton.Enabled = false;
+ this.addButton.Location = new System.Drawing.Point(221, 153);
+ this.addButton.Name = "addButton";
+ this.addButton.Size = new System.Drawing.Size(93, 30);
+ this.addButton.TabIndex = 53;
+ this.addButton.Text = "&Add >";
+ this.addButton.UseVisualStyleBackColor = true;
+ this.addButton.Click += new System.EventHandler(this.addButton_Click);
+ //
+ // selectedItemsLabel
+ //
+ this.selectedItemsLabel.AutoSize = true;
+ this.selectedItemsLabel.Location = new System.Drawing.Point(321, 11);
+ this.selectedItemsLabel.Name = "selectedItemsLabel";
+ this.selectedItemsLabel.Size = new System.Drawing.Size(79, 13);
+ this.selectedItemsLabel.TabIndex = 52;
+ this.selectedItemsLabel.Text = "Selected items:";
+ //
+ // availableItemsLabel
+ //
+ this.availableItemsLabel.AutoSize = true;
+ this.availableItemsLabel.Location = new System.Drawing.Point(11, 11);
+ this.availableItemsLabel.Name = "availableItemsLabel";
+ this.availableItemsLabel.Size = new System.Drawing.Size(80, 13);
+ this.availableItemsLabel.TabIndex = 51;
+ this.availableItemsLabel.Text = "Available items:";
+ //
+ // ManualEntryConfigCtrl
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.availableTabControl);
+ this.Controls.Add(this.downButton);
+ this.Controls.Add(this.upButton);
+ this.Controls.Add(this.selectedResultsListViewEx);
+ this.Controls.Add(this.removeAllButton);
+ this.Controls.Add(this.removeButton);
+ this.Controls.Add(this.addButton);
+ this.Controls.Add(this.selectedItemsLabel);
+ this.Controls.Add(this.availableItemsLabel);
+ this.Name = "ManualEntryConfigCtrl";
+ this.Size = new System.Drawing.Size(925, 496);
+ this.Load += new System.EventHandler(this.ManualEntryConfigCtrl_Load);
+ this.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.ManualEntryConfigCtrl_KeyPress);
+ this.availableTabControl.ResumeLayout(false);
+ this.tabPage1.ResumeLayout(false);
+ this.tabPage2.ResumeLayout(false);
+ this.tabPage3.ResumeLayout(false);
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.TabControl availableTabControl;
+ private System.Windows.Forms.TabPage tabPage1;
+ private System.Windows.Forms.TreeView availableByQuantityTreeView;
+ private System.Windows.Forms.TabPage tabPage2;
+ private System.Windows.Forms.TreeView availableByCategoryTreeView;
+ private System.Windows.Forms.TabPage tabPage3;
+ private System.Windows.Forms.TreeView availableAlphabeticTreeView;
+ private System.Windows.Forms.Button downButton;
+ private System.Windows.Forms.Button upButton;
+ private ListViewEx selectedResultsListViewEx;
+ private System.Windows.Forms.Button removeAllButton;
+ private System.Windows.Forms.Button removeButton;
+ private System.Windows.Forms.Button addButton;
+ private System.Windows.Forms.Label selectedItemsLabel;
+ private System.Windows.Forms.Label availableItemsLabel;
+
+ }
+}
diff --git a/Results/Forms/ManualEntryConfigCtrl.cs b/Results/Forms/ManualEntryConfigCtrl.cs
new file mode 100644
index 000000000..487b9a71d
--- /dev/null
+++ b/Results/Forms/ManualEntryConfigCtrl.cs
@@ -0,0 +1,450 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Windows.Forms;
+using Config.Entities;
+using Results.Resources;
+
+namespace Results.Forms
+{
+ public partial class ManualEntryConfigCtrl : UserControl
+ {
+ ///
+ /// ListViewEx columns
+ ///
+ enum Column
+ {
+ Item,
+ Caption,
+ Units,
+ Count,
+ }
+
+ Control[] editors; /// all editors except of units
+ ComboBox unitsCB; /// units combo box
+
+ public IList SelectedItems;
+ public bool Unlocked
+ {
+ set
+ {
+ availableTabControl.Enabled = value;
+ selectedResultsListViewEx.Enabled = value;
+ addButton.Enabled = value;
+ removeButton.Enabled = value;
+ removeAllButton.Enabled = value;
+ upButton.Enabled = value;
+ downButton.Enabled = value;
+ unlocked = value;
+ }
+ get { return unlocked; }
+ }
+ bool unlocked;
+
+
+ public ManualEntryConfigCtrl()
+ {
+ InitializeComponent();
+ }
+
+
+ void Localize()
+ {
+ Text = Strings.Configuration;
+ availableItemsLabel.Text = Strings.Available_items;
+ availableTabControl.TabPages[0].Text = Strings.Quantity;
+ availableTabControl.TabPages[1].Text = Strings.Category;
+ availableTabControl.TabPages[2].Text = "A...Z";
+
+ selectedItemsLabel.Text = Strings.Selected_items;
+
+ addButton.Text = Strings.Add;
+ removeButton.Text = Strings.Remove;
+ removeAllButton.Text = Strings.Remove_all;
+ upButton.Text = Strings.UpBtnText;
+ downButton.Text = Strings.DownBtnText;
+ }
+
+ private void ManualEntryConfigCtrl_Load(object sender, EventArgs e)
+ {
+ Localize();
+
+ /// Add columns to ListViewEx
+ selectedResultsListViewEx.Columns.Add(new ColumnHeader { Text = Strings.Item, Width = 120 });
+ selectedResultsListViewEx.Columns.Add(new ColumnHeader { Text = Strings.Caption });
+ selectedResultsListViewEx.Columns.Add(new ColumnHeader { Text = Strings.Units });
+
+ /// Create controls used by ListViewEx to edit items
+ unitsCB = new ComboBox();
+
+ ComboBox alignmentCB = new ComboBox();
+ for (Config.Entities.Alignment a = 0; a < Config.Entities.Alignment.Count; a++)
+ {
+ alignmentCB.Items.Add(a.ToDescription());
+ }
+
+ editors = new Control[]
+ {
+ null,
+ new TextBox(), /// caption
+ unitsCB,
+ };
+ foreach (var edi in editors)
+ {
+ if (edi != null)
+ {
+ edi.Visible = false;
+ Controls.Add(edi);
+ }
+ }
+
+ selectedResultsListViewEx.SubItemClicked += new SubItemEventHandler(selectedResultsListViewEx_SubItemClicked);
+ selectedResultsListViewEx.SubItemEndEditing += new SubItemEndEditingEventHandler(selectedResultsListViewEx_SubItemEndEditing);
+
+ availableByQuantityTreeView.ShowNodeToolTips = true;
+ availableByCategoryTreeView.ShowNodeToolTips = true;
+ availableAlphabeticTreeView.ShowNodeToolTips = true;
+
+ RedrawAvailable();
+ RedrawSelected();
+ }
+
+ void selectedResultsListViewEx_SubItemClicked(object sender, SubItemEventArgs e)
+ {
+ if (e.SubItem == (int)Column.Units)
+ {
+ Config.Quantity quantity = (e.Item.Tag as ManualEntryItemSpec).Quantity;
+ unitsCB.Items.Clear();
+ unitsCB.Items.Add(Config.Unit.None.ToDescription()); /// "---"
+ for (Config.Unit u = (Config.Unit)1; u < Config.Unit.Count; u++)
+ {
+ if (Config.Units.IsQuantity(u, quantity)) unitsCB.Items.Add(u.ToDescription());
+ }
+ selectedResultsListViewEx.StartEditing(unitsCB, e.Item, e.SubItem);
+ }
+ else if ((e.SubItem > 0) && (e.SubItem < (int)Column.Count))
+ {
+ selectedResultsListViewEx.StartEditing(editors[e.SubItem], e.Item, e.SubItem);
+ }
+ }
+
+ void selectedResultsListViewEx_SubItemEndEditing(object sender, SubItemEndEditingEventArgs e)
+ {
+ ListViewItem lvi = e.Item;
+ ManualEntryItemSpec item = lvi.Tag as ManualEntryItemSpec;
+
+ switch ((Column)e.SubItem)
+ {
+ case Column.Caption: item.Caption = e.DisplayText; return;
+ case Column.Units:
+ for (Config.Unit u = 0; u < Config.Unit.Count; u++)
+ {
+ if (u.ToDescription().Equals(unitsCB.Text))
+ {
+ item.Units = u;
+ return; /// OK
+ }
+ }
+ break; /// Error
+
+ default:
+ return; /// OK
+ }
+
+ e.DisplayText = e.Item.SubItems[e.SubItem].Text;
+ e.Cancel = true;
+ return;
+ }
+
+
+ ///
+ /// Redraw available items (right hand side)
+ ///
+ void RedrawAvailable()
+ {
+ RedrawByQuantity(availableByQuantityTreeView);
+ RedrawByCategory(availableByCategoryTreeView);
+ RedrawInAlphabeticOrder(availableAlphabeticTreeView);
+ }
+
+
+ void RedrawInAlphabeticOrder(TreeView treeView)
+ {
+ treeView.Nodes.Clear();
+
+ IList alphabeticlList = ManualEntryItemSpec.AllItems.OrderBy(x => x.Name).ToList();
+ ///
+ foreach (var item in alphabeticlList)
+ {
+ TreeNode node = new TreeNode(item.Name);
+ node.Tag = item;
+ node.ToolTipText = item.ToolTipText;
+ treeView.Nodes.Add(node);
+ }
+ }
+
+
+ void RedrawByQuantity(TreeView treeView)
+ {
+ treeView.Nodes.Clear();
+
+ IList quantities = new List();
+ for (Config.Quantity q = 0; q < Config.Quantity.Count; q++) quantities.Add(q);
+
+ IList sortedQuantities = quantities.OrderBy(x => x.ToDescription()).ToList();
+
+ foreach (var q in sortedQuantities)
+ {
+ int n = 0;
+ foreach (var ri in ManualEntryItemSpec.AllItems)
+ {
+ if (ri.Quantity == q) n++;
+ }
+
+ if (n > 0)
+ {
+ TreeNode[] array = new TreeNode[n];
+ int i = 0;
+ foreach (var ri in ManualEntryItemSpec.AllItems)
+ {
+ if (ri.Quantity == q)
+ {
+ TreeNode node = new TreeNode(ri.Name);
+ node.Tag = ri;
+ node.ToolTipText = ri.ToolTipText;
+ array[i++] = node;
+ }
+ }
+
+ treeView.Nodes.Add(new TreeNode(q.ToDescription(), array));
+ }
+ }
+ }
+
+
+ void RedrawByCategory(TreeView treeView)
+ {
+ treeView.Nodes.Clear();
+
+ IList categories = new List();
+ for (ItemCategory c = 0; c < ItemCategory.Count; c++) categories.Add(c);
+
+ IList sortedCategories = categories.OrderBy(x => x.ToDescription()).ToList();
+
+ foreach (var c in sortedCategories)
+ {
+ int n = 0;
+ foreach (var ri in ManualEntryItemSpec.AllItems)
+ {
+ if (ri.Category == c) n++;
+ }
+
+ if (n > 0)
+ {
+ TreeNode[] array = new TreeNode[n];
+ int i = 0;
+ foreach (var ri in ManualEntryItemSpec.AllItems)
+ {
+ if (ri.Category == c)
+ {
+ TreeNode node = new TreeNode(ri.Name);
+ node.Tag = ri;
+ node.ToolTipText = ri.ToolTipText;
+ array[i++] = node;
+ }
+ }
+
+ treeView.Nodes.Add(new TreeNode(c.ToDescription(), array));
+ }
+ }
+ }
+
+
+ ///
+ /// Redraw selected items (right hand side)
+ ///
+ void RedrawSelected()
+ {
+ selectedResultsListViewEx.Items.Clear();
+
+ if (SelectedItems == null) return;
+
+ foreach (var item in SelectedItems)
+ {
+ ListViewItem lvi = new ListViewItem(item.Name); /// Item
+ lvi.Tag = item;
+ lvi.SubItems.Add(item.Caption); /// Header
+ lvi.SubItems.Add(item.Units.ToDescription()); /// Units
+ selectedResultsListViewEx.Items.Add(lvi);
+ }
+ }
+
+ void UpdateSelectedFromView()
+ {
+ }
+
+
+ void addButton_Click(object sender, EventArgs e)
+ {
+ switch (availableTabControl.SelectedIndex)
+ {
+ case 0:
+ availableByQuantityTreeView_DoubleClick(this, null);
+ break;
+ case 1:
+ availableByCategoryTreeView_DoubleClick(this, null);
+ break;
+ case 2:
+ availableAlphabeticTreeView_DoubleClick(this, null);
+ break;
+ default:
+ break;
+ }
+ }
+
+ private void availableByQuantityTreeView_DoubleClick(object sender, EventArgs e)
+ {
+ if (availableByQuantityTreeView.SelectedNode != null &&
+ availableByQuantityTreeView.SelectedNode.Tag is ManualEntryItemSpec)
+ {
+ AddItem(availableByQuantityTreeView.SelectedNode.Tag as ManualEntryItemSpec);
+ }
+ }
+
+ private void availableByCategoryTreeView_DoubleClick(object sender, EventArgs e)
+ {
+ if (availableByCategoryTreeView.SelectedNode != null &&
+ availableByCategoryTreeView.SelectedNode.Tag is ManualEntryItemSpec)
+ {
+ AddItem(availableByCategoryTreeView.SelectedNode.Tag as ManualEntryItemSpec);
+ }
+ }
+
+ private void availableAlphabeticTreeView_DoubleClick(object sender, EventArgs e)
+ {
+ if (availableAlphabeticTreeView.SelectedNode != null &&
+ availableAlphabeticTreeView.SelectedNode.Tag is ManualEntryItemSpec)
+ {
+ AddItem(availableAlphabeticTreeView.SelectedNode.Tag as ManualEntryItemSpec);
+ }
+ }
+
+ void AddItem(ManualEntryItemSpec item)
+ {
+ ManualEntryItemSpec newItem = item.Clone();
+ newItem.Caption = newItem.Name;
+ SelectedItems.Add(newItem);
+ RedrawSelected();
+
+ /// Select the last item
+ selectedResultsListViewEx.Focus();
+ selectedResultsListViewEx.Items[SelectedItems.Count - 1].Selected = true;
+ selectedResultsListViewEx.Items[SelectedItems.Count - 1].EnsureVisible();
+ }
+
+
+ private void selectedResultsListViewEx_DoubleClick(object sender, EventArgs e)
+ {
+ /// Double click works when just one item is selected
+
+ if (selectedResultsListViewEx.SelectedIndices.Count == 1)
+ {
+ SelectedItems.RemoveAt(selectedResultsListViewEx.SelectedIndices[0]);
+ RedrawAvailable();
+ RedrawSelected();
+ }
+ }
+
+ void removeButton_Click(object sender, EventArgs e)
+ {
+ /// Remove from the list (the last selected item first so that the indexes are not affected)
+
+ for (int i = selectedResultsListViewEx.SelectedIndices.Count - 1; i >= 0; i--)
+ {
+ SelectedItems.RemoveAt(selectedResultsListViewEx.SelectedIndices[i]);
+ }
+ RedrawAvailable();
+ RedrawSelected();
+ }
+
+ void removeAllButton_Click(object sender, EventArgs e)
+ {
+ /// Remove all items from 'Selected' list
+
+ SelectedItems.Clear();
+ RedrawAvailable();
+ RedrawSelected();
+ }
+
+ //void okButton_Click(object sender, EventArgs e)
+ //{
+ // DialogResult = DialogResult.OK;
+ // Close();
+ //}
+
+ private void ManualEntryConfigCtrl_KeyPress(object sender, KeyPressEventArgs e)
+ {
+ e.Handled = true;
+ }
+
+ private void upButton_Click(object sender, EventArgs e)
+ {
+ if (selectedResultsListViewEx.SelectedIndices.Count != 1) return;
+
+ int selIdx = selectedResultsListViewEx.SelectedIndices[0];
+ if (selIdx == 0)
+ {
+ /// Cannot move up
+ selectedResultsListViewEx.Focus();
+ selectedResultsListViewEx.Items[0].Selected = true;
+ return;
+ }
+
+ ManualEntryItemSpec tmp = SelectedItems[selIdx - 1];
+ SelectedItems[selIdx - 1] = SelectedItems[selIdx];
+ SelectedItems[selIdx] = tmp;
+
+ RedrawSelected();
+
+ selectedResultsListViewEx.Focus();
+ selectedResultsListViewEx.Items[selIdx - 1].Selected = true;
+ selectedResultsListViewEx.Items[selIdx - 1].EnsureVisible();
+ }
+
+ private void downButton_Click(object sender, EventArgs e)
+ {
+ if (selectedResultsListViewEx.SelectedIndices.Count != 1) return;
+
+ int selIdx = selectedResultsListViewEx.SelectedIndices[0];
+ if (selIdx == SelectedItems.Count - 1)
+ {
+ /// Cannot move down
+ selectedResultsListViewEx.Focus();
+ selectedResultsListViewEx.Items[SelectedItems.Count - 1].Selected = true;
+ return;
+ }
+
+ ManualEntryItemSpec tmp = SelectedItems[selIdx + 1];
+ SelectedItems[selIdx + 1] = SelectedItems[selIdx];
+ SelectedItems[selIdx] = tmp;
+
+ RedrawSelected();
+
+ selectedResultsListViewEx.Focus();
+ selectedResultsListViewEx.Items[selIdx + 1].Selected = true;
+ selectedResultsListViewEx.Items[selIdx + 1].EnsureVisible();
+ }
+
+ //private void cancelButton_Click(object sender, EventArgs e)
+ //{
+ // DialogResult = DialogResult.Cancel;
+ // Close();
+ //}
+
+ private void availableByCategoryTreeView_NodeMouseHover2(object sender, TreeNodeMouseHoverEventArgs e)
+ {
+ ToolTip toolTip = new ToolTip();
+ toolTip.SetToolTip(this, e.Node.ToolTipText);
+ }
+ }
+}
diff --git a/Results/Forms/ManualEntryConfigCtrl.resx b/Results/Forms/ManualEntryConfigCtrl.resx
new file mode 100644
index 000000000..1af7de150
--- /dev/null
+++ b/Results/Forms/ManualEntryConfigCtrl.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/Results/Forms/ManualEntryConfigDlg.cs b/Results/Forms/ManualEntryConfigDlg.cs
new file mode 100644
index 000000000..98b3192f6
--- /dev/null
+++ b/Results/Forms/ManualEntryConfigDlg.cs
@@ -0,0 +1,60 @@
+///
+/// Copyright (c) 2019 Sensus Slovensko a.s.
+///
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Windows.Forms;
+using log4net;
+using Config.Entities;
+using Results;
+using Results.Resources;
+
+namespace Results.Forms
+{
+ public partial class ManualEntryConfigDlg : Form
+ {
+ public IList SelectedItems
+ {
+ set { manualEntryConfigCtrl.SelectedItems = value; }
+ get { return manualEntryConfigCtrl.SelectedItems; }
+ }
+
+
+ public ManualEntryConfigDlg()
+ {
+ InitializeComponent();
+ manualEntryConfigCtrl.Unlocked = true;
+ }
+
+
+ void Localize()
+ {
+ Text = Strings.Configuration;
+ okButton.Text = Strings.OkBtnText;
+ cancelButton.Text = Strings.CancelBtnText;
+ }
+
+ void ManualEntryConfig_Load(object sender, EventArgs e)
+ {
+ Localize();
+ }
+
+ void okButton_Click(object sender, EventArgs e)
+ {
+ DialogResult = DialogResult.OK;
+ Close();
+ }
+
+ private void cancelButton_Click(object sender, EventArgs e)
+ {
+ DialogResult = DialogResult.Cancel;
+ Close();
+ }
+
+ private void ManualEntryConfigDlg_KeyPress(object sender, KeyPressEventArgs e)
+ {
+ e.Handled = true;
+ }
+ }
+}
diff --git a/Results/Forms/ManualEntryConfigDlg.designer.cs b/Results/Forms/ManualEntryConfigDlg.designer.cs
new file mode 100644
index 000000000..fc3d6b514
--- /dev/null
+++ b/Results/Forms/ManualEntryConfigDlg.designer.cs
@@ -0,0 +1,95 @@
+///
+/// Copyright (c) 2016 Sensus Metering Systems
+///
+namespace Results.Forms
+{
+ partial class ManualEntryConfigDlg
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.okButton = new System.Windows.Forms.Button();
+ this.cancelButton = new System.Windows.Forms.Button();
+ this.manualEntryConfigCtrl = new Results.Forms.ManualEntryConfigCtrl();
+ this.SuspendLayout();
+ //
+ // okButton
+ //
+ this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+ this.okButton.Location = new System.Drawing.Point(939, 29);
+ this.okButton.Name = "okButton";
+ this.okButton.Size = new System.Drawing.Size(105, 42);
+ this.okButton.TabIndex = 4;
+ this.okButton.Text = "OK";
+ this.okButton.UseVisualStyleBackColor = true;
+ this.okButton.Click += new System.EventHandler(this.okButton_Click);
+ //
+ // cancelButton
+ //
+ this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+ this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
+ this.cancelButton.Location = new System.Drawing.Point(939, 82);
+ this.cancelButton.Name = "cancelButton";
+ this.cancelButton.Size = new System.Drawing.Size(105, 42);
+ this.cancelButton.TabIndex = 5;
+ this.cancelButton.Text = "Cancel";
+ this.cancelButton.UseVisualStyleBackColor = true;
+ this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
+ //
+ // manualEntryConfigCtrl
+ //
+ this.manualEntryConfigCtrl.Location = new System.Drawing.Point(-1, 1);
+ this.manualEntryConfigCtrl.Name = "manualEntryConfigCtrl";
+ this.manualEntryConfigCtrl.Size = new System.Drawing.Size(925, 496);
+ this.manualEntryConfigCtrl.TabIndex = 6;
+ this.manualEntryConfigCtrl.Unlocked = false;
+ //
+ // ManualEntryConfigDlg
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(1066, 498);
+ this.Controls.Add(this.manualEntryConfigCtrl);
+ this.Controls.Add(this.cancelButton);
+ this.Controls.Add(this.okButton);
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
+ this.Name = "ManualEntryConfigDlg";
+ this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
+ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
+ this.Text = "ManualEntryConfig";
+ this.Load += new System.EventHandler(this.ManualEntryConfig_Load);
+ this.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.ManualEntryConfigDlg_KeyPress);
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Button okButton;
+ private System.Windows.Forms.Button cancelButton;
+ private ManualEntryConfigCtrl manualEntryConfigCtrl;
+ }
+}
\ No newline at end of file
diff --git a/Results/Forms/ManualEntryConfigDlg.resx b/Results/Forms/ManualEntryConfigDlg.resx
new file mode 100644
index 000000000..1af7de150
--- /dev/null
+++ b/Results/Forms/ManualEntryConfigDlg.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/Results/ManualEntryItemSpec.cs b/Results/ManualEntryItemSpec.cs
new file mode 100644
index 000000000..ef57cf98f
--- /dev/null
+++ b/Results/ManualEntryItemSpec.cs
@@ -0,0 +1,244 @@
+///
+/// Copyright (c) 2019 Sensus Slovensko a.s.
+///
+using System;
+using System.Collections.Generic;
+using Config;
+using Config.Entities;
+using Results.Entities;
+using Results.Resources;
+using System.Globalization;
+
+namespace Results
+{
+ public class ManualEntryItemSpec
+ {
+ ///
+ /// Public fields
+ ///
+ public readonly int Uid;
+ public readonly string Name; /// Name-s of all items must be unique
+ public readonly string ToolTipText; /// Tool-Tip Text
+ public readonly Quantity Quantity; /// Quantity
+ public readonly ItemCategory Category; ///
+ public string Caption; /// Specifies item description to be printed as a caption (in the header, etc.)
+ public Config.Unit Units; /// Specifies units for the output
+
+
+ public ManualEntryItemSpec Clone()
+ {
+ ManualEntryItemSpec item = new ManualEntryItemSpec((ItemID)Uid, Name, ToolTipText, Quantity, Category, updateDlgt);
+ item.Caption = Caption;
+ item.Units = Units;
+ return item;
+ }
+
+
+ ///
+ /// Function to pick a MeterTestResult field and convert it into a string
+ ///
+ public delegate bool UpdateDlgt(string str, MeterTestRslt meterTestRslt);
+
+ private readonly UpdateDlgt updateDlgt;
+
+ public bool Update(string str, MeterTestRslt meterTestRslt)
+ {
+ return (updateDlgt != null) ? updateDlgt(str, meterTestRslt) : true;
+ }
+
+ public static bool ParseBool(string str, out bool success)
+ {
+ bool b;
+ success = bool.TryParse(str, out b);
+ return b;
+ }
+
+ public static int ParseInt(string str, out bool success)
+ {
+ int i;
+ success = int.TryParse(str, out i);
+ return i;
+ }
+
+ public static float ParseFloat(string str, out bool success)
+ {
+ float f;
+ success = float.TryParse(str, NumberStyles.AllowDecimalPoint, CultureInfo.CurrentCulture, out f) ||
+ float.TryParse(str, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out f);
+ return f;
+ }
+
+ public static double ParseDouble(string str, out bool success)
+ {
+ double d;
+ success = double.TryParse(str, NumberStyles.AllowDecimalPoint, CultureInfo.CurrentCulture, out d) ||
+ double.TryParse(str, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out d);
+ return d;
+ }
+
+
+ ///
+ /// Public constructor
+ ///
+ public ManualEntryItemSpec(ItemID itemId, string name, string toolTipText, Quantity quantity, ItemCategory category, UpdateDlgt updateDlgt)
+ {
+ Uid = (int)itemId;
+ Name = name;
+ ToolTipText = toolTipText;
+ Quantity = quantity;
+ Category = category;
+ this.updateDlgt = updateDlgt;
+ }
+
+
+ /// Static list of all available items
+ public static readonly IList AllItems;
+
+
+ ///
+ /// Initializes the class.
+ ///
+ /// Static constructor that initializes the list of all items
+ static ManualEntryItemSpec()
+ {
+ AllItems = new List();
+
+ AllItems.Add(new ManualEntryItemSpec(ItemID.P_PMax_test_mean,
+ string.Format("{0} PMax mean", Strings.VName_Press),
+ "PMax test pressure",
+ Quantity.Pressure,
+ ItemCategory.TestResult,
+ (str, mtr) => { bool r;
+ mtr.TestRslt.PressUpMean = mtr.TestRslt.PressDownMean = ParseFloat(str, out r);
+ return r; }));
+ AllItems.Add(new ManualEntryItemSpec(ItemID.T_line_mean,
+ string.Format("{0} LN ME", Strings.VName_Temp),
+ Strings.Tooltip_T_ln_me,
+ Quantity.Temperature,
+ ItemCategory.TestResult,
+ (str, mtr) => { bool r;
+ mtr.TestRslt.TempUpMean = mtr.TestRslt.TempDownMean = ParseFloat(str, out r);
+ return r; }));
+ AllItems.Add(new ManualEntryItemSpec(ItemID.Test_time,
+ Strings.T_s,
+ "Test time",
+ Quantity.Time,
+ ItemCategory.TestResult,
+ (str, mtr) => { bool r;
+ mtr.TestRslt.TestTime = ParseDouble(str, out r);
+ return r; }));
+ AllItems.Add(new ManualEntryItemSpec(ItemID.TestPassed,
+ Strings.Test_passed,
+ "Passed",
+ Quantity.Boolean,
+ ItemCategory.MeterResult,
+ (str, mtr) => { bool r;
+ mtr.Passed = ParseBool(str, out r);
+ return r; }));
+ }
+
+
+ ///
+ /// Converts a list of 'Output item specifications' to a string array
+ ///
+ ///
+ ///
+ public static string[] ToStrArray(IList items)
+ {
+ int count = (items != null) ? items.Count : 0;
+ string[] result = new string[count];
+ for (int i = 0; i < count; i++)
+ {
+ if (items[i].Caption == null) items[i].Caption = string.Empty;
+
+ result[i] = string.Format("{0}~{1}~{2}",
+ items[i].Uid,
+ items[i].Caption.Replace("~", "\n"),
+ items[i].Units);
+ }
+ return result;
+ }
+
+ ///
+ /// Converts a string array to a list of 'Output item specifications'
+ ///
+ ///
+ ///
+ public static IList FromStrArray(string[] strArray)
+ {
+ IList result = new List();
+
+ if (strArray != null)
+ {
+ for (int i = 0; i < strArray.Length; i++)
+ {
+ try
+ {
+ ManualEntryItemSpec item;
+ string[] field = strArray[i].Split(new char[] { '~' });
+
+ if (!strArray[i].Contains("~"))
+ {
+ item = GetItem(0);
+ item.Caption = "Prs.Err.";
+ result.Add(item);
+ }
+ else if ((item = GetItem(int.Parse(field[0]))) != null)
+ {
+ ///
+ /// Load the new style results item specification
+ ///
+ item.Caption = field[1].Replace("\n", "~");
+ item.Units = 0;
+ for (Config.Unit u = 0; u < Config.Unit.Count; u++)
+ {
+ if (u.ToString().Equals(field[2])) { item.Units = u; break; }
+ }
+ result.Add(item);
+ }
+ else
+ {
+ ///
+ /// Create an item with parse error information
+ ///
+ ManualEntryItemSpec item2 = GetItem(0);
+ item2.Caption = "Prs.Err.";
+ result.Add(item2);
+ }
+ }
+ catch
+ {
+ ManualEntryItemSpec item = GetItem(0);
+ item.Caption = "Prs.Err.";
+ result.Add(item);
+ }
+ }
+ }
+ return result;
+ }
+
+
+ public static ManualEntryItemSpec GetItem(int uid)
+ {
+ foreach (var item in AllItems)
+ {
+ if (item.Uid == uid) return item.Clone();
+ }
+ return null;
+ }
+
+
+ public static ManualEntryItemSpec GetItem(ItemID itemId)
+ {
+ return GetItem((int)itemId);
+ }
+
+ public override string ToString()
+ {
+ if (!string.IsNullOrEmpty(Caption))
+ return Caption;
+ else
+ return ((ItemID)Uid).ToString();
+ }
+ }
+}
diff --git a/Results/Properties/AssemblyInfo.cs b/Results/Properties/AssemblyInfo.cs
index 045fabcb2..15b1e5b92 100644
--- a/Results/Properties/AssemblyInfo.cs
+++ b/Results/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("2.24.1369.0")]
-[assembly: AssemblyFileVersion("2.24.1369.0")]
+[assembly: AssemblyVersion("2.24.1389.0")]
+[assembly: AssemblyFileVersion("2.24.1389.0")]
diff --git a/Results/Resources/Strings.Designer.cs b/Results/Resources/Strings.Designer.cs
index e8ce3a18a..f104a2ab4 100644
--- a/Results/Resources/Strings.Designer.cs
+++ b/Results/Resources/Strings.Designer.cs
@@ -114,6 +114,15 @@ namespace Results.Resources {
}
}
+ ///
+ /// Looks up a localized string similar to Available items.
+ ///
+ internal static string Available_items {
+ get {
+ return ResourceManager.GetString("Available_items", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Available results.
///
@@ -978,6 +987,15 @@ namespace Results.Resources {
}
}
+ ///
+ /// Looks up a localized string similar to Selected item.
+ ///
+ internal static string Selected_items {
+ get {
+ return ResourceManager.GetString("Selected_items", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Selected results.
///
diff --git a/Results/Resources/Strings.resx b/Results/Resources/Strings.resx
index 570edb2bf..a9f27e04d 100644
--- a/Results/Resources/Strings.resx
+++ b/Results/Resources/Strings.resx
@@ -819,4 +819,10 @@
This position is disabled
+
+ Available items
+
+
+ Selected item
+
\ No newline at end of file
diff --git a/Results/Results.csproj b/Results/Results.csproj
index eb2a74bee..e7c79b558 100644
--- a/Results/Results.csproj
+++ b/Results/Results.csproj
@@ -82,6 +82,18 @@
+
+ UserControl
+
+
+ ManualEntryConfigCtrl.cs
+
+
+ Form
+
+
+ ManualEntryConfigDlg.cs
+
Form
@@ -120,6 +132,7 @@
+
@@ -191,6 +204,12 @@
ListViewEx.cs
+
+ ManualEntryConfigCtrl.cs
+
+
+ ManualEntryConfigDlg.cs
+
MoreWMResultsDlg.cs
diff --git a/TBF/BenchControl/TbfComponents.cs b/TBF/BenchControl/TbfComponents.cs
index 514940a1c..9e0948804 100644
--- a/TBF/BenchControl/TbfComponents.cs
+++ b/TBF/BenchControl/TbfComponents.cs
@@ -93,7 +93,8 @@ namespace TBF.BenchControl
Factories.Add(new TestMethods.GrabImage.Factory());
Factories.Add(new TestMethods.LeakTest.TestMethodFactory());
Factories.Add(new TestMethods.LiveStream.Factory());
- Factories.Add(new TestMethods.OuterLoop.Start.Factory());
+ Factories.Add(new TestMethods.ManualEntry.Factory());
+ Factories.Add(new TestMethods.OuterLoop.Start.Factory());
Factories.Add(new TestMethods.OuterLoop.End.Factory());
Factories.Add(new TestMethods.PMaxTest.TestMethodFactory());
Factories.Add(new TestMethods.PulsesTest.Factory());
diff --git a/TBF/BenchControl/TestMethods/ManualEntry/Component.cs b/TBF/BenchControl/TestMethods/ManualEntry/Component.cs
new file mode 100644
index 000000000..7e35b02cd
--- /dev/null
+++ b/TBF/BenchControl/TestMethods/ManualEntry/Component.cs
@@ -0,0 +1,69 @@
+///
+/// Copyright (c) 2019 Sensus Slovensko a.s.
+///
+using System;
+using System.Collections.Generic;
+using log4net;
+using Config.Entities;
+using TBF.BenchControl;
+
+namespace TBF.BenchControl.TestMethods.ManualEntry
+{
+ public class Component : ComponentBase, GenericDevices.ITestMethod
+ {
+ private static readonly ILog log = LogManager.GetLogger(typeof(Component));
+ public override string ToString() { return string.Format("ManualEntry({0})", Cfg.ToString(1)); }
+
+ readonly ManualEntryCfg myCfg;
+
+ public bool CanTest(MetersKind meters) { return true; }
+ public bool DoTransitions() { return false; }
+
+
+ public Component() { }
+
+ public Component(Generic.IComponentCfg cfg)
+ : base(cfg)
+ {
+ myCfg = cfg as ManualEntryCfg;
+ StartChangeHandler();
+ log.Debug(this.ToString());
+ }
+
+ public IList Execute(Test test, int repetNr, bool isLastRepetition)
+ {
+ return (new ManualEntrySeq()).Execute(test, repetNr, isLastRepetition, myCfg, DebugLevel);
+ }
+
+
+ #region Configuration Change Handling
+
+ public static void OnCfgChange(object sender, CfgChangeArgs args)
+ {
+ if (CfgChangeHandler == null) return;
+ try { CfgChangeHandler(sender, args); }
+ catch (Exception e) { log.Error("CfgChangeHandler(...) failed", e); }
+ }
+
+ public static event EventHandler CfgChangeHandler;
+
+ public override void StartChangeHandler()
+ {
+ CfgChangeHandler += delegate(object sender, CfgChangeArgs args)
+ {
+ ManualEntryCfg newCfg = args.Cfg as ManualEntryCfg;
+ if ((newCfg != null) && newCfg.Name.Equals(Name))
+ {
+ if (args.Command == CfgChangeCmd.CfgChange)
+ {
+ myCfg.Culture = newCfg.Culture;
+ myCfg.Prompt = newCfg.Prompt;
+ myCfg.Items = newCfg.Items;
+ }
+ }
+ };
+ }
+
+ #endregion Configuration Change Handling
+ }
+}
diff --git a/TBF/BenchControl/TestMethods/ManualEntry/Factory.cs b/TBF/BenchControl/TestMethods/ManualEntry/Factory.cs
new file mode 100644
index 000000000..c93e54396
--- /dev/null
+++ b/TBF/BenchControl/TestMethods/ManualEntry/Factory.cs
@@ -0,0 +1,29 @@
+///
+/// Copyright (c) 2019 Sensus Slovensko a.s.
+///
+using System.Collections.Generic;
+using TBF.BenchControl.Generic;
+
+namespace TBF.BenchControl.TestMethods.ManualEntry
+{
+ public class Factory : IComponentFactory
+ {
+ public string ClassName { get { return this.GetType().Namespace.Substring(17); } }
+
+ public void ResetStaticProperties() { Component.ResetStaticProperties(); }
+
+ public IComponent DummyComponent() { return new Component(); }
+
+ public IComponent GetComponent(IComponentCfg cfg, IList components) { return new Component(cfg); }
+
+ public IComponentCfg DefaultConfig()
+ {
+ return new ManualEntryCfg(this.GetType().Namespace.Substring(29), this);
+ }
+
+ public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
+ {
+ return ComponentCfgBase.CreateFromDbEntity(ManualEntryCfg.Serializer, component, this);
+ }
+ }
+}
diff --git a/TBF/BenchControl/TestMethods/ManualEntry/ManualEntryCfg.cs b/TBF/BenchControl/TestMethods/ManualEntry/ManualEntryCfg.cs
new file mode 100644
index 000000000..34ede1b41
--- /dev/null
+++ b/TBF/BenchControl/TestMethods/ManualEntry/ManualEntryCfg.cs
@@ -0,0 +1,43 @@
+///
+/// Copyright (c) 2019 Sensus Slovensko a.s.
+///
+using System;
+using System.Xml.Serialization;
+using TBF.BenchControl.Generic;
+using TBF.BenchControl.Output;
+
+namespace TBF.BenchControl.TestMethods.ManualEntry
+{
+
+ public class ManualEntryCfg : ComponentCfgBase, Generic.IComponentCfg
+ {
+ public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(ManualEntryCfg) })[0];
+ public override XmlSerializer GetSerializer() { return Serializer; }
+
+ public IComponentCfgCtrl GetControl() { return new ManualEntryCfgCtrl(); }
+
+ public Culture Culture;
+ public string Prompt;
+ public string[] Items;
+
+ /// Private parameterless constructor invoked by all other (public) constructors
+ ManualEntryCfg()
+ {
+ }
+
+ public ManualEntryCfg(string name, IComponentFactory factory)
+ : this()
+ {
+ Name = name;
+ Factory = factory;
+ ParentName = string.Empty;
+ Culture = Culture.EN;
+ Prompt = "Prompt";
+ }
+
+ public string ToString(int i)
+ {
+ return string.Format("Name={0}, Culture={1}, Prompt={2}", Name, Culture, Prompt);
+ }
+ }
+}
diff --git a/TBF/BenchControl/TestMethods/ManualEntry/ManualEntryCfgCtrl.cs b/TBF/BenchControl/TestMethods/ManualEntry/ManualEntryCfgCtrl.cs
new file mode 100644
index 000000000..597b0160a
--- /dev/null
+++ b/TBF/BenchControl/TestMethods/ManualEntry/ManualEntryCfgCtrl.cs
@@ -0,0 +1,172 @@
+///
+/// Copyright (c) 2019 Sensus Slovensko a.s.
+///
+using System;
+using System.Windows.Forms;
+using log4net;
+using Config.Entities;
+using TBF.BenchControl.Generic;
+using TBF.Resources;
+
+namespace TBF.BenchControl.TestMethods.ManualEntry
+{
+ public partial class ManualEntryCfgCtrl : UserControl, IComponentCfgCtrl
+ {
+ static readonly ILog log = LogManager.GetLogger(typeof(ManualEntryCfgCtrl));
+
+ public bool ShowMore { get { return false; } }
+
+ public bool Compound;
+
+ ManualEntryCfg config;
+ public IComponentCfg Config
+ {
+ get { return config as IComponentCfg; }
+ set
+ {
+ config = value as ManualEntryCfg;
+ Redraw();
+ }
+ }
+
+ string header;
+ string[] commonItems;
+ string[] testItems;
+
+ public ManualEntryCfgCtrl()
+ {
+ InitializeComponent();
+ Localize();
+ }
+
+ private void ManualEntryCfgCtrl_Load(object sender, EventArgs e)
+ {
+ for (TBF.BenchControl.Output.Culture s = 0; s < TBF.BenchControl.Output.Culture.Count; s++)
+ {
+ cultureComboBox.Items.Add(s.ToString());
+ }
+ testItems = config.Items;
+ Redraw();
+ }
+
+ void Localize()
+ {
+ nameLabel.Text = Strings.Name;
+ cultureLabel.Text = "Culture";
+ promptLabel.Text = "Prompt";
+ itemsButton.Text = "Items";
+ }
+
+ public void Closing()
+ {
+ }
+
+ void Redraw()
+ {
+ if (config == null) return; /// Control was not loaded, settings were not changed
+ classNameLabel.Text = config.Factory.ClassName;
+ nameTextBox.Text = config.Name;
+ cultureComboBox.Text = config.Culture.ToString();
+ promptTextBox.Text = config.Prompt;
+ }
+
+ public void Unlock()
+ {
+ nameTextBox.Enabled = true;
+ cultureComboBox.Enabled = true;
+ promptTextBox.Enabled = true;
+ itemsButton.Enabled = true;
+ }
+
+ public CfgUpdateFlags VerifyCfg(ref string message)
+ {
+ CfgUpdateFlags flags = CfgUpdateFlags.None;
+
+ if (!cultureComboBox.Items.Contains(cultureComboBox.Text))
+ {
+ flags |= CfgUpdateFlags.Error;
+ message += Environment.NewLine + "Invalid culture";
+ }
+
+ if (string.IsNullOrEmpty(promptTextBox.Text))
+ {
+ flags |= CfgUpdateFlags.Error;
+ message += Environment.NewLine + "Prompt field is empty";
+ }
+
+ return flags;
+ }
+
+ public CfgUpdateFlags UpdateCfg()
+ {
+ CfgUpdateFlags flags = CfgUpdateFlags.None;
+
+ if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
+
+ if (config.Name != nameTextBox.Text)
+ {
+ config.Name = nameTextBox.Text;
+ flags |= (CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
+ }
+
+ for (TBF.BenchControl.Output.Culture i = 0; i < TBF.BenchControl.Output.Culture.Count; i++)
+ {
+ if (i.ToString().Equals(cultureComboBox.Text) && (config.Culture != i))
+ {
+ config.Culture = i;
+ flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
+ break;
+ }
+ }
+
+ if (config.Prompt != promptTextBox.Text)
+ {
+ config.Prompt = promptTextBox.Text;
+ flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
+ }
+
+ if (config.Items != testItems)
+ {
+ config.Items = testItems;
+ flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
+ }
+
+
+ if ((flags & CfgUpdateFlags.InvokeCfgChange) != 0)
+ {
+ Component.OnCfgChange(this, new CfgChangeArgs(CfgChangeCmd.CfgChange, config));
+ }
+
+ return flags;
+ }
+
+ private void itemsButton_Click(object sender, EventArgs e)
+ {
+ Results.Forms.ManualEntryConfigDlg dlg = new Results.Forms.ManualEntryConfigDlg()
+ {
+ SelectedItems = Results.ManualEntryItemSpec.FromStrArray(testItems),
+ };
+
+ if (dlg.ShowDialog() == DialogResult.OK)
+ {
+ testItems = Results.ManualEntryItemSpec.ToStrArray(dlg.SelectedItems);
+ }
+ }
+
+ #region Configuration Change Handling
+
+ public static void OnCmdResponse(object sender, CmdResponseArgs args)
+ {
+ if (CmdResponseHandler == null) return;
+ try { CmdResponseHandler(sender, args); }
+ catch (Exception e) { log.Error("CmdResponseHandler(...) failed", e); }
+ }
+
+ public static event EventHandler CmdResponseHandler;
+
+ public void StartResponseHandler() { }
+ public void StopResponseHandler() { }
+
+ #endregion Configuration Change Handling
+ }
+}
diff --git a/TBF/BenchControl/TestMethods/ManualEntry/ManualEntryCfgCtrl.designer.cs b/TBF/BenchControl/TestMethods/ManualEntry/ManualEntryCfgCtrl.designer.cs
new file mode 100644
index 000000000..c44d2be99
--- /dev/null
+++ b/TBF/BenchControl/TestMethods/ManualEntry/ManualEntryCfgCtrl.designer.cs
@@ -0,0 +1,147 @@
+///
+/// Copyright (c) 2019 Sensus Slovensko a.s.
+///
+namespace TBF.BenchControl.TestMethods.ManualEntry
+{
+ partial class ManualEntryCfgCtrl
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Component Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.nameTextBox = new System.Windows.Forms.TextBox();
+ this.nameLabel = new System.Windows.Forms.Label();
+ this.classNameLabel = new System.Windows.Forms.Label();
+ this.cultureLabel = new System.Windows.Forms.Label();
+ this.cultureComboBox = new System.Windows.Forms.ComboBox();
+ this.itemsButton = new System.Windows.Forms.Button();
+ this.promptLabel = new System.Windows.Forms.Label();
+ this.promptTextBox = new System.Windows.Forms.TextBox();
+ this.SuspendLayout();
+ //
+ // nameTextBox
+ //
+ this.nameTextBox.Enabled = false;
+ this.nameTextBox.Location = new System.Drawing.Point(116, 47);
+ this.nameTextBox.Name = "nameTextBox";
+ this.nameTextBox.Size = new System.Drawing.Size(146, 20);
+ this.nameTextBox.TabIndex = 2;
+ //
+ // nameLabel
+ //
+ this.nameLabel.AutoSize = true;
+ this.nameLabel.Location = new System.Drawing.Point(25, 50);
+ this.nameLabel.Name = "nameLabel";
+ this.nameLabel.Size = new System.Drawing.Size(35, 13);
+ this.nameLabel.TabIndex = 1;
+ this.nameLabel.Text = "Name";
+ //
+ // classNameLabel
+ //
+ this.classNameLabel.AutoSize = true;
+ this.classNameLabel.Location = new System.Drawing.Point(113, 25);
+ this.classNameLabel.Name = "classNameLabel";
+ this.classNameLabel.Size = new System.Drawing.Size(83, 13);
+ this.classNameLabel.TabIndex = 0;
+ this.classNameLabel.Text = "ComonentName";
+ //
+ // cultureLabel
+ //
+ this.cultureLabel.AutoSize = true;
+ this.cultureLabel.Location = new System.Drawing.Point(25, 74);
+ this.cultureLabel.Name = "cultureLabel";
+ this.cultureLabel.Size = new System.Drawing.Size(42, 13);
+ this.cultureLabel.TabIndex = 17;
+ this.cultureLabel.Text = "Cullture";
+ //
+ // cultureComboBox
+ //
+ this.cultureComboBox.Enabled = false;
+ this.cultureComboBox.FormattingEnabled = true;
+ this.cultureComboBox.Location = new System.Drawing.Point(116, 71);
+ this.cultureComboBox.Name = "cultureComboBox";
+ this.cultureComboBox.Size = new System.Drawing.Size(146, 21);
+ this.cultureComboBox.TabIndex = 18;
+ //
+ // itemsButton
+ //
+ this.itemsButton.Enabled = false;
+ this.itemsButton.Location = new System.Drawing.Point(116, 120);
+ this.itemsButton.Name = "itemsButton";
+ this.itemsButton.Size = new System.Drawing.Size(146, 23);
+ this.itemsButton.TabIndex = 25;
+ this.itemsButton.Text = "Items";
+ this.itemsButton.UseVisualStyleBackColor = true;
+ this.itemsButton.Click += new System.EventHandler(this.itemsButton_Click);
+ //
+ // promptLabel
+ //
+ this.promptLabel.AutoSize = true;
+ this.promptLabel.Location = new System.Drawing.Point(25, 99);
+ this.promptLabel.Name = "promptLabel";
+ this.promptLabel.Size = new System.Drawing.Size(40, 13);
+ this.promptLabel.TabIndex = 23;
+ this.promptLabel.Text = "Prompt";
+ //
+ // promptTextBox
+ //
+ this.promptTextBox.Enabled = false;
+ this.promptTextBox.Location = new System.Drawing.Point(116, 96);
+ this.promptTextBox.Name = "promptTextBox";
+ this.promptTextBox.Size = new System.Drawing.Size(146, 20);
+ this.promptTextBox.TabIndex = 24;
+ //
+ // ManualEntryCfgCtrl
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.promptLabel);
+ this.Controls.Add(this.promptTextBox);
+ this.Controls.Add(this.itemsButton);
+ this.Controls.Add(this.cultureComboBox);
+ this.Controls.Add(this.cultureLabel);
+ this.Controls.Add(this.nameTextBox);
+ this.Controls.Add(this.nameLabel);
+ this.Controls.Add(this.classNameLabel);
+ this.Name = "ManualEntryCfgCtrl";
+ this.Size = new System.Drawing.Size(400, 300);
+ this.Load += new System.EventHandler(this.ManualEntryCfgCtrl_Load);
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.TextBox nameTextBox;
+ private System.Windows.Forms.Label nameLabel;
+ private System.Windows.Forms.Label classNameLabel;
+ private System.Windows.Forms.Label cultureLabel;
+ private System.Windows.Forms.ComboBox cultureComboBox;
+ private System.Windows.Forms.Button itemsButton;
+ private System.Windows.Forms.Label promptLabel;
+ private System.Windows.Forms.TextBox promptTextBox;
+ }
+}
diff --git a/TBF/BenchControl/TestMethods/ManualEntry/ManualEntryCfgCtrl.resx b/TBF/BenchControl/TestMethods/ManualEntry/ManualEntryCfgCtrl.resx
new file mode 100644
index 000000000..1af7de150
--- /dev/null
+++ b/TBF/BenchControl/TestMethods/ManualEntry/ManualEntryCfgCtrl.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/TBF/BenchControl/TestMethods/ManualEntry/ManualEntryForm.cs b/TBF/BenchControl/TestMethods/ManualEntry/ManualEntryForm.cs
new file mode 100644
index 000000000..177cb15db
--- /dev/null
+++ b/TBF/BenchControl/TestMethods/ManualEntry/ManualEntryForm.cs
@@ -0,0 +1,117 @@
+///
+/// Copyright (c) 2019 Sensus Slovensko a.s.
+///
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Windows.Forms;
+using log4net;
+using Results.Entities;
+using TBF.Resources;
+
+namespace TBF.BenchControl.TestMethods.ManualEntry
+{
+ public partial class ManualEntryForm : Form, GenericDevices.IHasCompleted
+ {
+ private static readonly ILog log = LogManager.GetLogger(typeof(ManualEntryForm));
+
+ ///
+ /// Set to 'true' when the form closes
+ ///
+ public bool Completed { get { return completed; } }
+ bool completed;
+
+ MeterTestRslt meterTestRslt;
+ string prompt;
+ IList items;
+
+ GroupBox[] groupBoxes;
+ Label[] labels;
+ TextBox[] textBoxes;
+
+ ///
+ /// Default constructor
+ ///
+ public ManualEntryForm()
+ {
+ InitializeComponent();
+
+ groupBoxes = new GroupBox[] { groupBox1, groupBox2, groupBox3, groupBox4, groupBox5, groupBox6, groupBox7 };
+ labels = new Label[] { label1, label2, label3, label4, label5, label6, label7 };
+ textBoxes = new TextBox[] { textBox1, textBox2, textBox3, textBox4, textBox5, textBox6, textBox7 };
+
+ ControlBox = false;
+ completed = false;
+ StartForceCloseHandler();
+ }
+
+ ///
+ /// Constructor
+ ///
+ /// Number of text boxes for serial numbers
+ public ManualEntryForm(MeterTestRslt meterTestRslt, string prompt, IList items)
+ : this()
+ {
+ this.meterTestRslt = meterTestRslt;
+ this.prompt = prompt;
+ this.items = items;
+
+ Localize();
+ promptLabel.Text = prompt;
+
+ if (items != null)
+ {
+ for (int i = 0; i < Math.Min(items.Count, groupBoxes.Length); i++)
+ {
+ labels[i].Text = items[i].Caption;
+ groupBoxes[i].Visible = true;
+ }
+
+ Height = 100 + 90 * items.Count;
+ }
+ }
+
+ void Localize()
+ {
+ okButton.Text = Strings.OkBtnText;
+ }
+
+ private void okButton_Click(object sender, EventArgs e)
+ {
+ bool ok = true;
+
+ if (items != null)
+ {
+ for (int i = 0; i < Math.Min(items.Count, groupBoxes.Length); i++)
+ {
+ ok = ok &= items[i].Update(textBoxes[i].Text, meterTestRslt);
+ }
+ }
+
+ if (ok)
+ {
+ completed = true;
+ Close();
+ }
+ }
+
+ #region Forced close handling
+
+ public void StartForceCloseHandler()
+ {
+ UiBridge.Bridge.CloseModelessFormHandler += delegate(object sender, EventArgs args)
+ {
+ if (InvokeRequired) { Invoke(new EventHandler(OnForceClose), sender, args); }
+ else OnForceClose(sender, args);
+ };
+ }
+
+ void OnForceClose(object sender, EventArgs args)
+ {
+ DialogResult = DialogResult.Cancel;
+ Close();
+ }
+
+ #endregion
+ }
+}
diff --git a/TBF/BenchControl/TestMethods/ManualEntry/ManualEntryForm.designer.cs b/TBF/BenchControl/TestMethods/ManualEntry/ManualEntryForm.designer.cs
new file mode 100644
index 000000000..d73bd1037
--- /dev/null
+++ b/TBF/BenchControl/TestMethods/ManualEntry/ManualEntryForm.designer.cs
@@ -0,0 +1,362 @@
+///
+/// Copyright (c) 2019 Sensus Slovensko a.s.
+///
+namespace TBF.BenchControl.TestMethods.ManualEntry
+{
+ partial class ManualEntryForm
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.groupBox2 = new System.Windows.Forms.GroupBox();
+ this.textBox2 = new System.Windows.Forms.TextBox();
+ this.label2 = new System.Windows.Forms.Label();
+ this.groupBox1 = new System.Windows.Forms.GroupBox();
+ this.textBox1 = new System.Windows.Forms.TextBox();
+ this.label1 = new System.Windows.Forms.Label();
+ this.okButton = new System.Windows.Forms.Button();
+ this.groupBox3 = new System.Windows.Forms.GroupBox();
+ this.textBox3 = new System.Windows.Forms.TextBox();
+ this.label3 = new System.Windows.Forms.Label();
+ this.groupBox4 = new System.Windows.Forms.GroupBox();
+ this.textBox4 = new System.Windows.Forms.TextBox();
+ this.label4 = new System.Windows.Forms.Label();
+ this.groupBox5 = new System.Windows.Forms.GroupBox();
+ this.textBox5 = new System.Windows.Forms.TextBox();
+ this.label5 = new System.Windows.Forms.Label();
+ this.groupBox6 = new System.Windows.Forms.GroupBox();
+ this.textBox6 = new System.Windows.Forms.TextBox();
+ this.label6 = new System.Windows.Forms.Label();
+ this.groupBox7 = new System.Windows.Forms.GroupBox();
+ this.textBox7 = new System.Windows.Forms.TextBox();
+ this.label7 = new System.Windows.Forms.Label();
+ this.promptLabel = new System.Windows.Forms.Label();
+ this.groupBox2.SuspendLayout();
+ this.groupBox1.SuspendLayout();
+ this.groupBox3.SuspendLayout();
+ this.groupBox4.SuspendLayout();
+ this.groupBox5.SuspendLayout();
+ this.groupBox6.SuspendLayout();
+ this.groupBox7.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // groupBox2
+ //
+ this.groupBox2.Controls.Add(this.textBox2);
+ this.groupBox2.Controls.Add(this.label2);
+ this.groupBox2.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
+ this.groupBox2.ForeColor = System.Drawing.Color.Black;
+ this.groupBox2.Location = new System.Drawing.Point(25, 159);
+ this.groupBox2.Name = "groupBox2";
+ this.groupBox2.Size = new System.Drawing.Size(497, 81);
+ this.groupBox2.TabIndex = 2;
+ this.groupBox2.TabStop = false;
+ this.groupBox2.Visible = false;
+ //
+ // textBox2
+ //
+ this.textBox2.Font = new System.Drawing.Font("Verdana", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
+ this.textBox2.Location = new System.Drawing.Point(226, 21);
+ this.textBox2.Name = "textBox2";
+ this.textBox2.Size = new System.Drawing.Size(241, 52);
+ this.textBox2.TabIndex = 1;
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Location = new System.Drawing.Point(18, 34);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(68, 23);
+ this.label2.TabIndex = 0;
+ this.label2.Text = "label2";
+ //
+ // groupBox1
+ //
+ this.groupBox1.Controls.Add(this.textBox1);
+ this.groupBox1.Controls.Add(this.label1);
+ this.groupBox1.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
+ this.groupBox1.ForeColor = System.Drawing.Color.Black;
+ this.groupBox1.Location = new System.Drawing.Point(25, 69);
+ this.groupBox1.Name = "groupBox1";
+ this.groupBox1.Size = new System.Drawing.Size(497, 81);
+ this.groupBox1.TabIndex = 1;
+ this.groupBox1.TabStop = false;
+ //
+ // textBox1
+ //
+ this.textBox1.Font = new System.Drawing.Font("Verdana", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
+ this.textBox1.Location = new System.Drawing.Point(226, 21);
+ this.textBox1.Name = "textBox1";
+ this.textBox1.Size = new System.Drawing.Size(241, 52);
+ this.textBox1.TabIndex = 1;
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(18, 34);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(68, 23);
+ this.label1.TabIndex = 0;
+ this.label1.Text = "label1";
+ //
+ // okButton
+ //
+ this.okButton.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
+ this.okButton.ForeColor = System.Drawing.Color.Black;
+ this.okButton.Location = new System.Drawing.Point(583, 21);
+ this.okButton.Name = "okButton";
+ this.okButton.Size = new System.Drawing.Size(98, 63);
+ this.okButton.TabIndex = 7;
+ this.okButton.Text = "OK";
+ this.okButton.UseVisualStyleBackColor = true;
+ this.okButton.Click += new System.EventHandler(this.okButton_Click);
+ //
+ // groupBox3
+ //
+ this.groupBox3.Controls.Add(this.textBox3);
+ this.groupBox3.Controls.Add(this.label3);
+ this.groupBox3.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
+ this.groupBox3.ForeColor = System.Drawing.Color.Black;
+ this.groupBox3.Location = new System.Drawing.Point(25, 249);
+ this.groupBox3.Name = "groupBox3";
+ this.groupBox3.Size = new System.Drawing.Size(497, 81);
+ this.groupBox3.TabIndex = 3;
+ this.groupBox3.TabStop = false;
+ this.groupBox3.Visible = false;
+ //
+ // textBox3
+ //
+ this.textBox3.Font = new System.Drawing.Font("Verdana", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
+ this.textBox3.Location = new System.Drawing.Point(226, 21);
+ this.textBox3.Name = "textBox3";
+ this.textBox3.Size = new System.Drawing.Size(241, 52);
+ this.textBox3.TabIndex = 1;
+ //
+ // label3
+ //
+ this.label3.AutoSize = true;
+ this.label3.Location = new System.Drawing.Point(18, 34);
+ this.label3.Name = "label3";
+ this.label3.Size = new System.Drawing.Size(68, 23);
+ this.label3.TabIndex = 0;
+ this.label3.Text = "label3";
+ //
+ // groupBox4
+ //
+ this.groupBox4.Controls.Add(this.textBox4);
+ this.groupBox4.Controls.Add(this.label4);
+ this.groupBox4.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
+ this.groupBox4.ForeColor = System.Drawing.Color.Black;
+ this.groupBox4.Location = new System.Drawing.Point(25, 339);
+ this.groupBox4.Name = "groupBox4";
+ this.groupBox4.Size = new System.Drawing.Size(497, 81);
+ this.groupBox4.TabIndex = 4;
+ this.groupBox4.TabStop = false;
+ this.groupBox4.Visible = false;
+ //
+ // textBox4
+ //
+ this.textBox4.Font = new System.Drawing.Font("Verdana", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
+ this.textBox4.Location = new System.Drawing.Point(226, 21);
+ this.textBox4.Name = "textBox4";
+ this.textBox4.Size = new System.Drawing.Size(241, 52);
+ this.textBox4.TabIndex = 1;
+ //
+ // label4
+ //
+ this.label4.AutoSize = true;
+ this.label4.Location = new System.Drawing.Point(18, 34);
+ this.label4.Name = "label4";
+ this.label4.Size = new System.Drawing.Size(68, 23);
+ this.label4.TabIndex = 0;
+ this.label4.Text = "label4";
+ //
+ // groupBox5
+ //
+ this.groupBox5.Controls.Add(this.textBox5);
+ this.groupBox5.Controls.Add(this.label5);
+ this.groupBox5.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
+ this.groupBox5.ForeColor = System.Drawing.Color.Black;
+ this.groupBox5.Location = new System.Drawing.Point(25, 429);
+ this.groupBox5.Name = "groupBox5";
+ this.groupBox5.Size = new System.Drawing.Size(497, 81);
+ this.groupBox5.TabIndex = 8;
+ this.groupBox5.TabStop = false;
+ this.groupBox5.Visible = false;
+ //
+ // textBox5
+ //
+ this.textBox5.Font = new System.Drawing.Font("Verdana", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
+ this.textBox5.Location = new System.Drawing.Point(226, 21);
+ this.textBox5.Name = "textBox5";
+ this.textBox5.Size = new System.Drawing.Size(241, 52);
+ this.textBox5.TabIndex = 1;
+ //
+ // label5
+ //
+ this.label5.AutoSize = true;
+ this.label5.Location = new System.Drawing.Point(18, 34);
+ this.label5.Name = "label5";
+ this.label5.Size = new System.Drawing.Size(68, 23);
+ this.label5.TabIndex = 0;
+ this.label5.Text = "label5";
+ //
+ // groupBox6
+ //
+ this.groupBox6.Controls.Add(this.textBox6);
+ this.groupBox6.Controls.Add(this.label6);
+ this.groupBox6.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
+ this.groupBox6.ForeColor = System.Drawing.Color.Black;
+ this.groupBox6.Location = new System.Drawing.Point(25, 519);
+ this.groupBox6.Name = "groupBox6";
+ this.groupBox6.Size = new System.Drawing.Size(497, 81);
+ this.groupBox6.TabIndex = 9;
+ this.groupBox6.TabStop = false;
+ this.groupBox6.Visible = false;
+ //
+ // textBox6
+ //
+ this.textBox6.Font = new System.Drawing.Font("Verdana", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
+ this.textBox6.Location = new System.Drawing.Point(226, 21);
+ this.textBox6.Name = "textBox6";
+ this.textBox6.Size = new System.Drawing.Size(241, 52);
+ this.textBox6.TabIndex = 1;
+ //
+ // label6
+ //
+ this.label6.AutoSize = true;
+ this.label6.Location = new System.Drawing.Point(18, 34);
+ this.label6.Name = "label6";
+ this.label6.Size = new System.Drawing.Size(68, 23);
+ this.label6.TabIndex = 0;
+ this.label6.Text = "label6";
+ //
+ // groupBox7
+ //
+ this.groupBox7.Controls.Add(this.textBox7);
+ this.groupBox7.Controls.Add(this.label7);
+ this.groupBox7.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
+ this.groupBox7.ForeColor = System.Drawing.Color.Black;
+ this.groupBox7.Location = new System.Drawing.Point(25, 609);
+ this.groupBox7.Name = "groupBox7";
+ this.groupBox7.Size = new System.Drawing.Size(497, 81);
+ this.groupBox7.TabIndex = 10;
+ this.groupBox7.TabStop = false;
+ this.groupBox7.Visible = false;
+ //
+ // textBox7
+ //
+ this.textBox7.Font = new System.Drawing.Font("Verdana", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
+ this.textBox7.Location = new System.Drawing.Point(226, 21);
+ this.textBox7.Name = "textBox7";
+ this.textBox7.Size = new System.Drawing.Size(241, 52);
+ this.textBox7.TabIndex = 1;
+ //
+ // label7
+ //
+ this.label7.AutoSize = true;
+ this.label7.Location = new System.Drawing.Point(18, 34);
+ this.label7.Name = "label7";
+ this.label7.Size = new System.Drawing.Size(68, 23);
+ this.label7.TabIndex = 0;
+ this.label7.Text = "label7";
+ //
+ // promptLabel
+ //
+ this.promptLabel.AutoSize = true;
+ this.promptLabel.Font = new System.Drawing.Font("Verdana", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
+ this.promptLabel.Location = new System.Drawing.Point(20, 27);
+ this.promptLabel.Name = "promptLabel";
+ this.promptLabel.Size = new System.Drawing.Size(99, 29);
+ this.promptLabel.TabIndex = 11;
+ this.promptLabel.Text = "Prompt";
+ //
+ // ManualEntryForm
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.BackColor = System.Drawing.Color.DarkGoldenrod;
+ this.ClientSize = new System.Drawing.Size(735, 706);
+ this.Controls.Add(this.promptLabel);
+ this.Controls.Add(this.groupBox7);
+ this.Controls.Add(this.groupBox6);
+ this.Controls.Add(this.groupBox5);
+ this.Controls.Add(this.groupBox4);
+ this.Controls.Add(this.groupBox3);
+ this.Controls.Add(this.okButton);
+ this.Controls.Add(this.groupBox2);
+ this.Controls.Add(this.groupBox1);
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
+ this.Name = "ManualEntryForm";
+ this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
+ this.TopMost = true;
+ this.groupBox2.ResumeLayout(false);
+ this.groupBox2.PerformLayout();
+ this.groupBox1.ResumeLayout(false);
+ this.groupBox1.PerformLayout();
+ this.groupBox3.ResumeLayout(false);
+ this.groupBox3.PerformLayout();
+ this.groupBox4.ResumeLayout(false);
+ this.groupBox4.PerformLayout();
+ this.groupBox5.ResumeLayout(false);
+ this.groupBox5.PerformLayout();
+ this.groupBox6.ResumeLayout(false);
+ this.groupBox6.PerformLayout();
+ this.groupBox7.ResumeLayout(false);
+ this.groupBox7.PerformLayout();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.GroupBox groupBox2;
+ private System.Windows.Forms.TextBox textBox2;
+ private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.GroupBox groupBox1;
+ private System.Windows.Forms.TextBox textBox1;
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.Button okButton;
+ private System.Windows.Forms.GroupBox groupBox3;
+ private System.Windows.Forms.TextBox textBox3;
+ private System.Windows.Forms.Label label3;
+ private System.Windows.Forms.GroupBox groupBox4;
+ private System.Windows.Forms.TextBox textBox4;
+ private System.Windows.Forms.Label label4;
+ private System.Windows.Forms.GroupBox groupBox5;
+ private System.Windows.Forms.TextBox textBox5;
+ private System.Windows.Forms.Label label5;
+ private System.Windows.Forms.GroupBox groupBox6;
+ private System.Windows.Forms.TextBox textBox6;
+ private System.Windows.Forms.Label label6;
+ private System.Windows.Forms.GroupBox groupBox7;
+ private System.Windows.Forms.TextBox textBox7;
+ private System.Windows.Forms.Label label7;
+ private System.Windows.Forms.Label promptLabel;
+
+ }
+}
\ No newline at end of file
diff --git a/TBF/BenchControl/TestMethods/ManualEntry/ManualEntryForm.resx b/TBF/BenchControl/TestMethods/ManualEntry/ManualEntryForm.resx
new file mode 100644
index 000000000..1af7de150
--- /dev/null
+++ b/TBF/BenchControl/TestMethods/ManualEntry/ManualEntryForm.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/TBF/BenchControl/TestMethods/ManualEntry/ManualEntrySeq.cs b/TBF/BenchControl/TestMethods/ManualEntry/ManualEntrySeq.cs
new file mode 100644
index 000000000..f0e1852e7
--- /dev/null
+++ b/TBF/BenchControl/TestMethods/ManualEntry/ManualEntrySeq.cs
@@ -0,0 +1,198 @@
+///
+/// Copyright (c) 2019 Sensus Slovensko a.s.
+///
+using System;
+using System.Collections.Generic;
+using log4net;
+using Config.Entities;
+using Results;
+using Results.Entities;
+using TBF.Resources;
+using TBF.UiBridge;
+
+namespace TBF.BenchControl.TestMethods.ManualEntry
+{
+ public class ManualEntrySeq : Sequences.SequenceBase
+ {
+ private static readonly ILog log = LogManager.GetLogger(typeof(ManualEntrySeq));
+
+ System.Windows.Forms.Form modelessDlg;
+ ///
+ delegate void ManualEntryFormDlgt(ManualEntrySeq myRef, MeterTestRslt mtr, string prompt, IList items);
+ ///
+ void OpenManualEntryForm(ManualEntrySeq myRef, MeterTestRslt mtr, string prompt, IList items)
+ {
+ myRef.modelessDlg = new ManualEntryForm(mtr, prompt, items);
+ modelessDlg.Show();
+ }
+
+ ///
+ /// Adjustment method sequence
+ ///
+ /// Test entity
+ ///
+ /// Event.Done . . . . . . . OK
+ /// Event.UiCmdStop . . . . Stopped by the user using the on-screen button STOP
+ /// Event.OpArgumentError . Target flow is out of range
+ /// Event.Error . . . . . . Unspecified error
+ ///
+ public IList Execute(Test test, int repetitionNr, bool isLastRepetition, ManualEntryCfg cfg, DebugMode mode)
+ {
+ IList e; /// Events from currently running operations
+ checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
+
+ /// Start the test, initialize test results
+ Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, heatMetersPath, 0));
+
+ string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
+
+ ///
+ /// Populate TestResult data entity with default data
+ ///
+ Results.Entities.TestRslt tstRslt = BatchRslts.GetTestRslt(testName, test.Part);
+
+ if (tstRslt != null)
+ {
+ UpdateTempPressDensAmb(tstRslt);
+
+ /// Main results
+ tstRslt.MethodClass = TbfComponents.FindComponent(test.Method).ClassName;
+ tstRslt.StartTime = DateTime.Now;
+ tstRslt.FlowSetTime = 0;
+ tstRslt.TestTime = 0;
+ tstRslt.PulsesMaster = 0;
+ tstRslt.MassStartRaw = 0;
+ tstRslt.MassStart = 0;
+ tstRslt.MassEndRaw = 0;
+ tstRslt.MassEnd = 0;
+ tstRslt.FlowMass = 0;
+ tstRslt.FlowVolume = 0;
+ tstRslt.Buoyancy = Config.Formulas.Buoyancy();
+ tstRslt.VolumeMaster = 0;
+ tstRslt.ConstMasterRaw = 0;
+ tstRslt.ConstMasterCorr = 0;
+ tstRslt.ConstMaster = 0;
+ tstRslt.VolumeCTV = 0;
+ tstRslt.ErrorMaster = 0;
+
+ tstRslt.FlowMean = 0;
+ tstRslt.FlowStart = 0;
+ tstRslt.FlowEnd = 0;
+ tstRslt.FlowMin = 0;
+ tstRslt.FlowMax = 0;
+
+ tstRslt.DiverterStart = 0;
+ tstRslt.DiverterEnd = 0;
+ long infoFlags = 0;
+ tstRslt.ErrorFlags = (ErrorFlagsComp != null) ? ErrorFlagsComp.GetErrorFlags(tstRslt, false, false, 0, 0, out infoFlags) : 0;
+ tstRslt.InfoFlags = infoFlags;
+
+ for (int i = 0; i < BatchRslts.WMPositionsCount; i++)
+ {
+ if (!test.IsPartCompatible(Utils.PartNr(i + 1, BatchRslts.Batch.Compound))) continue;
+
+ Results.Entities.MeterTestRslt meterRslt = BatchRslts.GetMeterTestRslt(testName, i, CompoundMeterId.Single);
+
+ if (meterRslt != null)
+ {
+ meterRslt.RegReaderType = 0;
+ meterRslt.PulsesPerLiter = 0;
+ meterRslt.PulsesMeter = 0;
+ meterRslt.PulsesMaster = 0;
+ meterRslt.VolumeStart = 0;
+ meterRslt.VolumeEnd = 0;
+ meterRslt.VolumeMeter = 0;
+ meterRslt.VolumeRef = 0;
+ meterRslt.TestTime = 0;
+ meterRslt.Error = 0;
+ meterRslt.Passed = true;
+ meterRslt.TestDone = true;
+ tstRslt.TestDone = true;
+ }
+ }
+
+ tstRslt.Components = Results.Entities.Components
+ .UpdateList(BatchRslts.ComponentsList,
+ new Results.Entities.Components((BenchInfo != null) ? BenchInfo.TestBenchId : 1,
+ (BenchInfo != null) ? BenchInfo.TestBenchName : "testbench",
+ inPath.Pump != null ? inPath.Pump.Name : string.Empty,
+ outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
+ outPath.Scale != null ? outPath.Scale.Name : string.Empty,
+ outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
+ outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
+
+
+ IList items = Results.ManualEntryItemSpec.FromStrArray(cfg.Items);
+
+ foreach (var waterMeter in BatchRslts.WaterMeters)
+ {
+ if (waterMeter == null && waterMeter.Disabled) continue;
+
+ MeterTestRslt mtr = waterMeter.GetMeterTestRslt(testName);
+ if ((mtr != null) && (items.Count > 0))
+ {
+ /// Show the modeless dialog with error indication
+ string prompt = string.Format("{0} {1} {2}", cfg.Prompt, Strings.Water_Meter, waterMeter.WMPosition);
+ Program.MainWnd.Invoke(new ManualEntryFormDlgt(OpenManualEntryForm), new object[] { this, mtr, prompt, items });
+
+ State.Create(string.Format("{0}({1}) : Entering data", test.Method, test.Name))
+ .AddOperation(checkUiOp)
+ .EnterState();
+ do {
+ e = StateMachine.WaitRunDevsRunOps();
+ if (e.Contains(Event.Error) || TestAndLogUiCmdStop(test, e)) break;
+ }
+ while (!(modelessDlg as GenericDevices.IHasCompleted).Completed);
+ modelessDlg.Close();
+
+ if (e.Contains(Event.Error) || e.Contains(Event.UiCmdStop))
+ {
+ /// Stop or error detected => force closing the modeless dialog
+ modelessDlg.Close();
+ while (!(modelessDlg as GenericDevices.IHasCompleted).Completed) ;
+ modelessDlg = null; /// Modeless dialog is closed now
+
+ if (e.Contains(Event.Error))
+ {
+ return new List { Event.Error };
+ }
+ else
+ {
+ return new List { Event.UiCmdStop };
+ }
+ }
+
+ //------------------------------------------------
+ Bridge.OnActivity(this, Strings.Test_in_progress);
+ //------------------------------------------------
+ }
+ }
+
+
+ tstRslt.EndTime = DateTime.Now;
+
+ /// Update water meter error flags
+ if (ErrorFlagsComp != null)
+ {
+ for (int i = 0; i < BatchRslts.WMPositionsCount; i++)
+ {
+ if (BatchRslts.WaterMeters[i] != null)
+ {
+ long wmInfoFlags;
+ BatchRslts.WaterMeters[i].ErrorFlags = ErrorFlagsComp.GetWMtrErrorFlags(BatchRslts.WaterMeters[i].MeterTestRslts, out wmInfoFlags);
+ BatchRslts.WaterMeters[i].InfoFlags = wmInfoFlags;
+ }
+ }
+ }
+
+ /// Update results
+ Bridge.OnTestCompleted(this, new TestCompletedEventArgs(testName, tstRslt));
+ }
+
+ /// Append the results to the CSV-file
+ allResults.Info(TestResult2CsvLine(testName, test.Part));
+
+ return new List { Event.Done };
+ }
+ }
+}
diff --git a/TBF/Properties/AssemblyInfo.cs b/TBF/Properties/AssemblyInfo.cs
index 329376728..d303d828e 100644
--- a/TBF/Properties/AssemblyInfo.cs
+++ b/TBF/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
-[assembly: AssemblyVersion("2.24.1386.0")]
-[assembly: AssemblyFileVersion("2.24.1386.0")]
+[assembly: AssemblyVersion("2.24.1389.0")]
+[assembly: AssemblyFileVersion("2.24.1389.0")]
diff --git a/TBF/TBF.csproj b/TBF/TBF.csproj
index fe26385cb..696e7a9eb 100644
--- a/TBF/TBF.csproj
+++ b/TBF/TBF.csproj
@@ -1445,6 +1445,22 @@
+
+
+
+
+ Form
+
+
+ ManualEntryForm.cs
+
+
+
+ UserControl
+
+
+ ManualEntryCfgCtrl.cs
+
@@ -2976,6 +2992,12 @@
CfgCtrl.cs
+
+ ManualEntryForm.cs
+
+
+ ManualEntryCfgCtrl.cs
+
ManualPulsesForm.cs