On screen results use new style of configuration, part 2: ResultsConfigCtrl added.
This commit is contained in:
parent
b92d9f5a9c
commit
91b750e1a0
@ -48,9 +48,19 @@ namespace Config.Entities
|
||||
/// <summary> Kind of meters for the procedure / test </summary>
|
||||
public enum MetersKind
|
||||
{
|
||||
Single,
|
||||
Combined,
|
||||
HeatMeter,
|
||||
#if LANG_DE
|
||||
[Description("Wasserzähler")] Single,
|
||||
[Description("Verbundwasserzähler")] Combined,
|
||||
[Description("Wärmezähler")] HeatMeter,
|
||||
#elif LANG_CS
|
||||
[Description("Vodoměry")] Single,
|
||||
[Description("Kombinované vodoměry")] Combined,
|
||||
[Description("Měřiče tepla")] HeatMeter,
|
||||
#else
|
||||
[Description("Water meters")] Single,
|
||||
[Description("Compound water meters")] Combined,
|
||||
[Description("Heat meters")] HeatMeter,
|
||||
#endif
|
||||
}
|
||||
|
||||
public enum CompoundMeterId : byte
|
||||
@ -354,4 +364,3 @@ namespace Config.Entities
|
||||
Count
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
257
Results/Forms/ResultsConfigCtrl.Designer.cs
generated
Normal file
257
Results/Forms/ResultsConfigCtrl.Designer.cs
generated
Normal file
@ -0,0 +1,257 @@
|
||||
namespace Results.Forms
|
||||
{
|
||||
partial class ResultsConfigCtrl
|
||||
{
|
||||
/// <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.availableAlphabeticTreeView = new System.Windows.Forms.TreeView();
|
||||
this.tabPage2 = new System.Windows.Forms.TabPage();
|
||||
this.availableByQuantityTreeView = new System.Windows.Forms.TreeView();
|
||||
this.tabPage3 = new System.Windows.Forms.TabPage();
|
||||
this.availableByCategoryTreeView = 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.selectedResultsLabel = new System.Windows.Forms.Label();
|
||||
this.availableResultsLabel = 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.availableAlphabeticTreeView);
|
||||
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;
|
||||
//
|
||||
// availableAlphabeticTreeView
|
||||
//
|
||||
this.availableAlphabeticTreeView.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.availableAlphabeticTreeView.Location = new System.Drawing.Point(3, 3);
|
||||
this.availableAlphabeticTreeView.Name = "availableAlphabeticTreeView";
|
||||
this.availableAlphabeticTreeView.Size = new System.Drawing.Size(192, 421);
|
||||
this.availableAlphabeticTreeView.TabIndex = 0;
|
||||
this.availableAlphabeticTreeView.DoubleClick += new System.EventHandler(this.availableAlphabeticTreeView_DoubleClick);
|
||||
//
|
||||
// tabPage2
|
||||
//
|
||||
this.tabPage2.Controls.Add(this.availableByQuantityTreeView);
|
||||
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;
|
||||
//
|
||||
// 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);
|
||||
//
|
||||
// tabPage3
|
||||
//
|
||||
this.tabPage3.Controls.Add(this.availableByCategoryTreeView);
|
||||
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;
|
||||
//
|
||||
// availableByCategoryTreeView
|
||||
//
|
||||
this.availableByCategoryTreeView.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.availableByCategoryTreeView.Location = new System.Drawing.Point(0, 0);
|
||||
this.availableByCategoryTreeView.Name = "availableByCategoryTreeView";
|
||||
this.availableByCategoryTreeView.Size = new System.Drawing.Size(198, 427);
|
||||
this.availableByCategoryTreeView.TabIndex = 0;
|
||||
this.availableByCategoryTreeView.DoubleClick += new System.EventHandler(this.availableByCategoryTreeView_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.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);
|
||||
//
|
||||
// selectedResultsLabel
|
||||
//
|
||||
this.selectedResultsLabel.AutoSize = true;
|
||||
this.selectedResultsLabel.Location = new System.Drawing.Point(321, 11);
|
||||
this.selectedResultsLabel.Name = "selectedResultsLabel";
|
||||
this.selectedResultsLabel.Size = new System.Drawing.Size(85, 13);
|
||||
this.selectedResultsLabel.TabIndex = 52;
|
||||
this.selectedResultsLabel.Text = "Selected results:";
|
||||
//
|
||||
// availableResultsLabel
|
||||
//
|
||||
this.availableResultsLabel.AutoSize = true;
|
||||
this.availableResultsLabel.Location = new System.Drawing.Point(11, 11);
|
||||
this.availableResultsLabel.Name = "availableResultsLabel";
|
||||
this.availableResultsLabel.Size = new System.Drawing.Size(86, 13);
|
||||
this.availableResultsLabel.TabIndex = 51;
|
||||
this.availableResultsLabel.Text = "Available results:";
|
||||
//
|
||||
// ResultsConfigCtrl
|
||||
//
|
||||
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.selectedResultsLabel);
|
||||
this.Controls.Add(this.availableResultsLabel);
|
||||
this.Name = "ResultsConfigCtrl";
|
||||
this.Size = new System.Drawing.Size(925, 496);
|
||||
this.Load += new System.EventHandler(this.ResultsConfigCtrl_Load);
|
||||
this.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.ResultsConfigCtrl_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 availableAlphabeticTreeView;
|
||||
private System.Windows.Forms.TabPage tabPage2;
|
||||
private System.Windows.Forms.TreeView availableByQuantityTreeView;
|
||||
private System.Windows.Forms.TabPage tabPage3;
|
||||
private System.Windows.Forms.TreeView availableByCategoryTreeView;
|
||||
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 selectedResultsLabel;
|
||||
private System.Windows.Forms.Label availableResultsLabel;
|
||||
|
||||
}
|
||||
}
|
||||
517
Results/Forms/ResultsConfigCtrl.cs
Normal file
517
Results/Forms/ResultsConfigCtrl.cs
Normal file
@ -0,0 +1,517 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using log4net;
|
||||
using Config.Entities;
|
||||
using Results;
|
||||
using Results.Resources;
|
||||
|
||||
namespace Results.Forms
|
||||
{
|
||||
public partial class ResultsConfigCtrl : UserControl
|
||||
{
|
||||
/// <summary>
|
||||
/// ListViewEx columns
|
||||
/// </summary>
|
||||
enum Column
|
||||
{
|
||||
Item,
|
||||
Caption,
|
||||
Units,
|
||||
Format,
|
||||
Precision,
|
||||
Width,
|
||||
Alignment,
|
||||
TestID,
|
||||
Count,
|
||||
}
|
||||
|
||||
Control[] editors; /// all editors except of units
|
||||
ComboBox unitsCB; /// units combo box
|
||||
|
||||
public MetersKind MetersKind;
|
||||
public IList<WMeterRsltItemSpec> SelectedItems;
|
||||
public bool SupressTestIDColumn;
|
||||
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 ResultsConfigCtrl(bool supressTestIDColumn)
|
||||
: this()
|
||||
{
|
||||
this.SupressTestIDColumn = supressTestIDColumn;
|
||||
}
|
||||
|
||||
public ResultsConfigCtrl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
|
||||
void Localize()
|
||||
{
|
||||
Text = Strings.Configuration;
|
||||
availableResultsLabel.Text = Strings.Available_results;
|
||||
availableTabControl.TabPages[0].Text = "A...Z";
|
||||
availableTabControl.TabPages[1].Text = Strings.Quantity;
|
||||
availableTabControl.TabPages[2].Text = Strings.Category;
|
||||
|
||||
selectedResultsLabel.Text = Strings.Selected_results;
|
||||
|
||||
addButton.Text = Strings.Add;
|
||||
removeButton.Text = Strings.Remove;
|
||||
removeAllButton.Text = Strings.Remove_all;
|
||||
upButton.Text = Strings.UpBtnText;
|
||||
downButton.Text = Strings.DownBtnText;
|
||||
}
|
||||
|
||||
private void ResultsConfigCtrl_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 });
|
||||
selectedResultsListViewEx.Columns.Add(new ColumnHeader { Text = Strings.Format });
|
||||
selectedResultsListViewEx.Columns.Add(new ColumnHeader { Text = Strings.Precision });
|
||||
selectedResultsListViewEx.Columns.Add(new ColumnHeader { Text = Strings.Width });
|
||||
selectedResultsListViewEx.Columns.Add(new ColumnHeader { Text = Strings.Alignment });
|
||||
if (!SupressTestIDColumn)
|
||||
{
|
||||
selectedResultsListViewEx.Columns.Add(new ColumnHeader { Text = Strings.Test_ID });
|
||||
}
|
||||
|
||||
/// 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,
|
||||
new TextBox(), /// format
|
||||
new TextBox(), /// precision
|
||||
new TextBox(), /// width
|
||||
alignmentCB,
|
||||
new TextBox(), /// testID
|
||||
};
|
||||
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);
|
||||
|
||||
//availableAlphabeticTreeView.ShowNodeToolTips = true;
|
||||
//availableByQuantityTreeView.ShowNodeToolTips = true;
|
||||
//availableByCategoryTreeView.ShowNodeToolTips = true;
|
||||
|
||||
RedrawAvailable();
|
||||
RedrawSelected();
|
||||
}
|
||||
|
||||
void selectedResultsListViewEx_SubItemClicked(object sender, SubItemEventArgs e)
|
||||
{
|
||||
if (e.SubItem == (int)Column.Units)
|
||||
{
|
||||
Config.Quantity quantity = (e.Item.Tag as WMeterRsltItemSpec).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)(SupressTestIDColumn ? Column.TestID : Column.Count)))
|
||||
{
|
||||
selectedResultsListViewEx.StartEditing(editors[e.SubItem], e.Item, e.SubItem);
|
||||
}
|
||||
}
|
||||
|
||||
void selectedResultsListViewEx_SubItemEndEditing(object sender, SubItemEndEditingEventArgs e)
|
||||
{
|
||||
ListViewItem lvi = e.Item;
|
||||
WMeterRsltItemSpec item = lvi.Tag as WMeterRsltItemSpec;
|
||||
|
||||
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
|
||||
|
||||
case Column.Format: item.Format = e.DisplayText; return;
|
||||
case Column.Precision: item.Precision = e.DisplayText; return;
|
||||
case Column.Width:
|
||||
{
|
||||
int width;
|
||||
if (Int32.TryParse(editors[e.SubItem].Text, out width) && width >= 0)
|
||||
{
|
||||
item.Width = width;
|
||||
return; /// OK
|
||||
}
|
||||
break; /// Error
|
||||
}
|
||||
|
||||
case Column.Alignment:
|
||||
for (Config.Entities.Alignment a = 0; a < Config.Entities.Alignment.Count; a++)
|
||||
{
|
||||
if (a.ToDescription().Equals(editors[e.SubItem].Text))
|
||||
{
|
||||
item.Alignment = a;
|
||||
return;
|
||||
}
|
||||
}
|
||||
break; /// Error
|
||||
|
||||
case Column.TestID: item.TestID = e.DisplayText; return;
|
||||
|
||||
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()
|
||||
{
|
||||
RedrawInAlphabeticOrder(availableAlphabeticTreeView);
|
||||
RedrawByQuantity(availableByQuantityTreeView);
|
||||
RedrawByCategory(availableByCategoryTreeView);
|
||||
}
|
||||
|
||||
|
||||
void RedrawInAlphabeticOrder(TreeView treeView)
|
||||
{
|
||||
treeView.Nodes.Clear();
|
||||
|
||||
IList<WMeterRsltItemSpec> alphabeticlList = WMeterRsltItemSpec.AllItems.OrderBy(x => x.Name).ToList();
|
||||
///
|
||||
foreach (var item in alphabeticlList)
|
||||
{
|
||||
TreeNode node = new TreeNode(item.Name);
|
||||
node.Tag = item;
|
||||
node.ToolTipText = item.ToolTipText;
|
||||
availableAlphabeticTreeView.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 WMeterRsltItemSpec.AllItems)
|
||||
{
|
||||
if (ri.Quantity == q) n++;
|
||||
}
|
||||
|
||||
if (n > 0)
|
||||
{
|
||||
TreeNode[] array = new TreeNode[n];
|
||||
int i = 0;
|
||||
foreach (var ri in WMeterRsltItemSpec.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 WMeterRsltItemSpec.AllItems)
|
||||
{
|
||||
if (ri.Category == c) n++;
|
||||
}
|
||||
|
||||
if (n > 0)
|
||||
{
|
||||
TreeNode[] array = new TreeNode[n];
|
||||
int i = 0;
|
||||
foreach (var ri in WMeterRsltItemSpec.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
|
||||
lvi.SubItems.Add(item.Format); /// Format
|
||||
lvi.SubItems.Add(item.Precision); /// Precision
|
||||
lvi.SubItems.Add(item.Width.ToString()); /// Width
|
||||
lvi.SubItems.Add(item.Alignment.ToDescription()); /// Alignment
|
||||
if (!SupressTestIDColumn)
|
||||
{
|
||||
lvi.SubItems.Add(item.TestID); /// TestID
|
||||
}
|
||||
|
||||
selectedResultsListViewEx.Items.Add(lvi);
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateSelectedFromView()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void addButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
switch (availableTabControl.SelectedIndex)
|
||||
{
|
||||
case 0:
|
||||
availableAlphabeticTreeView_DoubleClick(this, null);
|
||||
break;
|
||||
case 1:
|
||||
availableByQuantityTreeView_DoubleClick(this, null);
|
||||
break;
|
||||
case 2:
|
||||
availableByCategoryTreeView_DoubleClick(this, null);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void availableAlphabeticTreeView_DoubleClick(object sender, EventArgs e)
|
||||
{
|
||||
if (availableAlphabeticTreeView.SelectedNode != null &&
|
||||
availableAlphabeticTreeView.SelectedNode.Tag is WMeterRsltItemSpec)
|
||||
{
|
||||
AddItem(availableAlphabeticTreeView.SelectedNode.Tag as WMeterRsltItemSpec);
|
||||
}
|
||||
}
|
||||
|
||||
private void availableByQuantityTreeView_DoubleClick(object sender, EventArgs e)
|
||||
{
|
||||
if (availableByQuantityTreeView.SelectedNode != null &&
|
||||
availableByQuantityTreeView.SelectedNode.Tag is WMeterRsltItemSpec)
|
||||
{
|
||||
AddItem(availableByQuantityTreeView.SelectedNode.Tag as WMeterRsltItemSpec);
|
||||
}
|
||||
}
|
||||
|
||||
private void availableByCategoryTreeView_DoubleClick(object sender, EventArgs e)
|
||||
{
|
||||
if (availableByCategoryTreeView.SelectedNode != null &&
|
||||
availableByCategoryTreeView.SelectedNode.Tag is WMeterRsltItemSpec)
|
||||
{
|
||||
AddItem(availableByCategoryTreeView.SelectedNode.Tag as WMeterRsltItemSpec);
|
||||
}
|
||||
}
|
||||
|
||||
void AddItem(WMeterRsltItemSpec item)
|
||||
{
|
||||
WMeterRsltItemSpec 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 ResultsConfigCtrl_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;
|
||||
}
|
||||
|
||||
WMeterRsltItemSpec 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;
|
||||
}
|
||||
|
||||
WMeterRsltItemSpec 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/ResultsConfigCtrl.resx
Normal file
120
Results/Forms/ResultsConfigCtrl.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>
|
||||
@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2016 Sensus Metering Systems
|
||||
/// Copyright (c) 2016-2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -14,497 +14,58 @@ namespace Results.Forms
|
||||
{
|
||||
public partial class ResultsConfigDlg : Form
|
||||
{
|
||||
/// <summary>
|
||||
/// ListViewEx columns
|
||||
/// </summary>
|
||||
enum Column
|
||||
public IList<WMeterRsltItemSpec> SelectedItems
|
||||
{
|
||||
Item,
|
||||
Caption,
|
||||
Units,
|
||||
Format,
|
||||
Precision,
|
||||
Width,
|
||||
Alignment,
|
||||
TestID,
|
||||
Count,
|
||||
set { resultsConfigCtrl.SelectedItems = value; }
|
||||
get { return resultsConfigCtrl.SelectedItems; }
|
||||
}
|
||||
|
||||
Control[] editors; /// all editors except of units
|
||||
ComboBox unitsCB; /// units combo box
|
||||
|
||||
|
||||
public IList<WMeterRsltItemSpec> AvailableItems;
|
||||
public IList<WMeterRsltItemSpec> SelectedItems;
|
||||
|
||||
public MetersKind MetersKind;
|
||||
|
||||
|
||||
bool supressTestIDColumn;
|
||||
public MetersKind MetersKind
|
||||
{
|
||||
set { resultsConfigCtrl.MetersKind = value; }
|
||||
}
|
||||
|
||||
|
||||
public ResultsConfigDlg(bool supressTestIDColumn)
|
||||
: this()
|
||||
{
|
||||
this.supressTestIDColumn = supressTestIDColumn;
|
||||
resultsConfigCtrl.SupressTestIDColumn = supressTestIDColumn;
|
||||
}
|
||||
|
||||
public ResultsConfigDlg()
|
||||
{
|
||||
InitializeComponent();
|
||||
resultsConfigCtrl.Unlocked = true;
|
||||
}
|
||||
|
||||
|
||||
void Localize()
|
||||
{
|
||||
Text = Strings.Configuration;
|
||||
availableResultsLabel.Text = Strings.Available_results;
|
||||
availableTabControl.TabPages[0].Text = "A...Z";
|
||||
availableTabControl.TabPages[1].Text = Strings.Quantity;
|
||||
availableTabControl.TabPages[2].Text = Strings.Category;
|
||||
|
||||
selectedResultsLabel.Text = Strings.Selected_results;
|
||||
|
||||
addButton.Text = Strings.Add;
|
||||
removeButton.Text = Strings.Remove;
|
||||
removeAllButton.Text = Strings.Remove_all;
|
||||
okButton.Text = Strings.OkBtnText;
|
||||
cancelButton.Text = Strings.CancelBtnText;
|
||||
upButton.Text = Strings.UpBtnText;
|
||||
downButton.Text = Strings.DownBtnText;
|
||||
}
|
||||
|
||||
void ResultsConfig_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 });
|
||||
selectedResultsListViewEx.Columns.Add(new ColumnHeader { Text = Strings.Format });
|
||||
selectedResultsListViewEx.Columns.Add(new ColumnHeader { Text = Strings.Precision });
|
||||
selectedResultsListViewEx.Columns.Add(new ColumnHeader { Text = Strings.Width });
|
||||
selectedResultsListViewEx.Columns.Add(new ColumnHeader { Text = Strings.Alignment });
|
||||
if (!supressTestIDColumn)
|
||||
{
|
||||
selectedResultsListViewEx.Columns.Add(new ColumnHeader { Text = Strings.Test_ID });
|
||||
}
|
||||
|
||||
/// 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,
|
||||
new TextBox(), /// format
|
||||
new TextBox(), /// precision
|
||||
new TextBox(), /// width
|
||||
alignmentCB,
|
||||
new TextBox(), /// testID
|
||||
};
|
||||
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);
|
||||
|
||||
//availableAlphabeticTreeView.ShowNodeToolTips = true;
|
||||
//availableByQuantityTreeView.ShowNodeToolTips = true;
|
||||
//availableByCategoryTreeView.ShowNodeToolTips = true;
|
||||
|
||||
RedrawAvailable();
|
||||
RedrawSelected();
|
||||
}
|
||||
|
||||
void selectedResultsListViewEx_SubItemClicked(object sender, SubItemEventArgs e)
|
||||
{
|
||||
if (e.SubItem == (int)Column.Units)
|
||||
{
|
||||
Config.Quantity quantity = (e.Item.Tag as WMeterRsltItemSpec).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)(supressTestIDColumn ? Column.TestID : Column.Count)))
|
||||
{
|
||||
selectedResultsListViewEx.StartEditing(editors[e.SubItem], e.Item, e.SubItem);
|
||||
}
|
||||
}
|
||||
|
||||
void selectedResultsListViewEx_SubItemEndEditing(object sender, SubItemEndEditingEventArgs e)
|
||||
{
|
||||
ListViewItem lvi = e.Item;
|
||||
WMeterRsltItemSpec item = lvi.Tag as WMeterRsltItemSpec;
|
||||
|
||||
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
|
||||
|
||||
case Column.Format: item.Format = e.DisplayText; return;
|
||||
case Column.Precision: item.Precision = e.DisplayText; return;
|
||||
case Column.Width:
|
||||
{
|
||||
int width;
|
||||
if (Int32.TryParse(editors[e.SubItem].Text, out width) && width >= 0)
|
||||
{
|
||||
item.Width = width;
|
||||
return; /// OK
|
||||
}
|
||||
break; /// Error
|
||||
}
|
||||
|
||||
case Column.Alignment:
|
||||
for (Config.Entities.Alignment a = 0; a < Config.Entities.Alignment.Count; a++)
|
||||
{
|
||||
if (a.ToDescription().Equals(editors[e.SubItem].Text))
|
||||
{
|
||||
item.Alignment = a;
|
||||
return;
|
||||
}
|
||||
}
|
||||
break; /// Error
|
||||
|
||||
case Column.TestID: item.TestID = e.DisplayText; return;
|
||||
|
||||
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()
|
||||
{
|
||||
RedrawInAlphabeticOrder(availableAlphabeticTreeView);
|
||||
RedrawByQuantity(availableByQuantityTreeView);
|
||||
RedrawByCategory(availableByCategoryTreeView);
|
||||
}
|
||||
|
||||
|
||||
void RedrawInAlphabeticOrder(TreeView treeView)
|
||||
{
|
||||
treeView.Nodes.Clear();
|
||||
|
||||
IList<WMeterRsltItemSpec> alphabeticlList = WMeterRsltItemSpec.AllItems.OrderBy(x => x.Name).ToList();
|
||||
///
|
||||
foreach (var item in alphabeticlList)
|
||||
{
|
||||
TreeNode node = new TreeNode(item.Name);
|
||||
node.Tag = item;
|
||||
node.ToolTipText = item.ToolTipText;
|
||||
availableAlphabeticTreeView.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 WMeterRsltItemSpec.AllItems)
|
||||
{
|
||||
if (ri.Quantity == q) n++;
|
||||
}
|
||||
|
||||
if (n > 0)
|
||||
{
|
||||
TreeNode[] array = new TreeNode[n];
|
||||
int i = 0;
|
||||
foreach (var ri in WMeterRsltItemSpec.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 WMeterRsltItemSpec.AllItems)
|
||||
{
|
||||
if (ri.Category == c) n++;
|
||||
}
|
||||
|
||||
if (n > 0)
|
||||
{
|
||||
TreeNode[] array = new TreeNode[n];
|
||||
int i = 0;
|
||||
foreach (var ri in WMeterRsltItemSpec.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();
|
||||
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
|
||||
lvi.SubItems.Add(item.Format); /// Format
|
||||
lvi.SubItems.Add(item.Precision); /// Precision
|
||||
lvi.SubItems.Add(item.Width.ToString()); /// Width
|
||||
lvi.SubItems.Add(item.Alignment.ToDescription()); /// Alignment
|
||||
if (!supressTestIDColumn)
|
||||
{
|
||||
lvi.SubItems.Add(item.TestID); /// TestID
|
||||
}
|
||||
|
||||
selectedResultsListViewEx.Items.Add(lvi);
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateSelectedFromView()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void addButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
switch (availableTabControl.SelectedIndex)
|
||||
{
|
||||
case 0:
|
||||
availableAlphabeticTreeView_DoubleClick(this, null);
|
||||
break;
|
||||
case 1:
|
||||
availableByQuantityTreeView_DoubleClick(this, null);
|
||||
break;
|
||||
case 2:
|
||||
availableByCategoryTreeView_DoubleClick(this, null);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void availableAlphabeticTreeView_DoubleClick(object sender, EventArgs e)
|
||||
{
|
||||
if (availableAlphabeticTreeView.SelectedNode != null &&
|
||||
availableAlphabeticTreeView.SelectedNode.Tag is WMeterRsltItemSpec)
|
||||
{
|
||||
AddItem(availableAlphabeticTreeView.SelectedNode.Tag as WMeterRsltItemSpec);
|
||||
}
|
||||
}
|
||||
|
||||
private void availableByQuantityTreeView_DoubleClick(object sender, EventArgs e)
|
||||
{
|
||||
if (availableByQuantityTreeView.SelectedNode != null &&
|
||||
availableByQuantityTreeView.SelectedNode.Tag is WMeterRsltItemSpec)
|
||||
{
|
||||
AddItem(availableByQuantityTreeView.SelectedNode.Tag as WMeterRsltItemSpec);
|
||||
}
|
||||
}
|
||||
|
||||
private void availableByCategoryTreeView_DoubleClick(object sender, EventArgs e)
|
||||
{
|
||||
if (availableByCategoryTreeView.SelectedNode != null &&
|
||||
availableByCategoryTreeView.SelectedNode.Tag is WMeterRsltItemSpec)
|
||||
{
|
||||
AddItem(availableByCategoryTreeView.SelectedNode.Tag as WMeterRsltItemSpec);
|
||||
}
|
||||
}
|
||||
|
||||
void AddItem(WMeterRsltItemSpec item)
|
||||
{
|
||||
WMeterRsltItemSpec 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 selectedResultsListBox_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)
|
||||
void okButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void ResultsConfigDlg_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;
|
||||
}
|
||||
|
||||
WMeterRsltItemSpec 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;
|
||||
}
|
||||
|
||||
WMeterRsltItemSpec 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 tabPage1_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void availableByCategoryTreeView_NodeMouseHover(object sender, TreeNodeMouseHoverEventArgs e)
|
||||
{
|
||||
ToolTip toolTip = new ToolTip();
|
||||
toolTip.SetToolTip(this, e.Node.ToolTipText);
|
||||
}
|
||||
private void ResultsConfigDlg_KeyPress(object sender, KeyPressEventArgs e)
|
||||
{
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
227
Results/Forms/ResultsConfigDlg.designer.cs
generated
227
Results/Forms/ResultsConfigDlg.designer.cs
generated
@ -31,36 +31,17 @@ namespace Results.Forms
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.okButton = new System.Windows.Forms.Button();
|
||||
this.cancelButton = new System.Windows.Forms.Button();
|
||||
this.availableResultsLabel = new System.Windows.Forms.Label();
|
||||
this.selectedResultsLabel = new System.Windows.Forms.Label();
|
||||
this.removeAllButton = new System.Windows.Forms.Button();
|
||||
this.removeButton = new System.Windows.Forms.Button();
|
||||
this.addButton = new System.Windows.Forms.Button();
|
||||
this.upButton = new System.Windows.Forms.Button();
|
||||
this.downButton = new System.Windows.Forms.Button();
|
||||
this.availableTabControl = new System.Windows.Forms.TabControl();
|
||||
this.tabPage1 = new System.Windows.Forms.TabPage();
|
||||
this.availableAlphabeticTreeView = new System.Windows.Forms.TreeView();
|
||||
this.tabPage2 = new System.Windows.Forms.TabPage();
|
||||
this.availableByQuantityTreeView = new System.Windows.Forms.TreeView();
|
||||
this.tabPage3 = new System.Windows.Forms.TabPage();
|
||||
this.availableByCategoryTreeView = new System.Windows.Forms.TreeView();
|
||||
this.selectedResultsListViewEx = new Results.Forms.ListViewEx();
|
||||
this.availableTabControl.SuspendLayout();
|
||||
this.tabPage1.SuspendLayout();
|
||||
this.tabPage2.SuspendLayout();
|
||||
this.tabPage3.SuspendLayout();
|
||||
this.resultsConfigCtrl = new Results.Forms.ResultsConfigCtrl();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// okButton
|
||||
//
|
||||
this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.okButton.Location = new System.Drawing.Point(373, 499);
|
||||
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, 30);
|
||||
this.okButton.Size = new System.Drawing.Size(105, 42);
|
||||
this.okButton.TabIndex = 4;
|
||||
this.okButton.Text = "OK";
|
||||
this.okButton.UseVisualStyleBackColor = true;
|
||||
@ -68,186 +49,29 @@ namespace Results.Forms
|
||||
//
|
||||
// cancelButton
|
||||
//
|
||||
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
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(494, 499);
|
||||
this.cancelButton.Location = new System.Drawing.Point(939, 82);
|
||||
this.cancelButton.Name = "cancelButton";
|
||||
this.cancelButton.Size = new System.Drawing.Size(105, 30);
|
||||
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);
|
||||
//
|
||||
// availableResultsLabel
|
||||
// resultsConfigCtrl
|
||||
//
|
||||
this.availableResultsLabel.AutoSize = true;
|
||||
this.availableResultsLabel.Location = new System.Drawing.Point(12, 9);
|
||||
this.availableResultsLabel.Name = "availableResultsLabel";
|
||||
this.availableResultsLabel.Size = new System.Drawing.Size(86, 13);
|
||||
this.availableResultsLabel.TabIndex = 8;
|
||||
this.availableResultsLabel.Text = "Available results:";
|
||||
//
|
||||
// selectedResultsLabel
|
||||
//
|
||||
this.selectedResultsLabel.AutoSize = true;
|
||||
this.selectedResultsLabel.Location = new System.Drawing.Point(284, 9);
|
||||
this.selectedResultsLabel.Name = "selectedResultsLabel";
|
||||
this.selectedResultsLabel.Size = new System.Drawing.Size(85, 13);
|
||||
this.selectedResultsLabel.TabIndex = 9;
|
||||
this.selectedResultsLabel.Text = "Selected results:";
|
||||
//
|
||||
// removeAllButton
|
||||
//
|
||||
this.removeAllButton.Location = new System.Drawing.Point(218, 221);
|
||||
this.removeAllButton.Name = "removeAllButton";
|
||||
this.removeAllButton.Size = new System.Drawing.Size(94, 30);
|
||||
this.removeAllButton.TabIndex = 46;
|
||||
this.removeAllButton.Text = "<< R&emove all";
|
||||
this.removeAllButton.UseVisualStyleBackColor = true;
|
||||
this.removeAllButton.Click += new System.EventHandler(this.removeAllButton_Click);
|
||||
//
|
||||
// removeButton
|
||||
//
|
||||
this.removeButton.Location = new System.Drawing.Point(218, 186);
|
||||
this.removeButton.Name = "removeButton";
|
||||
this.removeButton.Size = new System.Drawing.Size(93, 30);
|
||||
this.removeButton.TabIndex = 45;
|
||||
this.removeButton.Text = "< &Remove";
|
||||
this.removeButton.UseVisualStyleBackColor = true;
|
||||
this.removeButton.Click += new System.EventHandler(this.removeButton_Click);
|
||||
//
|
||||
// addButton
|
||||
//
|
||||
this.addButton.Location = new System.Drawing.Point(218, 151);
|
||||
this.addButton.Name = "addButton";
|
||||
this.addButton.Size = new System.Drawing.Size(93, 30);
|
||||
this.addButton.TabIndex = 44;
|
||||
this.addButton.Text = "&Add >";
|
||||
this.addButton.UseVisualStyleBackColor = true;
|
||||
this.addButton.Click += new System.EventHandler(this.addButton_Click);
|
||||
//
|
||||
// upButton
|
||||
//
|
||||
this.upButton.Location = new System.Drawing.Point(218, 313);
|
||||
this.upButton.Name = "upButton";
|
||||
this.upButton.Size = new System.Drawing.Size(93, 30);
|
||||
this.upButton.TabIndex = 48;
|
||||
this.upButton.Text = "Up";
|
||||
this.upButton.UseVisualStyleBackColor = true;
|
||||
this.upButton.Click += new System.EventHandler(this.upButton_Click);
|
||||
//
|
||||
// downButton
|
||||
//
|
||||
this.downButton.Location = new System.Drawing.Point(218, 349);
|
||||
this.downButton.Name = "downButton";
|
||||
this.downButton.Size = new System.Drawing.Size(93, 30);
|
||||
this.downButton.TabIndex = 49;
|
||||
this.downButton.Text = "Down";
|
||||
this.downButton.UseVisualStyleBackColor = true;
|
||||
this.downButton.Click += new System.EventHandler(this.downButton_Click);
|
||||
//
|
||||
// availableTabControl
|
||||
//
|
||||
this.availableTabControl.Controls.Add(this.tabPage1);
|
||||
this.availableTabControl.Controls.Add(this.tabPage2);
|
||||
this.availableTabControl.Controls.Add(this.tabPage3);
|
||||
this.availableTabControl.Location = new System.Drawing.Point(6, 31);
|
||||
this.availableTabControl.Name = "availableTabControl";
|
||||
this.availableTabControl.SelectedIndex = 0;
|
||||
this.availableTabControl.Size = new System.Drawing.Size(206, 453);
|
||||
this.availableTabControl.TabIndex = 50;
|
||||
//
|
||||
// tabPage1
|
||||
//
|
||||
this.tabPage1.Controls.Add(this.availableAlphabeticTreeView);
|
||||
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;
|
||||
this.tabPage1.Click += new System.EventHandler(this.tabPage1_Click);
|
||||
//
|
||||
// availableAlphabeticTreeView
|
||||
//
|
||||
this.availableAlphabeticTreeView.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.availableAlphabeticTreeView.Location = new System.Drawing.Point(3, 3);
|
||||
this.availableAlphabeticTreeView.Name = "availableAlphabeticTreeView";
|
||||
this.availableAlphabeticTreeView.Size = new System.Drawing.Size(192, 421);
|
||||
this.availableAlphabeticTreeView.TabIndex = 0;
|
||||
this.availableAlphabeticTreeView.DoubleClick += new System.EventHandler(this.availableAlphabeticTreeView_DoubleClick);
|
||||
//
|
||||
// tabPage2
|
||||
//
|
||||
this.tabPage2.Controls.Add(this.availableByQuantityTreeView);
|
||||
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;
|
||||
//
|
||||
// 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);
|
||||
//
|
||||
// tabPage3
|
||||
//
|
||||
this.tabPage3.Controls.Add(this.availableByCategoryTreeView);
|
||||
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;
|
||||
//
|
||||
// availableByCategoryTreeView
|
||||
//
|
||||
this.availableByCategoryTreeView.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.availableByCategoryTreeView.Location = new System.Drawing.Point(0, 0);
|
||||
this.availableByCategoryTreeView.Name = "availableByCategoryTreeView";
|
||||
this.availableByCategoryTreeView.Size = new System.Drawing.Size(198, 427);
|
||||
this.availableByCategoryTreeView.TabIndex = 0;
|
||||
this.availableByCategoryTreeView.NodeMouseHover += new System.Windows.Forms.TreeNodeMouseHoverEventHandler(this.availableByCategoryTreeView_NodeMouseHover);
|
||||
this.availableByCategoryTreeView.DoubleClick += new System.EventHandler(this.availableByCategoryTreeView_DoubleClick);
|
||||
//
|
||||
// selectedResultsListViewEx
|
||||
//
|
||||
this.selectedResultsListViewEx.AllowColumnReorder = true;
|
||||
this.selectedResultsListViewEx.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.selectedResultsListViewEx.DoubleClickActivation = false;
|
||||
this.selectedResultsListViewEx.FullRowSelect = true;
|
||||
this.selectedResultsListViewEx.Location = new System.Drawing.Point(317, 31);
|
||||
this.selectedResultsListViewEx.Name = "selectedResultsListViewEx";
|
||||
this.selectedResultsListViewEx.Size = new System.Drawing.Size(594, 453);
|
||||
this.selectedResultsListViewEx.TabIndex = 47;
|
||||
this.selectedResultsListViewEx.UseCompatibleStateImageBehavior = false;
|
||||
this.selectedResultsListViewEx.View = System.Windows.Forms.View.Details;
|
||||
this.selectedResultsListViewEx.SubItemClicked += new Results.Forms.SubItemEventHandler(this.selectedResultsListViewEx_SubItemClicked);
|
||||
this.selectedResultsListViewEx.SubItemEndEditing += new Results.Forms.SubItemEndEditingEventHandler(this.selectedResultsListViewEx_SubItemEndEditing);
|
||||
this.resultsConfigCtrl.Location = new System.Drawing.Point(-1, 1);
|
||||
this.resultsConfigCtrl.Name = "resultsConfigCtrl";
|
||||
this.resultsConfigCtrl.Size = new System.Drawing.Size(925, 496);
|
||||
this.resultsConfigCtrl.TabIndex = 6;
|
||||
//
|
||||
// ResultsConfigDlg
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(923, 543);
|
||||
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.selectedResultsLabel);
|
||||
this.Controls.Add(this.availableResultsLabel);
|
||||
this.ClientSize = new System.Drawing.Size(1066, 498);
|
||||
this.Controls.Add(this.resultsConfigCtrl);
|
||||
this.Controls.Add(this.cancelButton);
|
||||
this.Controls.Add(this.okButton);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||
@ -257,33 +81,14 @@ namespace Results.Forms
|
||||
this.Text = "ResultsConfig";
|
||||
this.Load += new System.EventHandler(this.ResultsConfig_Load);
|
||||
this.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.ResultsConfigDlg_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.Button okButton;
|
||||
private System.Windows.Forms.Button cancelButton;
|
||||
private System.Windows.Forms.Label availableResultsLabel;
|
||||
private System.Windows.Forms.Label selectedResultsLabel;
|
||||
private System.Windows.Forms.Button removeAllButton;
|
||||
private System.Windows.Forms.Button removeButton;
|
||||
private System.Windows.Forms.Button addButton;
|
||||
private ListViewEx selectedResultsListViewEx;
|
||||
private System.Windows.Forms.Button upButton;
|
||||
private System.Windows.Forms.Button downButton;
|
||||
private System.Windows.Forms.TabControl availableTabControl;
|
||||
private System.Windows.Forms.TabPage tabPage1;
|
||||
private System.Windows.Forms.TabPage tabPage2;
|
||||
private System.Windows.Forms.TreeView availableAlphabeticTreeView;
|
||||
private System.Windows.Forms.TreeView availableByQuantityTreeView;
|
||||
private System.Windows.Forms.TabPage tabPage3;
|
||||
private System.Windows.Forms.TreeView availableByCategoryTreeView;
|
||||
private System.Windows.Forms.Button cancelButton;
|
||||
private ResultsConfigCtrl resultsConfigCtrl;
|
||||
}
|
||||
}
|
||||
@ -117,7 +117,4 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
||||
@ -77,6 +77,12 @@
|
||||
<Compile Include="Forms\ListViewEx.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Forms\ResultsConfigCtrl.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Forms\ResultsConfigCtrl.Designer.cs">
|
||||
<DependentUpon>ResultsConfigCtrl.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Forms\ResultsConfigDlg.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
@ -137,6 +143,9 @@
|
||||
<EmbeddedResource Include="Forms\ListViewEx.resx">
|
||||
<DependentUpon>ListViewEx.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\ResultsConfigCtrl.resx">
|
||||
<DependentUpon>ResultsConfigCtrl.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\ResultsConfigDlg.resx">
|
||||
<DependentUpon>ResultsConfigDlg.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
||||
@ -226,11 +226,8 @@ namespace TBF.BenchControl.Output.FileWriters.Basic
|
||||
{
|
||||
MetersKind = config.MetersKind,
|
||||
SelectedItems = Results.WMeterRsltItemSpec.FromStrArray(selectedItems),
|
||||
AvailableItems = new List<Results.WMeterRsltItemSpec>()
|
||||
};
|
||||
|
||||
foreach (var v in Results.WMeterRsltItemSpec.AllItems) dlg.AvailableItems.Add(v);
|
||||
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
selectedItems = Results.WMeterRsltItemSpec.ToStrArray(dlg.SelectedItems);
|
||||
|
||||
@ -289,11 +289,8 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
{
|
||||
MetersKind = config.MetersKind,
|
||||
SelectedItems = Results.WMeterRsltItemSpec.FromStrArray(commonItems),
|
||||
AvailableItems = new List<Results.WMeterRsltItemSpec>()
|
||||
};
|
||||
|
||||
foreach (var v in Results.WMeterRsltItemSpec.AllItems) dlg.AvailableItems.Add(v);
|
||||
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
commonItems = Results.WMeterRsltItemSpec.ToStrArray(dlg.SelectedItems);
|
||||
@ -306,11 +303,8 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
{
|
||||
MetersKind = config.MetersKind,
|
||||
SelectedItems = Results.WMeterRsltItemSpec.FromStrArray(testItems),
|
||||
AvailableItems = new List<Results.WMeterRsltItemSpec>()
|
||||
};
|
||||
|
||||
foreach (var v in Results.WMeterRsltItemSpec.AllItems) dlg.AvailableItems.Add(v);
|
||||
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
testItems = Results.WMeterRsltItemSpec.ToStrArray(dlg.SelectedItems);
|
||||
|
||||
@ -284,11 +284,8 @@ namespace TBF.BenchControl.Output.FileWriters.Xml
|
||||
{
|
||||
MetersKind = config.MetersKind,
|
||||
SelectedItems = Results.WMeterRsltItemSpec.FromStrArray(commonItems),
|
||||
AvailableItems = new List<Results.WMeterRsltItemSpec>()
|
||||
};
|
||||
|
||||
foreach (var v in Results.WMeterRsltItemSpec.AllItems) dlg.AvailableItems.Add(v);
|
||||
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
commonItems = Results.WMeterRsltItemSpec.ToStrArray(dlg.SelectedItems);
|
||||
@ -301,11 +298,8 @@ namespace TBF.BenchControl.Output.FileWriters.Xml
|
||||
{
|
||||
MetersKind = config.MetersKind,
|
||||
SelectedItems = Results.WMeterRsltItemSpec.FromStrArray(testItems),
|
||||
AvailableItems = new List<Results.WMeterRsltItemSpec>()
|
||||
};
|
||||
|
||||
foreach (var v in Results.WMeterRsltItemSpec.AllItems) dlg.AvailableItems.Add(v);
|
||||
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
testItems = Results.WMeterRsltItemSpec.ToStrArray(dlg.SelectedItems);
|
||||
|
||||
@ -233,11 +233,8 @@ namespace TBF.BenchControl.Output.Printers.Enhanced
|
||||
{
|
||||
MetersKind = config.MetersKind,
|
||||
SelectedItems = Results.WMeterRsltItemSpec.FromStrArray(commonItems),
|
||||
AvailableItems = new List<Results.WMeterRsltItemSpec>()
|
||||
};
|
||||
|
||||
foreach (var v in Results.WMeterRsltItemSpec.AllItems) dlg.AvailableItems.Add(v);
|
||||
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
commonItems = Results.WMeterRsltItemSpec.ToStrArray(dlg.SelectedItems);
|
||||
@ -250,11 +247,8 @@ namespace TBF.BenchControl.Output.Printers.Enhanced
|
||||
{
|
||||
MetersKind = config.MetersKind,
|
||||
SelectedItems = Results.WMeterRsltItemSpec.FromStrArray(testItems),
|
||||
AvailableItems = new List<Results.WMeterRsltItemSpec>()
|
||||
};
|
||||
|
||||
foreach (var v in Results.WMeterRsltItemSpec.AllItems) dlg.AvailableItems.Add(v);
|
||||
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
testItems = Results.WMeterRsltItemSpec.ToStrArray(dlg.SelectedItems);
|
||||
|
||||
@ -42,13 +42,9 @@ namespace TBF.Forms
|
||||
this.okButton = new System.Windows.Forms.Button();
|
||||
this.cancelButton = new System.Windows.Forms.Button();
|
||||
this.unlockButton = new System.Windows.Forms.Button();
|
||||
this.singleRadioButton = new System.Windows.Forms.RadioButton();
|
||||
this.combinedRadioButton = new System.Windows.Forms.RadioButton();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.heatRadioButton = new System.Windows.Forms.RadioButton();
|
||||
this.resultsConfigCtrl = new Results.Forms.ResultsConfigCtrl();
|
||||
this.testsArangementGroupBox.SuspendLayout();
|
||||
this.metersArangementGroupBox.SuspendLayout();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// testsRowsRadioButton
|
||||
@ -79,9 +75,9 @@ namespace TBF.Forms
|
||||
//
|
||||
this.testsArangementGroupBox.Controls.Add(this.testsColumnsRadioButton);
|
||||
this.testsArangementGroupBox.Controls.Add(this.testsRowsRadioButton);
|
||||
this.testsArangementGroupBox.Location = new System.Drawing.Point(12, 86);
|
||||
this.testsArangementGroupBox.Location = new System.Drawing.Point(14, 12);
|
||||
this.testsArangementGroupBox.Name = "testsArangementGroupBox";
|
||||
this.testsArangementGroupBox.Size = new System.Drawing.Size(254, 70);
|
||||
this.testsArangementGroupBox.Size = new System.Drawing.Size(305, 70);
|
||||
this.testsArangementGroupBox.TabIndex = 2;
|
||||
this.testsArangementGroupBox.TabStop = false;
|
||||
this.testsArangementGroupBox.Text = "Arangement of tests";
|
||||
@ -92,16 +88,17 @@ namespace TBF.Forms
|
||||
this.metersArangementGroupBox.Controls.Add(this.nrMetersLabel);
|
||||
this.metersArangementGroupBox.Controls.Add(this.verticallyRadioButton);
|
||||
this.metersArangementGroupBox.Controls.Add(this.horizontallyRadioButton);
|
||||
this.metersArangementGroupBox.Location = new System.Drawing.Point(12, 161);
|
||||
this.metersArangementGroupBox.Location = new System.Drawing.Point(325, 12);
|
||||
this.metersArangementGroupBox.Name = "metersArangementGroupBox";
|
||||
this.metersArangementGroupBox.Size = new System.Drawing.Size(254, 70);
|
||||
this.metersArangementGroupBox.Size = new System.Drawing.Size(593, 70);
|
||||
this.metersArangementGroupBox.TabIndex = 3;
|
||||
this.metersArangementGroupBox.TabStop = false;
|
||||
this.metersArangementGroupBox.Text = "Arangement of tested meters";
|
||||
//
|
||||
// nrMetersTextBox
|
||||
//
|
||||
this.nrMetersTextBox.Location = new System.Drawing.Point(169, 40);
|
||||
this.nrMetersTextBox.Enabled = false;
|
||||
this.nrMetersTextBox.Location = new System.Drawing.Point(409, 23);
|
||||
this.nrMetersTextBox.Name = "nrMetersTextBox";
|
||||
this.nrMetersTextBox.Size = new System.Drawing.Size(41, 20);
|
||||
this.nrMetersTextBox.TabIndex = 5;
|
||||
@ -109,7 +106,7 @@ namespace TBF.Forms
|
||||
// nrMetersLabel
|
||||
//
|
||||
this.nrMetersLabel.AutoSize = true;
|
||||
this.nrMetersLabel.Location = new System.Drawing.Point(138, 23);
|
||||
this.nrMetersLabel.Location = new System.Drawing.Point(263, 23);
|
||||
this.nrMetersLabel.Name = "nrMetersLabel";
|
||||
this.nrMetersLabel.Size = new System.Drawing.Size(108, 13);
|
||||
this.nrMetersLabel.TabIndex = 4;
|
||||
@ -141,7 +138,8 @@ namespace TBF.Forms
|
||||
//
|
||||
// okButton
|
||||
//
|
||||
this.okButton.Location = new System.Drawing.Point(283, 57);
|
||||
this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.okButton.Location = new System.Drawing.Point(937, 57);
|
||||
this.okButton.Name = "okButton";
|
||||
this.okButton.Size = new System.Drawing.Size(104, 30);
|
||||
this.okButton.TabIndex = 4;
|
||||
@ -151,8 +149,9 @@ namespace TBF.Forms
|
||||
//
|
||||
// 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(283, 94);
|
||||
this.cancelButton.Location = new System.Drawing.Point(937, 94);
|
||||
this.cancelButton.Name = "cancelButton";
|
||||
this.cancelButton.Size = new System.Drawing.Size(104, 30);
|
||||
this.cancelButton.TabIndex = 5;
|
||||
@ -162,7 +161,8 @@ namespace TBF.Forms
|
||||
//
|
||||
// unlockButton
|
||||
//
|
||||
this.unlockButton.Location = new System.Drawing.Point(283, 21);
|
||||
this.unlockButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.unlockButton.Location = new System.Drawing.Point(937, 21);
|
||||
this.unlockButton.Name = "unlockButton";
|
||||
this.unlockButton.Size = new System.Drawing.Size(104, 30);
|
||||
this.unlockButton.TabIndex = 47;
|
||||
@ -170,55 +170,13 @@ namespace TBF.Forms
|
||||
this.unlockButton.UseVisualStyleBackColor = true;
|
||||
this.unlockButton.Click += new System.EventHandler(this.unlockButton_Click);
|
||||
//
|
||||
// singleRadioButton
|
||||
// resultsConfigCtrl
|
||||
//
|
||||
this.singleRadioButton.Appearance = System.Windows.Forms.Appearance.Button;
|
||||
this.singleRadioButton.AutoSize = true;
|
||||
this.singleRadioButton.Checked = true;
|
||||
this.singleRadioButton.Location = new System.Drawing.Point(18, 24);
|
||||
this.singleRadioButton.Name = "singleRadioButton";
|
||||
this.singleRadioButton.Size = new System.Drawing.Size(46, 23);
|
||||
this.singleRadioButton.TabIndex = 48;
|
||||
this.singleRadioButton.TabStop = true;
|
||||
this.singleRadioButton.Text = "Single";
|
||||
this.singleRadioButton.UseVisualStyleBackColor = true;
|
||||
this.singleRadioButton.CheckedChanged += new System.EventHandler(this.singleRadioButton_CheckedChanged);
|
||||
//
|
||||
// combinedRadioButton
|
||||
//
|
||||
this.combinedRadioButton.Appearance = System.Windows.Forms.Appearance.Button;
|
||||
this.combinedRadioButton.AutoSize = true;
|
||||
this.combinedRadioButton.Location = new System.Drawing.Point(86, 24);
|
||||
this.combinedRadioButton.Name = "combinedRadioButton";
|
||||
this.combinedRadioButton.Size = new System.Drawing.Size(64, 23);
|
||||
this.combinedRadioButton.TabIndex = 49;
|
||||
this.combinedRadioButton.Text = "Combined";
|
||||
this.combinedRadioButton.UseVisualStyleBackColor = true;
|
||||
this.combinedRadioButton.CheckedChanged += new System.EventHandler(this.combinedRadioButton_CheckedChanged);
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
this.groupBox1.Controls.Add(this.heatRadioButton);
|
||||
this.groupBox1.Controls.Add(this.combinedRadioButton);
|
||||
this.groupBox1.Controls.Add(this.singleRadioButton);
|
||||
this.groupBox1.Location = new System.Drawing.Point(12, 12);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Size = new System.Drawing.Size(254, 60);
|
||||
this.groupBox1.TabIndex = 52;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "Water Meter";
|
||||
//
|
||||
// heatRadioButton
|
||||
//
|
||||
this.heatRadioButton.Appearance = System.Windows.Forms.Appearance.Button;
|
||||
this.heatRadioButton.AutoSize = true;
|
||||
this.heatRadioButton.Location = new System.Drawing.Point(170, 24);
|
||||
this.heatRadioButton.Name = "heatRadioButton";
|
||||
this.heatRadioButton.Size = new System.Drawing.Size(40, 23);
|
||||
this.heatRadioButton.TabIndex = 50;
|
||||
this.heatRadioButton.Text = "Heat";
|
||||
this.heatRadioButton.UseVisualStyleBackColor = true;
|
||||
this.heatRadioButton.CheckedChanged += new System.EventHandler(this.heatRadioButton_CheckedChanged);
|
||||
this.resultsConfigCtrl.Location = new System.Drawing.Point(3, 85);
|
||||
this.resultsConfigCtrl.Name = "resultsConfigCtrl";
|
||||
this.resultsConfigCtrl.Size = new System.Drawing.Size(925, 496);
|
||||
this.resultsConfigCtrl.TabIndex = 53;
|
||||
this.resultsConfigCtrl.Unlocked = false;
|
||||
//
|
||||
// ResultsArrangementDlg
|
||||
//
|
||||
@ -226,8 +184,8 @@ namespace TBF.Forms
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.CancelButton = this.cancelButton;
|
||||
this.ClientSize = new System.Drawing.Size(399, 243);
|
||||
this.Controls.Add(this.groupBox1);
|
||||
this.ClientSize = new System.Drawing.Size(1056, 579);
|
||||
this.Controls.Add(this.resultsConfigCtrl);
|
||||
this.Controls.Add(this.unlockButton);
|
||||
this.Controls.Add(this.cancelButton);
|
||||
this.Controls.Add(this.okButton);
|
||||
@ -241,8 +199,6 @@ namespace TBF.Forms
|
||||
this.testsArangementGroupBox.PerformLayout();
|
||||
this.metersArangementGroupBox.ResumeLayout(false);
|
||||
this.metersArangementGroupBox.PerformLayout();
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
this.groupBox1.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
@ -258,11 +214,8 @@ namespace TBF.Forms
|
||||
private System.Windows.Forms.Button okButton;
|
||||
private System.Windows.Forms.Button cancelButton;
|
||||
private System.Windows.Forms.Button unlockButton;
|
||||
private System.Windows.Forms.RadioButton singleRadioButton;
|
||||
private System.Windows.Forms.RadioButton combinedRadioButton;
|
||||
private System.Windows.Forms.GroupBox groupBox1;
|
||||
private System.Windows.Forms.TextBox nrMetersTextBox;
|
||||
private System.Windows.Forms.Label nrMetersLabel;
|
||||
private System.Windows.Forms.RadioButton heatRadioButton;
|
||||
private Results.Forms.ResultsConfigCtrl resultsConfigCtrl;
|
||||
}
|
||||
}
|
||||
@ -2,8 +2,10 @@
|
||||
/// Copyright (c) 2013-2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
using Config.Entities;
|
||||
using Results;
|
||||
using TBF.Resources;
|
||||
|
||||
namespace TBF.Forms
|
||||
@ -15,26 +17,41 @@ namespace TBF.Forms
|
||||
/// </summary>
|
||||
const Users.Grp.GID RequiredGroupMembership = Users.Grp.GID.Metrologists;
|
||||
|
||||
public bool Unlocked; /// true = changes enabled
|
||||
|
||||
public TestsArrangement TestsArrangement;
|
||||
public MetersArrangement MetersArrangement;
|
||||
public int NrMetersInOneGroup;
|
||||
public bool Unlocked; /// true = changes enabled
|
||||
|
||||
public IList<WMeterRsltItemSpec> SelectedItems
|
||||
{
|
||||
set { resultsConfigCtrl.SelectedItems = value; }
|
||||
get { return resultsConfigCtrl.SelectedItems; }
|
||||
}
|
||||
|
||||
public MetersKind MetersKind
|
||||
{
|
||||
set
|
||||
{
|
||||
resultsConfigCtrl.MetersKind = mtrsKind = value;
|
||||
Text = string.Format("{0} ({1})", Strings.Configuration, mtrsKind.ToDescription());
|
||||
}
|
||||
}
|
||||
|
||||
MetersKind mtrsKind;
|
||||
|
||||
|
||||
public ResultsArrangementDlg(MetersKind mtrsKind)
|
||||
public ResultsArrangementDlg()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
this.mtrsKind = mtrsKind;
|
||||
Unlocked = false;
|
||||
cancelButton.Visible = false;
|
||||
}
|
||||
|
||||
void Localize()
|
||||
{
|
||||
Text = Strings.Configuration;
|
||||
Text = string.Format("{0} ({1})", Strings.Configuration, mtrsKind.ToDescription());
|
||||
testsArangementGroupBox.Text = Strings.Arrangement_of_tests;
|
||||
metersArangementGroupBox.Text = Strings.Arrangement_of_meters;
|
||||
testsRowsRadioButton.Text = Strings.Tests_are_rows;
|
||||
@ -42,9 +59,6 @@ namespace TBF.Forms
|
||||
horizontallyRadioButton.Text = Strings.Horizontally;
|
||||
verticallyRadioButton.Text = Strings.Vertically;
|
||||
nrMetersLabel.Text = Strings.Nr_meters_in_a_group;
|
||||
groupBox1.Text = Strings.Water_Meter;
|
||||
singleRadioButton.Text = Strings.SingleBtnText;
|
||||
combinedRadioButton.Text = Strings.Compound;
|
||||
unlockButton.Text = Strings.UnlockBtnText;
|
||||
okButton.Text = Strings.CloseBtnText;
|
||||
cancelButton.Text = Strings.CancelBtnText;
|
||||
@ -54,10 +68,6 @@ namespace TBF.Forms
|
||||
{
|
||||
Localize();
|
||||
|
||||
singleRadioButton.Checked = (mtrsKind == MetersKind.Single);
|
||||
combinedRadioButton.Checked = (mtrsKind == MetersKind.Combined);
|
||||
heatRadioButton.Checked = (mtrsKind == MetersKind.HeatMeter);
|
||||
|
||||
testsRowsRadioButton.Checked = (TestsArrangement == TestsArrangement.Rows);
|
||||
testsColumnsRadioButton.Checked = (TestsArrangement == TestsArrangement.Columns);
|
||||
|
||||
@ -95,6 +105,8 @@ namespace TBF.Forms
|
||||
testsColumnsRadioButton.Enabled = true;
|
||||
verticallyRadioButton.Enabled = true;
|
||||
horizontallyRadioButton.Enabled = true;
|
||||
nrMetersTextBox.Enabled = true;
|
||||
resultsConfigCtrl.Unlocked = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -115,24 +127,5 @@ namespace TBF.Forms
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get 'mtrsKind' value from radio buttons
|
||||
/// </summary>
|
||||
/// <returns>true on 'mtrsKind' change</returns>
|
||||
private bool GetMtrsKindFromRadioButtons()
|
||||
{
|
||||
MetersKind ori = mtrsKind;
|
||||
|
||||
if (singleRadioButton.Checked) mtrsKind = MetersKind.Single;
|
||||
else if (combinedRadioButton.Checked) mtrsKind = MetersKind.Combined;
|
||||
else if (heatRadioButton.Checked) mtrsKind = MetersKind.HeatMeter;
|
||||
|
||||
return (mtrsKind != ori);
|
||||
}
|
||||
|
||||
private void singleRadioButton_CheckedChanged(object sender, EventArgs e) { GetMtrsKindFromRadioButtons(); }
|
||||
private void combinedRadioButton_CheckedChanged(object sender, EventArgs e) { GetMtrsKindFromRadioButtons(); }
|
||||
private void heatRadioButton_CheckedChanged(object sender, EventArgs e) { GetMtrsKindFromRadioButtons(); }
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -97,62 +97,62 @@ namespace TBF.Screens
|
||||
RedrawAll(TBF.BenchControl.Sequences.ProcessData.BatchRslts);
|
||||
}
|
||||
|
||||
|
||||
IList<Results.WMeterRsltItemSpec> GetRsltItems(MetersKind metersKind)
|
||||
{
|
||||
IList<Results.WMeterRsltItemSpec> srcItems;
|
||||
switch (metersKind)
|
||||
{
|
||||
default:
|
||||
case MetersKind.Single: srcItems = RsltItems_Screen_SingleWM; break;
|
||||
case MetersKind.Combined: srcItems = RsltItems_Screen_CombinedWM; break;
|
||||
case MetersKind.HeatMeter: srcItems = RsltItems_Screen_HeatM; break;
|
||||
}
|
||||
|
||||
IList<Results.WMeterRsltItemSpec> copiedItems = new List<Results.WMeterRsltItemSpec>();
|
||||
foreach (var it in srcItems) copiedItems.Add(it.Clone());
|
||||
return copiedItems;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Invoke a configuration dialog
|
||||
/// </summary>
|
||||
private void configureButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
TBF.Forms.ResultsArrangementDlg arrDlg = new TBF.Forms.ResultsArrangementDlg(metersKind);
|
||||
TBF.Forms.ResultsArrangementDlg dlg = new TBF.Forms.ResultsArrangementDlg();
|
||||
|
||||
arrDlg.TestsArrangement = TestsArrangement;
|
||||
arrDlg.MetersArrangement = MetersArrangement;
|
||||
arrDlg.NrMetersInOneGroup = NrMetersInOneGroup;
|
||||
dlg.MetersKind = metersKind;
|
||||
dlg.TestsArrangement = TestsArrangement;
|
||||
dlg.MetersArrangement = MetersArrangement;
|
||||
dlg.NrMetersInOneGroup = NrMetersInOneGroup;
|
||||
dlg.SelectedItems = GetRsltItems(metersKind);
|
||||
|
||||
DialogResult dr = arrDlg.ShowDialog();
|
||||
if (dr == DialogResult.OK && arrDlg.Unlocked)
|
||||
DialogResult dr = dlg.ShowDialog();
|
||||
if (dr == DialogResult.OK && dlg.Unlocked)
|
||||
{
|
||||
Program.LocalSettings.ResultsConfigMeters = MetersArrangement = arrDlg.MetersArrangement;;
|
||||
Program.LocalSettings.ResultsConfigTests = TestsArrangement = arrDlg.TestsArrangement;
|
||||
Program.LocalSettings.ResultsConfigMetersInOneGroup = NrMetersInOneGroup = arrDlg.NrMetersInOneGroup;
|
||||
|
||||
Results.Forms.ResultsConfigDlg dlg = new Results.Forms.ResultsConfigDlg(true);
|
||||
dlg.AvailableItems = Results.WMeterRsltItemSpec.AllItems;
|
||||
Program.LocalSettings.ResultsConfigMeters = MetersArrangement = dlg.MetersArrangement;;
|
||||
Program.LocalSettings.ResultsConfigTests = TestsArrangement = dlg.TestsArrangement;
|
||||
Program.LocalSettings.ResultsConfigMetersInOneGroup = NrMetersInOneGroup = dlg.NrMetersInOneGroup;
|
||||
|
||||
switch (metersKind)
|
||||
{
|
||||
default:
|
||||
case MetersKind.Single:
|
||||
dlg.SelectedItems = RsltItems_Screen_SingleWM;
|
||||
RsltItems_Screen_SingleWM = dlg.SelectedItems;
|
||||
Program.LocalSettings.RsltItems_Screen_SingleWM = Results.WMeterRsltItemSpec.ToStrArray(RsltItems_Screen_SingleWM);
|
||||
break;
|
||||
case MetersKind.Combined:
|
||||
dlg.SelectedItems = RsltItems_Screen_CombinedWM;
|
||||
RsltItems_Screen_CombinedWM = dlg.SelectedItems;
|
||||
Program.LocalSettings.RsltItems_Screen_CombinedWM = Results.WMeterRsltItemSpec.ToStrArray(RsltItems_Screen_CombinedWM);
|
||||
break;
|
||||
case MetersKind.HeatMeter:
|
||||
dlg.SelectedItems = RsltItems_Screen_HeatM;
|
||||
RsltItems_Screen_HeatM = dlg.SelectedItems;
|
||||
Program.LocalSettings.RsltItems_Screen_HeatM = Results.WMeterRsltItemSpec.ToStrArray(RsltItems_Screen_HeatM);
|
||||
break;
|
||||
}
|
||||
|
||||
if (DialogResult.OK == dlg.ShowDialog())
|
||||
{
|
||||
switch (metersKind)
|
||||
{
|
||||
default:
|
||||
case MetersKind.Single:
|
||||
RsltItems_Screen_SingleWM = dlg.SelectedItems;
|
||||
break;
|
||||
case MetersKind.Combined:
|
||||
RsltItems_Screen_CombinedWM = dlg.SelectedItems;
|
||||
break;
|
||||
case MetersKind.HeatMeter:
|
||||
RsltItems_Screen_HeatM = dlg.SelectedItems;
|
||||
break;
|
||||
}
|
||||
|
||||
Program.LocalSettings.RsltItems_Screen_SingleWM = Results.WMeterRsltItemSpec.ToStrArray(RsltItems_Screen_SingleWM);
|
||||
Program.LocalSettings.RsltItems_Screen_CombinedWM = Results.WMeterRsltItemSpec.ToStrArray(RsltItems_Screen_CombinedWM);
|
||||
Program.LocalSettings.RsltItems_Screen_HeatM = Results.WMeterRsltItemSpec.ToStrArray(RsltItems_Screen_HeatM);
|
||||
Program.LocalSettings.Save();
|
||||
}
|
||||
Program.LocalSettings.Save();
|
||||
}
|
||||
|
||||
RedrawAll(TBF.BenchControl.Sequences.ProcessData.BatchRslts);
|
||||
@ -299,14 +299,7 @@ namespace TBF.Screens
|
||||
|
||||
ListView lview = GetListView();
|
||||
|
||||
IList<Results.WMeterRsltItemSpec> items;
|
||||
switch (metersKind)
|
||||
{
|
||||
default:
|
||||
case MetersKind.Single: items = RsltItems_Screen_SingleWM; break;
|
||||
case MetersKind.Combined: items = RsltItems_Screen_CombinedWM; break;
|
||||
case MetersKind.HeatMeter: items = RsltItems_Screen_HeatM; break;
|
||||
}
|
||||
IList<Results.WMeterRsltItemSpec> items = GetRsltItems(metersKind);
|
||||
|
||||
if (items == null || items.Count == 0) return lview;
|
||||
|
||||
@ -377,14 +370,8 @@ namespace TBF.Screens
|
||||
|
||||
ListView lview = GetListView();
|
||||
|
||||
IList<Results.WMeterRsltItemSpec> items;
|
||||
switch (metersKind)
|
||||
{
|
||||
default:
|
||||
case MetersKind.Single: items = RsltItems_Screen_SingleWM; break;
|
||||
case MetersKind.Combined: items = RsltItems_Screen_CombinedWM; break;
|
||||
case MetersKind.HeatMeter: items = RsltItems_Screen_HeatM; break;
|
||||
}
|
||||
IList<Results.WMeterRsltItemSpec> items = GetRsltItems(metersKind);
|
||||
|
||||
if (items == null || items.Count == 0) return lview;
|
||||
|
||||
// Header
|
||||
|
||||
Loading…
Reference in New Issue
Block a user