On screen results use new style of configuration, part 2: ResultsConfigCtrl added.

This commit is contained in:
Milan Hanajik
2017-05-24 11:35:34 +02:00
parent b92d9f5a9c
commit 91b750e1a0
15 changed files with 1033 additions and 846 deletions
+23 -70
View File
@@ -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(); }
}
}