Configuration of results: UI also for printer. Formatting float with given # of valid digits
This commit is contained in:
@@ -60,8 +60,8 @@ namespace TBF.Forms
|
||||
AllItems.Add(new ResultItemSpec("Test time", "T [s]", x => x.TestResult.TimeEnd.ToShortTimeString(),
|
||||
(x, y, z) => z.TestResult.TimeEnd.ToShortTimeString()));
|
||||
|
||||
AllItems.Add(new ResultItemSpec("Flow", Strings.Flow_m3h, x => x.TestResult.FlowVolume.ToString("F3"),
|
||||
(x, y, z) => z.TestResult.FlowVolume.ToString("F3")));
|
||||
AllItems.Add(new ResultItemSpec("Flow", Strings.Flow_m3h, x => Utils.FloatToStr(x.TestResult.FlowVolume / 1000.0f, 4),
|
||||
(x, y, z) => Utils.FloatToStr(z.TestResult.FlowVolume / 1000.0f, 4)));
|
||||
|
||||
AllItems.Add(new ResultItemSpec("T in", Strings.T_in, x => x.TestResult.TempInAvrg.ToString("F2"),
|
||||
(x, y, z) => z.TestResult.TempInAvrg.ToString("F2")));
|
||||
@@ -91,11 +91,20 @@ namespace TBF.Forms
|
||||
AllItems.Add(new ResultItemSpec("Passed", "Result", x => (x.Passed ? Strings.Passed : Strings.Failed),
|
||||
(x, y, z) => (z.Passed ? Strings.Passed : Strings.Failed)));
|
||||
|
||||
AllItems.Add(new ResultItemSpec("Serial Nr", "s/n", x => x.SerialNr, (x, y, z) => z.SerialNr));
|
||||
AllItems.Add(new ResultItemSpec("End state", "End state", x => x.EndState, (x, y, z) => z.EndState));
|
||||
|
||||
/// Single water meters only results
|
||||
AllItems.Add(new ResultItemSpec("Pulses", "Pulses", x => x.PulsesMeter.ToString(), null));
|
||||
AllItems.Add(new ResultItemSpec("Reference pulses", "Ref.pulses", x => x.PulsesMaster.ToString(), null));
|
||||
AllItems.Add(new ResultItemSpec("Serial Nr", "s/n", x => x.PulsesMeter.ToString(), null));
|
||||
AllItems.Add(new ResultItemSpec("End state", "End state", x => x.PulsesMeter.ToString(), null));
|
||||
|
||||
/// Combined water meters only results
|
||||
AllItems.Add(new ResultItemSpec("Error large WM", "Error-L [%]", null, (x, y, z) => x.VolumeErrorPct.ToString("F2")));
|
||||
AllItems.Add(new ResultItemSpec("Error small WM", "Error-S [%]", null, (x, y, z) => y.VolumeErrorPct.ToString("F2")));
|
||||
AllItems.Add(new ResultItemSpec("Serial Nr large WM", "s/n", null, (x, y, z) => x.SerialNr));
|
||||
AllItems.Add(new ResultItemSpec("Serial Nr small WM", "s/n", null, (x, y, z) => y.SerialNr));
|
||||
AllItems.Add(new ResultItemSpec("End state large WM", "End state", null, (x, y, z) => x.EndState));
|
||||
AllItems.Add(new ResultItemSpec("End state small WM", "End state", null, (x, y, z) => y.EndState));
|
||||
}
|
||||
|
||||
public static ResultItemSpec GetItem(string name)
|
||||
|
||||
+76
-15
@@ -46,8 +46,14 @@
|
||||
this.unlockButton = new System.Windows.Forms.Button();
|
||||
this.singleRadioButton = new System.Windows.Forms.RadioButton();
|
||||
this.combinedRadioButton = new System.Windows.Forms.RadioButton();
|
||||
this.screenRadioButton = new System.Windows.Forms.RadioButton();
|
||||
this.printerRadioButton = new System.Windows.Forms.RadioButton();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||
this.testsArangementGroupBox.SuspendLayout();
|
||||
this.metersArangementGroupBox.SuspendLayout();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.groupBox2.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// testsRowsRadioButton
|
||||
@@ -145,9 +151,9 @@
|
||||
//
|
||||
this.availableResultsListBox.Enabled = false;
|
||||
this.availableResultsListBox.FormattingEnabled = true;
|
||||
this.availableResultsListBox.Location = new System.Drawing.Point(12, 246);
|
||||
this.availableResultsListBox.Location = new System.Drawing.Point(12, 272);
|
||||
this.availableResultsListBox.Name = "availableResultsListBox";
|
||||
this.availableResultsListBox.Size = new System.Drawing.Size(135, 160);
|
||||
this.availableResultsListBox.Size = new System.Drawing.Size(135, 186);
|
||||
this.availableResultsListBox.TabIndex = 6;
|
||||
this.availableResultsListBox.DoubleClick += new System.EventHandler(this.availableResultsListBox_DoubleClick);
|
||||
//
|
||||
@@ -155,16 +161,16 @@
|
||||
//
|
||||
this.selectedResultsListBox.Enabled = false;
|
||||
this.selectedResultsListBox.FormattingEnabled = true;
|
||||
this.selectedResultsListBox.Location = new System.Drawing.Point(252, 246);
|
||||
this.selectedResultsListBox.Location = new System.Drawing.Point(252, 272);
|
||||
this.selectedResultsListBox.Name = "selectedResultsListBox";
|
||||
this.selectedResultsListBox.Size = new System.Drawing.Size(135, 160);
|
||||
this.selectedResultsListBox.Size = new System.Drawing.Size(135, 186);
|
||||
this.selectedResultsListBox.TabIndex = 7;
|
||||
this.selectedResultsListBox.DoubleClick += new System.EventHandler(this.selectedResultsListBox_DoubleClick);
|
||||
//
|
||||
// availableResultsLabel
|
||||
//
|
||||
this.availableResultsLabel.AutoSize = true;
|
||||
this.availableResultsLabel.Location = new System.Drawing.Point(12, 224);
|
||||
this.availableResultsLabel.Location = new System.Drawing.Point(12, 250);
|
||||
this.availableResultsLabel.Name = "availableResultsLabel";
|
||||
this.availableResultsLabel.Size = new System.Drawing.Size(86, 13);
|
||||
this.availableResultsLabel.TabIndex = 8;
|
||||
@@ -173,7 +179,7 @@
|
||||
// selectedResultsLabel
|
||||
//
|
||||
this.selectedResultsLabel.AutoSize = true;
|
||||
this.selectedResultsLabel.Location = new System.Drawing.Point(249, 224);
|
||||
this.selectedResultsLabel.Location = new System.Drawing.Point(249, 250);
|
||||
this.selectedResultsLabel.Name = "selectedResultsLabel";
|
||||
this.selectedResultsLabel.Size = new System.Drawing.Size(85, 13);
|
||||
this.selectedResultsLabel.TabIndex = 9;
|
||||
@@ -183,7 +189,7 @@
|
||||
//
|
||||
this.removeAllButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.removeAllButton.Enabled = false;
|
||||
this.removeAllButton.Location = new System.Drawing.Point(153, 346);
|
||||
this.removeAllButton.Location = new System.Drawing.Point(153, 385);
|
||||
this.removeAllButton.Name = "removeAllButton";
|
||||
this.removeAllButton.Size = new System.Drawing.Size(94, 30);
|
||||
this.removeAllButton.TabIndex = 46;
|
||||
@@ -195,7 +201,7 @@
|
||||
//
|
||||
this.removeButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.removeButton.Enabled = false;
|
||||
this.removeButton.Location = new System.Drawing.Point(153, 311);
|
||||
this.removeButton.Location = new System.Drawing.Point(153, 350);
|
||||
this.removeButton.Name = "removeButton";
|
||||
this.removeButton.Size = new System.Drawing.Size(93, 30);
|
||||
this.removeButton.TabIndex = 45;
|
||||
@@ -207,7 +213,7 @@
|
||||
//
|
||||
this.addButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.addButton.Enabled = false;
|
||||
this.addButton.Location = new System.Drawing.Point(153, 276);
|
||||
this.addButton.Location = new System.Drawing.Point(153, 315);
|
||||
this.addButton.Name = "addButton";
|
||||
this.addButton.Size = new System.Drawing.Size(93, 30);
|
||||
this.addButton.TabIndex = 44;
|
||||
@@ -230,7 +236,7 @@
|
||||
this.singleRadioButton.Appearance = System.Windows.Forms.Appearance.Button;
|
||||
this.singleRadioButton.AutoSize = true;
|
||||
this.singleRadioButton.Checked = true;
|
||||
this.singleRadioButton.Location = new System.Drawing.Point(11, 183);
|
||||
this.singleRadioButton.Location = new System.Drawing.Point(19, 24);
|
||||
this.singleRadioButton.Name = "singleRadioButton";
|
||||
this.singleRadioButton.Size = new System.Drawing.Size(46, 23);
|
||||
this.singleRadioButton.TabIndex = 48;
|
||||
@@ -243,24 +249,71 @@
|
||||
//
|
||||
this.combinedRadioButton.Appearance = System.Windows.Forms.Appearance.Button;
|
||||
this.combinedRadioButton.AutoSize = true;
|
||||
this.combinedRadioButton.Location = new System.Drawing.Point(63, 183);
|
||||
this.combinedRadioButton.Location = new System.Drawing.Point(71, 24);
|
||||
this.combinedRadioButton.Name = "combinedRadioButton";
|
||||
this.combinedRadioButton.Size = new System.Drawing.Size(64, 23);
|
||||
this.combinedRadioButton.TabIndex = 49;
|
||||
this.combinedRadioButton.TabStop = true;
|
||||
this.combinedRadioButton.Text = "Combined";
|
||||
this.combinedRadioButton.UseVisualStyleBackColor = true;
|
||||
this.combinedRadioButton.CheckedChanged += new System.EventHandler(this.combinedRadioButton_CheckedChanged);
|
||||
//
|
||||
// screenRadioButton
|
||||
//
|
||||
this.screenRadioButton.Appearance = System.Windows.Forms.Appearance.Button;
|
||||
this.screenRadioButton.AutoSize = true;
|
||||
this.screenRadioButton.Checked = true;
|
||||
this.screenRadioButton.Location = new System.Drawing.Point(29, 24);
|
||||
this.screenRadioButton.Name = "screenRadioButton";
|
||||
this.screenRadioButton.Size = new System.Drawing.Size(51, 23);
|
||||
this.screenRadioButton.TabIndex = 50;
|
||||
this.screenRadioButton.TabStop = true;
|
||||
this.screenRadioButton.Text = "Screen";
|
||||
this.screenRadioButton.UseVisualStyleBackColor = true;
|
||||
this.screenRadioButton.CheckedChanged += new System.EventHandler(this.screenRadioButton_CheckedChanged);
|
||||
//
|
||||
// printerRadioButton
|
||||
//
|
||||
this.printerRadioButton.Appearance = System.Windows.Forms.Appearance.Button;
|
||||
this.printerRadioButton.AutoSize = true;
|
||||
this.printerRadioButton.Location = new System.Drawing.Point(86, 24);
|
||||
this.printerRadioButton.Name = "printerRadioButton";
|
||||
this.printerRadioButton.Size = new System.Drawing.Size(47, 23);
|
||||
this.printerRadioButton.TabIndex = 51;
|
||||
this.printerRadioButton.Text = "Printer";
|
||||
this.printerRadioButton.UseVisualStyleBackColor = true;
|
||||
this.printerRadioButton.CheckedChanged += new System.EventHandler(this.printerRadioButton_CheckedChanged);
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
this.groupBox1.Controls.Add(this.combinedRadioButton);
|
||||
this.groupBox1.Controls.Add(this.singleRadioButton);
|
||||
this.groupBox1.Location = new System.Drawing.Point(17, 176);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Size = new System.Drawing.Size(153, 60);
|
||||
this.groupBox1.TabIndex = 52;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "Water Meter";
|
||||
//
|
||||
// groupBox2
|
||||
//
|
||||
this.groupBox2.Controls.Add(this.printerRadioButton);
|
||||
this.groupBox2.Controls.Add(this.screenRadioButton);
|
||||
this.groupBox2.Location = new System.Drawing.Point(220, 176);
|
||||
this.groupBox2.Name = "groupBox2";
|
||||
this.groupBox2.Size = new System.Drawing.Size(166, 60);
|
||||
this.groupBox2.TabIndex = 0;
|
||||
this.groupBox2.TabStop = false;
|
||||
this.groupBox2.Text = "Device";
|
||||
//
|
||||
// ResultsConfig
|
||||
//
|
||||
this.AcceptButton = this.okButton;
|
||||
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, 419);
|
||||
this.Controls.Add(this.combinedRadioButton);
|
||||
this.Controls.Add(this.singleRadioButton);
|
||||
this.ClientSize = new System.Drawing.Size(399, 468);
|
||||
this.Controls.Add(this.groupBox2);
|
||||
this.Controls.Add(this.groupBox1);
|
||||
this.Controls.Add(this.unlockButton);
|
||||
this.Controls.Add(this.removeAllButton);
|
||||
this.Controls.Add(this.removeButton);
|
||||
@@ -281,6 +334,10 @@
|
||||
this.testsArangementGroupBox.PerformLayout();
|
||||
this.metersArangementGroupBox.ResumeLayout(false);
|
||||
this.metersArangementGroupBox.PerformLayout();
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
this.groupBox1.PerformLayout();
|
||||
this.groupBox2.ResumeLayout(false);
|
||||
this.groupBox2.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
@@ -306,5 +363,9 @@
|
||||
private System.Windows.Forms.Button unlockButton;
|
||||
private System.Windows.Forms.RadioButton singleRadioButton;
|
||||
private System.Windows.Forms.RadioButton combinedRadioButton;
|
||||
private System.Windows.Forms.RadioButton screenRadioButton;
|
||||
private System.Windows.Forms.RadioButton printerRadioButton;
|
||||
private System.Windows.Forms.GroupBox groupBox1;
|
||||
private System.Windows.Forms.GroupBox groupBox2;
|
||||
}
|
||||
}
|
||||
@@ -34,10 +34,13 @@ namespace TBF.Forms
|
||||
public Meters MetersArrangement;
|
||||
|
||||
public IList<ResultItemSpec> currentlyAvailableItems;
|
||||
public IList<ResultItemSpec> SelectedItems_SingleWM;
|
||||
public IList<ResultItemSpec> SelectedItems_CombinedWM;
|
||||
public IList<ResultItemSpec> RsltItems_Screen_SingleWM;
|
||||
public IList<ResultItemSpec> RsltItems_Screen_CombinedWM;
|
||||
public IList<ResultItemSpec> RsltItems_Printer_SingleWM;
|
||||
public IList<ResultItemSpec> RsltItems_Printer_CombinedWM;
|
||||
|
||||
bool combined; /// true = processing combined items
|
||||
bool combined; /// false = single meter items, true = combined meter items
|
||||
bool printer; /// false = screen items, true = printer items
|
||||
bool unlocked; /// true = changes enabled
|
||||
|
||||
public ResultsConfig()
|
||||
@@ -45,6 +48,7 @@ namespace TBF.Forms
|
||||
InitializeComponent();
|
||||
|
||||
combined = false;
|
||||
printer = false;
|
||||
unlocked = false;
|
||||
cancelButton.Visible = false;
|
||||
}
|
||||
@@ -58,6 +62,12 @@ namespace TBF.Forms
|
||||
testsColumnsRadioButton.Text = Strings.Tests_are_columns;
|
||||
horizontallyRadioButton.Text = Strings.Horizontally;
|
||||
verticallyRadioButton.Text = Strings.Vertically;
|
||||
groupBox1.Text = Strings.Water_Meter;
|
||||
singleRadioButton.Text = Strings.SingleBtnText;
|
||||
combinedRadioButton.Text = Strings.CombinedBtnText;
|
||||
groupBox2.Text = Strings.Device;
|
||||
screenRadioButton.Text = Strings.ScreenBtnText;
|
||||
printerRadioButton.Text = Strings.PrinterBtnText;
|
||||
availableResultsLabel.Text = Strings.Available_results;
|
||||
selectedResultsLabel.Text = Strings.Selected_results;
|
||||
addButton.Text = Strings.Add;
|
||||
@@ -87,7 +97,9 @@ namespace TBF.Forms
|
||||
/// </summary>
|
||||
void RedrawAvailable()
|
||||
{
|
||||
IList<ResultItemSpec> selectedItems = combined ? SelectedItems_CombinedWM : SelectedItems_SingleWM;
|
||||
IList<ResultItemSpec> selectedItems;
|
||||
if (printer) selectedItems = combined ? RsltItems_Printer_CombinedWM : RsltItems_Printer_SingleWM;
|
||||
else selectedItems = combined ? RsltItems_Screen_CombinedWM : RsltItems_Screen_SingleWM;
|
||||
|
||||
availableResultsListBox.Items.Clear();
|
||||
currentlyAvailableItems = new List<ResultItemSpec>();
|
||||
@@ -96,8 +108,7 @@ namespace TBF.Forms
|
||||
if (!selectedItems.Contains(item) && (combined ? (item.PrintCombined != null) : (item.Print != null)))
|
||||
{
|
||||
currentlyAvailableItems.Add(item);
|
||||
string displayName = item.Name.Substring(0, 1).Equals("_") ? item.Name.Substring(1) : item.Name;
|
||||
availableResultsListBox.Items.Add(displayName);
|
||||
availableResultsListBox.Items.Add(item.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -107,13 +118,14 @@ namespace TBF.Forms
|
||||
/// </summary>
|
||||
void RedrawSelected()
|
||||
{
|
||||
IList<ResultItemSpec> selectedItems = combined ? SelectedItems_CombinedWM : SelectedItems_SingleWM;
|
||||
IList<ResultItemSpec> selectedItems;
|
||||
if (printer) selectedItems = combined ? RsltItems_Printer_CombinedWM : RsltItems_Printer_SingleWM;
|
||||
else selectedItems = combined ? RsltItems_Screen_CombinedWM : RsltItems_Screen_SingleWM;
|
||||
|
||||
selectedResultsListBox.Items.Clear();
|
||||
foreach (var item in selectedItems)
|
||||
{
|
||||
string displayName = item.Name.Substring(0, 1).Equals("_") ? item.Name.Substring(1) : item.Name;
|
||||
selectedResultsListBox.Items.Add(displayName);
|
||||
selectedResultsListBox.Items.Add(item.Name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,11 +183,13 @@ namespace TBF.Forms
|
||||
var item = currentlyAvailableItems[availableResultsListBox.SelectedIndices[0]];
|
||||
if (combined)
|
||||
{
|
||||
SelectedItems_CombinedWM.Add(item);
|
||||
if (printer) RsltItems_Printer_CombinedWM.Add(item);
|
||||
else RsltItems_Screen_CombinedWM.Add(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
SelectedItems_SingleWM.Add(item);
|
||||
if (printer) RsltItems_Printer_SingleWM.Add(item);
|
||||
else RsltItems_Screen_SingleWM.Add(item);
|
||||
}
|
||||
RedrawAvailable();
|
||||
RedrawSelected();
|
||||
@@ -192,11 +206,13 @@ namespace TBF.Forms
|
||||
var item = currentlyAvailableItems[availableResultsListBox.SelectedIndices[i]];
|
||||
if (combined)
|
||||
{
|
||||
SelectedItems_CombinedWM.Add(item);
|
||||
if (printer) RsltItems_Printer_CombinedWM.Add(item);
|
||||
else RsltItems_Screen_CombinedWM.Add(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
SelectedItems_SingleWM.Add(item);
|
||||
if (printer) RsltItems_Printer_SingleWM.Add(item);
|
||||
else RsltItems_Screen_SingleWM.Add(item);
|
||||
}
|
||||
}
|
||||
RedrawAvailable();
|
||||
@@ -211,11 +227,13 @@ namespace TBF.Forms
|
||||
{
|
||||
if (combined)
|
||||
{
|
||||
SelectedItems_CombinedWM.RemoveAt(selectedResultsListBox.SelectedIndices[0]);
|
||||
if (printer) RsltItems_Printer_CombinedWM.RemoveAt(selectedResultsListBox.SelectedIndices[0]);
|
||||
else RsltItems_Screen_CombinedWM.RemoveAt(selectedResultsListBox.SelectedIndices[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
SelectedItems_SingleWM.RemoveAt(selectedResultsListBox.SelectedIndices[0]);
|
||||
if (printer) RsltItems_Printer_SingleWM.RemoveAt(selectedResultsListBox.SelectedIndices[0]);
|
||||
else RsltItems_Screen_SingleWM.RemoveAt(selectedResultsListBox.SelectedIndices[0]);
|
||||
}
|
||||
RedrawAvailable();
|
||||
RedrawSelected();
|
||||
@@ -228,14 +246,16 @@ namespace TBF.Forms
|
||||
|
||||
for (int i = selectedResultsListBox.SelectedIndices.Count - 1; i >= 0; i--)
|
||||
{
|
||||
ResultItemSpec item = SelectedItems_SingleWM[selectedResultsListBox.SelectedIndices[i]];
|
||||
ResultItemSpec item = RsltItems_Screen_SingleWM[selectedResultsListBox.SelectedIndices[i]];
|
||||
if (combined)
|
||||
{
|
||||
SelectedItems_CombinedWM.Remove(item);
|
||||
if (printer) RsltItems_Printer_CombinedWM.Remove(item);
|
||||
else RsltItems_Screen_CombinedWM.Remove(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
SelectedItems_SingleWM.Remove(item);
|
||||
if (printer) RsltItems_Printer_SingleWM.Remove(item);
|
||||
else RsltItems_Screen_SingleWM.Remove(item);
|
||||
}
|
||||
}
|
||||
RedrawAvailable();
|
||||
@@ -248,11 +268,13 @@ namespace TBF.Forms
|
||||
|
||||
if (combined)
|
||||
{
|
||||
SelectedItems_CombinedWM.Clear();
|
||||
if (printer) RsltItems_Printer_CombinedWM.Clear();
|
||||
else RsltItems_Screen_CombinedWM.Clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
SelectedItems_SingleWM.Clear();
|
||||
if (printer) RsltItems_Printer_SingleWM.Clear();
|
||||
else RsltItems_Screen_SingleWM.Clear();
|
||||
}
|
||||
RedrawAvailable();
|
||||
RedrawSelected();
|
||||
@@ -268,5 +290,16 @@ namespace TBF.Forms
|
||||
RedrawAvailable();
|
||||
RedrawSelected();
|
||||
}
|
||||
|
||||
private void screenRadioButton_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
private void printerRadioButton_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
printer = printerRadioButton.Checked;
|
||||
RedrawAvailable();
|
||||
RedrawSelected();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,8 +130,10 @@ namespace TBF
|
||||
/// Configuration of results
|
||||
public Forms.ResultsConfig.Meters ResultsConfigMeters;
|
||||
public Forms.ResultsConfig.TestsAre ResultsConfigTests;
|
||||
public string[] SelectedItems_SingleWM;
|
||||
public string[] SelectedItems_CombinedWM;
|
||||
public string[] RsltItems_Screen_SingleWM;
|
||||
public string[] RsltItems_Screen_CombinedWM;
|
||||
public string[] RsltItems_Printer_SingleWM;
|
||||
public string[] RsltItems_Printer_CombinedWM;
|
||||
|
||||
/// <summary>
|
||||
/// Copy public fields from a LocalSettings object to this object.
|
||||
@@ -207,13 +209,21 @@ namespace TBF
|
||||
ResultsConfigMeters = ls.ResultsConfigMeters;
|
||||
ResultsConfigTests = ls.ResultsConfigTests;
|
||||
|
||||
int count = (ls.SelectedItems_SingleWM != null) ? ls.SelectedItems_SingleWM.Length : 0;
|
||||
SelectedItems_SingleWM = new string[count];
|
||||
for (int i = 0; i < count; i++) SelectedItems_SingleWM[i] = ls.SelectedItems_SingleWM[i];
|
||||
int count = (ls.RsltItems_Screen_SingleWM != null) ? ls.RsltItems_Screen_SingleWM.Length : 0;
|
||||
RsltItems_Screen_SingleWM = new string[count];
|
||||
for (int i = 0; i < count; i++) RsltItems_Screen_SingleWM[i] = ls.RsltItems_Screen_SingleWM[i];
|
||||
|
||||
count = (ls.SelectedItems_CombinedWM != null) ? ls.SelectedItems_CombinedWM.Length : 0;
|
||||
SelectedItems_CombinedWM = new string[count];
|
||||
for (int i = 0; i < count; i++) SelectedItems_CombinedWM[i] = ls.SelectedItems_CombinedWM[i];
|
||||
count = (ls.RsltItems_Screen_CombinedWM != null) ? ls.RsltItems_Screen_CombinedWM.Length : 0;
|
||||
RsltItems_Screen_CombinedWM = new string[count];
|
||||
for (int i = 0; i < count; i++) RsltItems_Screen_CombinedWM[i] = ls.RsltItems_Screen_CombinedWM[i];
|
||||
|
||||
count = (ls.RsltItems_Printer_SingleWM != null) ? ls.RsltItems_Printer_SingleWM.Length : 0;
|
||||
RsltItems_Printer_SingleWM = new string[count];
|
||||
for (int i = 0; i < count; i++) RsltItems_Printer_SingleWM[i] = ls.RsltItems_Printer_SingleWM[i];
|
||||
|
||||
count = (ls.RsltItems_Printer_CombinedWM != null) ? ls.RsltItems_Printer_CombinedWM.Length : 0;
|
||||
RsltItems_Printer_CombinedWM = new string[count];
|
||||
for (int i = 0; i < count; i++) RsltItems_Printer_CombinedWM[i] = ls.RsltItems_Printer_CombinedWM[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+45
@@ -294,6 +294,15 @@ namespace TBF.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Combined.
|
||||
/// </summary>
|
||||
internal static string CombinedBtnText {
|
||||
get {
|
||||
return ResourceManager.GetString("CombinedBtnText", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Component.
|
||||
/// </summary>
|
||||
@@ -465,6 +474,15 @@ namespace TBF.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Device.
|
||||
/// </summary>
|
||||
internal static string Device {
|
||||
get {
|
||||
return ResourceManager.GetString("Device", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to dflt.
|
||||
/// </summary>
|
||||
@@ -1311,6 +1329,15 @@ namespace TBF.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Printer.
|
||||
/// </summary>
|
||||
internal static string PrinterBtnText {
|
||||
get {
|
||||
return ResourceManager.GetString("PrinterBtnText", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Procedure.
|
||||
/// </summary>
|
||||
@@ -1626,6 +1653,15 @@ namespace TBF.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Screen.
|
||||
/// </summary>
|
||||
internal static string ScreenBtnText {
|
||||
get {
|
||||
return ResourceManager.GetString("ScreenBtnText", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to s.
|
||||
/// </summary>
|
||||
@@ -1698,6 +1734,15 @@ namespace TBF.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Single.
|
||||
/// </summary>
|
||||
internal static string SingleBtnText {
|
||||
get {
|
||||
return ResourceManager.GetString("SingleBtnText", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Start the pump.
|
||||
/// </summary>
|
||||
|
||||
@@ -886,4 +886,19 @@
|
||||
<data name="Timeout" xml:space="preserve">
|
||||
<value>Timeout</value>
|
||||
</data>
|
||||
<data name="CombinedBtnText" xml:space="preserve">
|
||||
<value>Combined</value>
|
||||
</data>
|
||||
<data name="Device" xml:space="preserve">
|
||||
<value>Device</value>
|
||||
</data>
|
||||
<data name="PrinterBtnText" xml:space="preserve">
|
||||
<value>Printer</value>
|
||||
</data>
|
||||
<data name="ScreenBtnText" xml:space="preserve">
|
||||
<value>Screen</value>
|
||||
</data>
|
||||
<data name="SingleBtnText" xml:space="preserve">
|
||||
<value>Single</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -16,8 +16,10 @@ namespace TBF.Screens
|
||||
public TBF.Forms.ResultsConfig.Meters MetersArrangement;
|
||||
public TBF.Forms.ResultsConfig.TestsAre TestsArrangement;
|
||||
|
||||
public IList<TBF.Forms.ResultItemSpec> SelectedItems_SingleWM;
|
||||
public IList<TBF.Forms.ResultItemSpec> SelectedItems_CombinedWM;
|
||||
public IList<TBF.Forms.ResultItemSpec> RsltItems_Screen_SingleWM;
|
||||
public IList<TBF.Forms.ResultItemSpec> RsltItems_Screen_CombinedWM;
|
||||
public IList<TBF.Forms.ResultItemSpec> RsltItems_Printer_SingleWM;
|
||||
public IList<TBF.Forms.ResultItemSpec> RsltItems_Printer_CombinedWM;
|
||||
|
||||
IList<Entities.Test> tests;
|
||||
IList<Entities.TestResult> testResults;
|
||||
@@ -58,8 +60,10 @@ namespace TBF.Screens
|
||||
|
||||
MetersArrangement = Program.LocalSettings.ResultsConfigMeters;
|
||||
TestsArrangement = Program.LocalSettings.ResultsConfigTests;
|
||||
SelectedItems_SingleWM = Forms.ResultItemSpec.FromStrArray(Program.LocalSettings.SelectedItems_SingleWM);
|
||||
SelectedItems_CombinedWM = Forms.ResultItemSpec.FromStrArray(Program.LocalSettings.SelectedItems_CombinedWM);
|
||||
RsltItems_Screen_SingleWM = Forms.ResultItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Screen_SingleWM);
|
||||
RsltItems_Screen_CombinedWM = Forms.ResultItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Screen_CombinedWM);
|
||||
RsltItems_Printer_SingleWM = Forms.ResultItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Printer_SingleWM);
|
||||
RsltItems_Printer_CombinedWM = Forms.ResultItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Printer_CombinedWM);
|
||||
|
||||
RedrawAll();
|
||||
}
|
||||
@@ -72,18 +76,25 @@ namespace TBF.Screens
|
||||
TBF.Forms.ResultsConfig dlg = new TBF.Forms.ResultsConfig();
|
||||
dlg.TestsArrangement = TestsArrangement;
|
||||
dlg.MetersArrangement = MetersArrangement;
|
||||
dlg.SelectedItems_SingleWM = SelectedItems_SingleWM;
|
||||
dlg.SelectedItems_CombinedWM = SelectedItems_CombinedWM;
|
||||
dlg.RsltItems_Screen_SingleWM = RsltItems_Screen_SingleWM;
|
||||
dlg.RsltItems_Screen_CombinedWM = RsltItems_Screen_CombinedWM;
|
||||
dlg.RsltItems_Printer_SingleWM = RsltItems_Printer_SingleWM;
|
||||
dlg.RsltItems_Printer_CombinedWM = RsltItems_Printer_CombinedWM;
|
||||
if (DialogResult.OK == dlg.ShowDialog())
|
||||
{
|
||||
MetersArrangement = dlg.MetersArrangement;
|
||||
TestsArrangement = dlg.TestsArrangement;
|
||||
SelectedItems_SingleWM = dlg.SelectedItems_SingleWM;
|
||||
RsltItems_Screen_SingleWM = dlg.RsltItems_Screen_SingleWM;
|
||||
RsltItems_Screen_CombinedWM = dlg.RsltItems_Screen_CombinedWM;
|
||||
RsltItems_Printer_SingleWM = dlg.RsltItems_Printer_SingleWM;
|
||||
RsltItems_Printer_CombinedWM = dlg.RsltItems_Printer_CombinedWM;
|
||||
|
||||
Program.LocalSettings.ResultsConfigMeters = MetersArrangement;
|
||||
Program.LocalSettings.ResultsConfigTests = TestsArrangement;
|
||||
Program.LocalSettings.SelectedItems_SingleWM = Forms.ResultItemSpec.ToStrArray(SelectedItems_SingleWM);
|
||||
Program.LocalSettings.SelectedItems_CombinedWM = Forms.ResultItemSpec.ToStrArray(SelectedItems_CombinedWM);
|
||||
Program.LocalSettings.RsltItems_Screen_SingleWM = Forms.ResultItemSpec.ToStrArray(RsltItems_Screen_SingleWM);
|
||||
Program.LocalSettings.RsltItems_Screen_CombinedWM = Forms.ResultItemSpec.ToStrArray(RsltItems_Screen_CombinedWM);
|
||||
Program.LocalSettings.RsltItems_Printer_SingleWM = Forms.ResultItemSpec.ToStrArray(RsltItems_Printer_SingleWM);
|
||||
Program.LocalSettings.RsltItems_Printer_CombinedWM = Forms.ResultItemSpec.ToStrArray(RsltItems_Printer_CombinedWM);
|
||||
Program.LocalSettings.Save();
|
||||
}
|
||||
RedrawAll();
|
||||
@@ -220,7 +231,7 @@ namespace TBF.Screens
|
||||
ListView GetResultsTestsAreRows(int mtr, bool combined)
|
||||
{
|
||||
if (tests == null) return null;
|
||||
IList<Forms.ResultItemSpec> items = (combined ? SelectedItems_CombinedWM : SelectedItems_SingleWM);
|
||||
IList<Forms.ResultItemSpec> items = (combined ? RsltItems_Screen_CombinedWM : RsltItems_Screen_SingleWM);
|
||||
ListView lview = GetListView();
|
||||
|
||||
// Header
|
||||
@@ -262,7 +273,7 @@ namespace TBF.Screens
|
||||
ListView GetResultsTestsAreColumns(int mtr, bool combined)
|
||||
{
|
||||
if (tests == null) return null;
|
||||
IList<Forms.ResultItemSpec> items = (combined ? SelectedItems_CombinedWM : SelectedItems_SingleWM);
|
||||
IList<Forms.ResultItemSpec> items = (combined ? RsltItems_Screen_CombinedWM : RsltItems_Screen_SingleWM);
|
||||
ListView lview = GetListView();
|
||||
|
||||
// Header
|
||||
@@ -278,7 +289,7 @@ namespace TBF.Screens
|
||||
{
|
||||
foreach (var tr in trs)
|
||||
{
|
||||
lvi.SubItems.Add((item.PrintCombined == null) ? string.Empty : item.PrintCombined(tr.Meters[2 * mtr],
|
||||
lvi.SubItems.Add((item.PrintCombined == null || tr == null) ? string.Empty : item.PrintCombined(tr.Meters[2 * mtr],
|
||||
tr.Meters[2 * mtr + 1],
|
||||
tr.CombinedMeters[mtr]));
|
||||
}
|
||||
@@ -287,7 +298,7 @@ namespace TBF.Screens
|
||||
{
|
||||
foreach (var tr in trs)
|
||||
{
|
||||
lvi.SubItems.Add((item.Print == null) ? string.Empty : item.Print(tr.Meters[mtr]));
|
||||
lvi.SubItems.Add((item.Print == null || tr == null) ? string.Empty : item.Print(tr.Meters[mtr]));
|
||||
}
|
||||
}
|
||||
lview.Items.Add(lvi);
|
||||
|
||||
@@ -164,5 +164,43 @@ namespace TBF
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a float number to a string with the specified number of valid digits
|
||||
/// </summary>
|
||||
/// <param name="value">Float value to be converted to a string</param>
|
||||
/// <param name="validDigits"># of valid digits: 4, 3, or 2 (otherwise full precision number is printed)</param>
|
||||
/// <returns>String representation of the float number</returns>
|
||||
public static string FloatToStr(float value, int validDigits)
|
||||
{
|
||||
if (validDigits == 4)
|
||||
{
|
||||
if (value >= 1000 || value <= -1000) return value.ToString("F0");
|
||||
else if (value >= 100 || value <= -100) return value.ToString("F1");
|
||||
else if (value >= 10 || value <= -10) return value.ToString("F2");
|
||||
else if (value >= 1 || value <= -1) return value.ToString("F3");
|
||||
else if (value >= 0.1 || value <= -0.1) return value.ToString("F4");
|
||||
else if (value >= 0.01 || value <= -0.01) return value.ToString("F5");
|
||||
else return value.ToString("F6");
|
||||
}
|
||||
else if (validDigits == 3)
|
||||
{
|
||||
if (value >= 100 || value <= -100) return value.ToString("F0");
|
||||
else if (value >= 10 || value <= -10) return value.ToString("F1");
|
||||
else if (value >= 1 || value <= -1) return value.ToString("F2");
|
||||
else if (value >= 0.1 || value <= -0.1) return value.ToString("F3");
|
||||
else if (value >= 0.01 || value <= -0.01) return value.ToString("F4");
|
||||
else return value.ToString("F5");
|
||||
}
|
||||
else if (validDigits == 2)
|
||||
{
|
||||
if (value >= 10 || value <= -10) return value.ToString("F0");
|
||||
else if (value >= 1 || value <= -1) return value.ToString("F1");
|
||||
else if (value >= 0.1 || value <= -0.1) return value.ToString("F2");
|
||||
else if (value >= 0.01 || value <= -0.01) return value.ToString("F3");
|
||||
else return value.ToString("F4");
|
||||
}
|
||||
else return value.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user