TestMethods.ManualEntry, Results.ManualEntryItemSpec, Results.Forms.ManualEntryConfig..., etc., ver. 2.24.1389
This commit is contained in:
parent
94b9f564cc
commit
6678cb31c5
258
Results/Forms/ManualEntryConfigCtrl.Designer.cs
generated
Normal file
258
Results/Forms/ManualEntryConfigCtrl.Designer.cs
generated
Normal file
@ -0,0 +1,258 @@
|
||||
namespace Results.Forms
|
||||
{
|
||||
partial class ManualEntryConfigCtrl
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.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;
|
||||
|
||||
}
|
||||
}
|
||||
450
Results/Forms/ManualEntryConfigCtrl.cs
Normal file
450
Results/Forms/ManualEntryConfigCtrl.cs
Normal file
@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// ListViewEx columns
|
||||
/// </summary>
|
||||
enum Column
|
||||
{
|
||||
Item,
|
||||
Caption,
|
||||
Units,
|
||||
Count,
|
||||
}
|
||||
|
||||
Control[] editors; /// all editors except of units
|
||||
ComboBox unitsCB; /// units combo box
|
||||
|
||||
public IList<ManualEntryItemSpec> 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;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Redraw available items (right hand side)
|
||||
/// </summary>
|
||||
void RedrawAvailable()
|
||||
{
|
||||
RedrawByQuantity(availableByQuantityTreeView);
|
||||
RedrawByCategory(availableByCategoryTreeView);
|
||||
RedrawInAlphabeticOrder(availableAlphabeticTreeView);
|
||||
}
|
||||
|
||||
|
||||
void RedrawInAlphabeticOrder(TreeView treeView)
|
||||
{
|
||||
treeView.Nodes.Clear();
|
||||
|
||||
IList<ManualEntryItemSpec> 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<Config.Quantity> quantities = new List<Config.Quantity>();
|
||||
for (Config.Quantity q = 0; q < Config.Quantity.Count; q++) quantities.Add(q);
|
||||
|
||||
IList<Config.Quantity> 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<ItemCategory> categories = new List<ItemCategory>();
|
||||
for (ItemCategory c = 0; c < ItemCategory.Count; c++) categories.Add(c);
|
||||
|
||||
IList<ItemCategory> 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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Redraw selected items (right hand side)
|
||||
/// </summary>
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
120
Results/Forms/ManualEntryConfigCtrl.resx
Normal file
120
Results/Forms/ManualEntryConfigCtrl.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>
|
||||
60
Results/Forms/ManualEntryConfigDlg.cs
Normal file
60
Results/Forms/ManualEntryConfigDlg.cs
Normal file
@ -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<ManualEntryItemSpec> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
95
Results/Forms/ManualEntryConfigDlg.designer.cs
generated
Normal file
95
Results/Forms/ManualEntryConfigDlg.designer.cs
generated
Normal file
@ -0,0 +1,95 @@
|
||||
///
|
||||
/// Copyright (c) 2016 Sensus Metering Systems
|
||||
///
|
||||
namespace Results.Forms
|
||||
{
|
||||
partial class ManualEntryConfigDlg
|
||||
{
|
||||
/// <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.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;
|
||||
}
|
||||
}
|
||||
120
Results/Forms/ManualEntryConfigDlg.resx
Normal file
120
Results/Forms/ManualEntryConfigDlg.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>
|
||||
244
Results/ManualEntryItemSpec.cs
Normal file
244
Results/ManualEntryItemSpec.cs
Normal file
@ -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<ManualEntryItemSpec> AllItems;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the <see cref="ManualEntryItemSpec"/> class.
|
||||
/// </summary>
|
||||
/// Static constructor that initializes the list of all items
|
||||
static ManualEntryItemSpec()
|
||||
{
|
||||
AllItems = new List<ManualEntryItemSpec>();
|
||||
|
||||
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; }));
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Converts a list of 'Output item specifications' to a string array
|
||||
/// </summary>
|
||||
/// <param name="items"></param>
|
||||
/// <returns></returns>
|
||||
public static string[] ToStrArray(IList<ManualEntryItemSpec> 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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a string array to a list of 'Output item specifications'
|
||||
/// </summary>
|
||||
/// <param name="strArray"></param>
|
||||
/// <returns></returns>
|
||||
public static IList<ManualEntryItemSpec> FromStrArray(string[] strArray)
|
||||
{
|
||||
IList<ManualEntryItemSpec> result = new List<ManualEntryItemSpec>();
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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")]
|
||||
|
||||
18
Results/Resources/Strings.Designer.cs
generated
18
Results/Resources/Strings.Designer.cs
generated
@ -114,6 +114,15 @@ namespace Results.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Available items.
|
||||
/// </summary>
|
||||
internal static string Available_items {
|
||||
get {
|
||||
return ResourceManager.GetString("Available_items", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Available results.
|
||||
/// </summary>
|
||||
@ -978,6 +987,15 @@ namespace Results.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Selected item.
|
||||
/// </summary>
|
||||
internal static string Selected_items {
|
||||
get {
|
||||
return ResourceManager.GetString("Selected_items", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Selected results.
|
||||
/// </summary>
|
||||
|
||||
@ -819,4 +819,10 @@
|
||||
<data name="This_position_is_disabled" xml:space="preserve">
|
||||
<value>This position is disabled</value>
|
||||
</data>
|
||||
<data name="Available_items" xml:space="preserve">
|
||||
<value>Available items</value>
|
||||
</data>
|
||||
<data name="Selected_items" xml:space="preserve">
|
||||
<value>Selected item</value>
|
||||
</data>
|
||||
</root>
|
||||
@ -82,6 +82,18 @@
|
||||
<Compile Include="Forms\ListViewExtensions.cs" />
|
||||
<Compile Include="Forms\LviIntColumnComparer.cs" />
|
||||
<Compile Include="Forms\LviTextColumnComparer.cs" />
|
||||
<Compile Include="Forms\ManualEntryConfigCtrl.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Forms\ManualEntryConfigCtrl.designer.cs">
|
||||
<DependentUpon>ManualEntryConfigCtrl.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Forms\ManualEntryConfigDlg.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Forms\ManualEntryConfigDlg.designer.cs">
|
||||
<DependentUpon>ManualEntryConfigDlg.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Forms\MoreWMResultsDlg.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
@ -120,6 +132,7 @@
|
||||
</Compile>
|
||||
<Compile Include="Forms\WaterMeterEventArgs.cs" />
|
||||
<Compile Include="ItemID.cs" />
|
||||
<Compile Include="ManualEntryItemSpec.cs" />
|
||||
<Compile Include="Mappings\BatchMap.cs" />
|
||||
<Compile Include="Mappings\ComponentsMap.cs" />
|
||||
<Compile Include="Mappings\MeterTestRsltMap.cs" />
|
||||
@ -191,6 +204,12 @@
|
||||
<EmbeddedResource Include="Forms\ListViewEx.resx">
|
||||
<DependentUpon>ListViewEx.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\ManualEntryConfigCtrl.resx">
|
||||
<DependentUpon>ManualEntryConfigCtrl.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\ManualEntryConfigDlg.resx">
|
||||
<DependentUpon>ManualEntryConfigDlg.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\MoreWMResultsDlg.resx">
|
||||
<DependentUpon>MoreWMResultsDlg.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
||||
@ -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());
|
||||
|
||||
69
TBF/BenchControl/TestMethods/ManualEntry/Component.cs
Normal file
69
TBF/BenchControl/TestMethods/ManualEntry/Component.cs
Normal file
@ -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<Event> 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<CfgChangeArgs> 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
|
||||
}
|
||||
}
|
||||
29
TBF/BenchControl/TestMethods/ManualEntry/Factory.cs
Normal file
29
TBF/BenchControl/TestMethods/ManualEntry/Factory.cs
Normal file
@ -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<IComponent> 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
43
TBF/BenchControl/TestMethods/ManualEntry/ManualEntryCfg.cs
Normal file
43
TBF/BenchControl/TestMethods/ManualEntry/ManualEntryCfg.cs
Normal file
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
172
TBF/BenchControl/TestMethods/ManualEntry/ManualEntryCfgCtrl.cs
Normal file
172
TBF/BenchControl/TestMethods/ManualEntry/ManualEntryCfgCtrl.cs
Normal file
@ -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<CmdResponseArgs> CmdResponseHandler;
|
||||
|
||||
public void StartResponseHandler() { }
|
||||
public void StopResponseHandler() { }
|
||||
|
||||
#endregion Configuration Change Handling
|
||||
}
|
||||
}
|
||||
147
TBF/BenchControl/TestMethods/ManualEntry/ManualEntryCfgCtrl.designer.cs
generated
Normal file
147
TBF/BenchControl/TestMethods/ManualEntry/ManualEntryCfgCtrl.designer.cs
generated
Normal file
@ -0,0 +1,147 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
namespace TBF.BenchControl.TestMethods.ManualEntry
|
||||
{
|
||||
partial class ManualEntryCfgCtrl
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.nameTextBox = new System.Windows.Forms.TextBox();
|
||||
this.nameLabel = new System.Windows.Forms.Label();
|
||||
this.classNameLabel = new System.Windows.Forms.Label();
|
||||
this.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;
|
||||
}
|
||||
}
|
||||
120
TBF/BenchControl/TestMethods/ManualEntry/ManualEntryCfgCtrl.resx
Normal file
120
TBF/BenchControl/TestMethods/ManualEntry/ManualEntryCfgCtrl.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>
|
||||
117
TBF/BenchControl/TestMethods/ManualEntry/ManualEntryForm.cs
Normal file
117
TBF/BenchControl/TestMethods/ManualEntry/ManualEntryForm.cs
Normal file
@ -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<Results.ManualEntryItemSpec> items;
|
||||
|
||||
GroupBox[] groupBoxes;
|
||||
Label[] labels;
|
||||
TextBox[] textBoxes;
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor
|
||||
/// </summary>
|
||||
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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="waterMetersCount">Number of text boxes for serial numbers</param>
|
||||
public ManualEntryForm(MeterTestRslt meterTestRslt, string prompt, IList<Results.ManualEntryItemSpec> 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<EventArgs>(OnForceClose), sender, args); }
|
||||
else OnForceClose(sender, args);
|
||||
};
|
||||
}
|
||||
|
||||
void OnForceClose(object sender, EventArgs args)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
362
TBF/BenchControl/TestMethods/ManualEntry/ManualEntryForm.designer.cs
generated
Normal file
362
TBF/BenchControl/TestMethods/ManualEntry/ManualEntryForm.designer.cs
generated
Normal file
@ -0,0 +1,362 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
namespace TBF.BenchControl.TestMethods.ManualEntry
|
||||
{
|
||||
partial class ManualEntryForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||
this.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;
|
||||
|
||||
}
|
||||
}
|
||||
120
TBF/BenchControl/TestMethods/ManualEntry/ManualEntryForm.resx
Normal file
120
TBF/BenchControl/TestMethods/ManualEntry/ManualEntryForm.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>
|
||||
198
TBF/BenchControl/TestMethods/ManualEntry/ManualEntrySeq.cs
Normal file
198
TBF/BenchControl/TestMethods/ManualEntry/ManualEntrySeq.cs
Normal file
@ -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<ManualEntryItemSpec> items);
|
||||
///
|
||||
void OpenManualEntryForm(ManualEntrySeq myRef, MeterTestRslt mtr, string prompt, IList<ManualEntryItemSpec> items)
|
||||
{
|
||||
myRef.modelessDlg = new ManualEntryForm(mtr, prompt, items);
|
||||
modelessDlg.Show();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adjustment method sequence
|
||||
/// </summary>
|
||||
/// <param name="test">Test entity</param>
|
||||
/// <returns>
|
||||
/// Event.Done . . . . . . . OK
|
||||
/// Event.UiCmdStop . . . . Stopped by the user using the on-screen button STOP
|
||||
/// Event.OpArgumentError . Target flow is out of range
|
||||
/// Event.Error . . . . . . Unspecified error
|
||||
/// </returns>
|
||||
public IList<Event> Execute(Test test, int repetitionNr, bool isLastRepetition, ManualEntryCfg cfg, DebugMode mode)
|
||||
{
|
||||
IList<Event> 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<Results.ManualEntryItemSpec> 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> { Event.Error };
|
||||
}
|
||||
else
|
||||
{
|
||||
return new List<Event> { 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> { Event.Done };
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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")]
|
||||
|
||||
@ -1445,6 +1445,22 @@
|
||||
</Compile>
|
||||
<Compile Include="BenchControl\TestMethods\LiveStream\Factory.cs" />
|
||||
<Compile Include="BenchControl\TestMethods\LiveStream\LiveStreamSeq.cs" />
|
||||
<Compile Include="BenchControl\TestMethods\ManualEntry\ManualEntrySeq.cs" />
|
||||
<Compile Include="BenchControl\TestMethods\ManualEntry\Factory.cs" />
|
||||
<Compile Include="BenchControl\TestMethods\ManualEntry\Component.cs" />
|
||||
<Compile Include="BenchControl\TestMethods\ManualEntry\ManualEntryForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="BenchControl\TestMethods\ManualEntry\ManualEntryForm.designer.cs">
|
||||
<DependentUpon>ManualEntryForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="BenchControl\TestMethods\ManualEntry\ManualEntryCfg.cs" />
|
||||
<Compile Include="BenchControl\TestMethods\ManualEntry\ManualEntryCfgCtrl.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="BenchControl\TestMethods\ManualEntry\ManualEntryCfgCtrl.designer.cs">
|
||||
<DependentUpon>ManualEntryCfgCtrl.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="BenchControl\TestMethods\OuterLoop\End\Component.cs" />
|
||||
<Compile Include="BenchControl\TestMethods\OuterLoop\End\Factory.cs" />
|
||||
<Compile Include="BenchControl\TestMethods\OuterLoop\Start\Component.cs" />
|
||||
@ -2976,6 +2992,12 @@
|
||||
<EmbeddedResource Include="BenchControl\TestMethods\LiveStream\CfgCtrl.resx">
|
||||
<DependentUpon>CfgCtrl.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="BenchControl\TestMethods\ManualEntry\ManualEntryForm.resx">
|
||||
<DependentUpon>ManualEntryForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="BenchControl\TestMethods\ManualEntry\ManualEntryCfgCtrl.resx">
|
||||
<DependentUpon>ManualEntryCfgCtrl.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="BenchControl\TestMethods\PulsesTestManual\ManualPulsesForm.resx">
|
||||
<DependentUpon>ManualPulsesForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user