diff --git a/Results/BatchResults.cs b/Results/BatchResults.cs
index 63ee0044c..842803904 100644
--- a/Results/BatchResults.cs
+++ b/Results/BatchResults.cs
@@ -113,13 +113,24 @@ namespace Results
return d;
}
+ public static BatchResults FromBatch(Batch batch)
+ {
+ int wmCount = batch.WaterMeters.Count;
+ if (wmCount == 0) return null;
- public TestRslt GetTestRslt(string name, int part)
+ BatchResults batchResults = new BatchResults(wmCount);
+ batchResults.Batch = batch;
+ batchResults.WaterMeters = new WaterMeter[wmCount];
+ for (int i = 0; i < wmCount; i++) batchResults.WaterMeters[i] = batch.WaterMeters[i];
+
+ return batchResults;
+ }
+
+ public TestRslt GetTestRslt(string name, int part)
{
return Batch.GetTestRslt(name, part);
}
-
public MeterTestRslt GetMeterTestRslt(string name, int wmnr0, Config.Entities.CompoundMeterId meterId)
{
if (WaterMeters[wmnr0] != null)
diff --git a/Results/Forms/BatchResultsDlg.Designer.cs b/Results/Forms/BatchResultsDlg.Designer.cs
new file mode 100644
index 000000000..65a977b7f
--- /dev/null
+++ b/Results/Forms/BatchResultsDlg.Designer.cs
@@ -0,0 +1,60 @@
+namespace Results.Forms
+{
+ partial class BatchResultsDlg
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.mainFlowLayoutPanel = new System.Windows.Forms.FlowLayoutPanel();
+ this.SuspendLayout();
+ //
+ // mainFlowLayoutPanel
+ //
+ this.mainFlowLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.mainFlowLayoutPanel.Location = new System.Drawing.Point(0, 0);
+ this.mainFlowLayoutPanel.Name = "mainFlowLayoutPanel";
+ this.mainFlowLayoutPanel.Size = new System.Drawing.Size(1058, 721);
+ this.mainFlowLayoutPanel.TabIndex = 0;
+ //
+ // BatchResultsDlg
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(1058, 721);
+ this.Controls.Add(this.mainFlowLayoutPanel);
+ this.Name = "BatchResultsDlg";
+ this.Text = "Results";
+ this.Load += new System.EventHandler(this.BatchResultsDlg_Load);
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.FlowLayoutPanel mainFlowLayoutPanel;
+
+ }
+}
\ No newline at end of file
diff --git a/Results/Forms/BatchResultsDlg.cs b/Results/Forms/BatchResultsDlg.cs
new file mode 100644
index 000000000..45a3a9dd9
--- /dev/null
+++ b/Results/Forms/BatchResultsDlg.cs
@@ -0,0 +1,50 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Windows.Forms;
+using Config.Entities;
+using Results.Resources;
+
+namespace Results.Forms
+{
+ public partial class BatchResultsDlg : Form
+ {
+ public MetersArrangement MetersArrangement { set { ctrl.MetersArrangement = value; } }
+ public TestsArrangement TestsArrangement { set { ctrl.TestsArrangement = value; } }
+ public int NrMetersInOneGroup { set { ctrl.NrMetersInOneGroup = value; } }
+
+ public IList RsltItems_Screen_SingleWM { set { ctrl.RsltItems_Screen_SingleWM = value; } }
+ public IList RsltItems_Screen_CombinedWM { set { ctrl.RsltItems_Screen_CombinedWM = value; } }
+ public int[] RsltsClmnWidths { set { ctrl.RsltsClmnWidths = value; } }
+
+ public Results.BatchResults Results { set { results = value; ctrl.Display(results); } }
+ Results.BatchResults results;
+
+ Results.UiControls.BatchResultsCtrl ctrl;
+
+ public BatchResultsDlg()
+ {
+ InitializeComponent();
+
+ Text = Strings.Results;
+ ctrl = new Results.UiControls.BatchResultsCtrl();
+ mainFlowLayoutPanel.Controls.Add(ctrl);
+ ctrl.Dock = DockStyle.Fill;
+ }
+
+ public BatchResultsDlg(Results.BatchResults results)
+ : this()
+ {
+ this.results = results;
+ }
+
+ private void BatchResultsDlg_Load(object sender, EventArgs e)
+ {
+ if (results != null) ctrl.Display(results);
+ }
+ }
+}
diff --git a/Results/Forms/BatchResultsDlg.resx b/Results/Forms/BatchResultsDlg.resx
new file mode 100644
index 000000000..1af7de150
--- /dev/null
+++ b/Results/Forms/BatchResultsDlg.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/Results/Resources/Strings.Designer.cs b/Results/Resources/Strings.Designer.cs
index c03bfd2b9..6d662a61f 100644
--- a/Results/Resources/Strings.Designer.cs
+++ b/Results/Resources/Strings.Designer.cs
@@ -582,6 +582,15 @@ namespace Results.Resources {
}
}
+ ///
+ /// Looks up a localized string similar to Results.
+ ///
+ internal static string Results {
+ get {
+ return ResourceManager.GetString("Results", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Selected results.
///
diff --git a/Results/Resources/Strings.cs.resx b/Results/Resources/Strings.cs.resx
index 6682406a6..cb04d19fc 100644
--- a/Results/Resources/Strings.cs.resx
+++ b/Results/Resources/Strings.cs.resx
@@ -156,6 +156,12 @@
Odebrat vše
+
+ Výsledek
+
+
+ Výsledky
+
Vybrané výsledky
diff --git a/Results/Resources/Strings.de.resx b/Results/Resources/Strings.de.resx
index 1a4b5c66c..4d0ff286a 100644
--- a/Results/Resources/Strings.de.resx
+++ b/Results/Resources/Strings.de.resx
@@ -372,4 +372,7 @@
Eichjahr
+
+ Ergebnisse
+
\ No newline at end of file
diff --git a/Results/Resources/Strings.resx b/Results/Resources/Strings.resx
index 31252d31c..64828e4d7 100644
--- a/Results/Resources/Strings.resx
+++ b/Results/Resources/Strings.resx
@@ -375,4 +375,7 @@
Year
+
+ Results
+
\ No newline at end of file
diff --git a/Results/Results.csproj b/Results/Results.csproj
index 9658f74e4..d0842cbc2 100644
--- a/Results/Results.csproj
+++ b/Results/Results.csproj
@@ -67,6 +67,12 @@
+
+ Form
+
+
+ BatchResultsDlg.cs
+
Component
@@ -98,6 +104,12 @@
True
Strings.resx
+
+ UserControl
+
+
+ BatchResultsCtrl.cs
+
@@ -114,6 +126,9 @@
+
+ BatchResultsDlg.cs
+
ListViewEx.cs
@@ -130,6 +145,9 @@
ResXFileCodeGenerator
Strings.Designer.cs
+
+ BatchResultsCtrl.cs
+
diff --git a/Results/UiControls/BatchResultsCtrl.Designer.cs b/Results/UiControls/BatchResultsCtrl.Designer.cs
new file mode 100644
index 000000000..9e1d90618
--- /dev/null
+++ b/Results/UiControls/BatchResultsCtrl.Designer.cs
@@ -0,0 +1,57 @@
+namespace Results.UiControls
+{
+ partial class BatchResultsCtrl
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Component Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.flowLayoutPanel = new System.Windows.Forms.FlowLayoutPanel();
+ this.SuspendLayout();
+ //
+ // flowLayoutPanel
+ //
+ this.flowLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.flowLayoutPanel.Location = new System.Drawing.Point(0, 0);
+ this.flowLayoutPanel.Name = "flowLayoutPanel";
+ this.flowLayoutPanel.Size = new System.Drawing.Size(581, 346);
+ this.flowLayoutPanel.TabIndex = 0;
+ //
+ // BatchResultsCtrl
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.flowLayoutPanel);
+ this.Name = "BatchResultsCtrl";
+ this.Size = new System.Drawing.Size(581, 346);
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel;
+ }
+}
diff --git a/Results/UiControls/BatchResultsCtrl.cs b/Results/UiControls/BatchResultsCtrl.cs
new file mode 100644
index 000000000..208e31672
--- /dev/null
+++ b/Results/UiControls/BatchResultsCtrl.cs
@@ -0,0 +1,358 @@
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Windows.Forms;
+using log4net;
+using Config.Entities;
+
+namespace Results.UiControls
+{
+ public partial class BatchResultsCtrl : UserControl
+ {
+ static readonly ILog log = LogManager.GetLogger(typeof(BatchResultsCtrl));
+
+ ///
+ /// Public members
+ ///
+ public MetersArrangement MetersArrangement;
+ public TestsArrangement TestsArrangement;
+ public int NrMetersInOneGroup;
+
+ public IList RsltItems_Screen_SingleWM;
+ public IList RsltItems_Screen_CombinedWM;
+ public int[] RsltsClmnWidths
+ {
+ get
+ {
+ if (firstListView == null) return null;
+
+ /// Update and return column widths
+ int[] temp = new int[firstListView.Columns.Count];
+ for (int i = 0; i < firstListView.Columns.Count; i++)
+ {
+ temp[i] = firstListView.Columns[i].Width;
+ }
+ rsltsClmnWidths = temp;
+ return temp;
+ }
+ set
+ {
+ rsltsClmnWidths = value;
+ }
+ }
+
+ public bool Compound { get { return Compound; } } /// To inform configuration dialog which configuration is active
+
+ ///
+ /// Private members
+ ///
+ Results.BatchResults results;
+ bool compound;
+
+ ListView firstListView;
+ public int[] rsltsClmnWidths;
+ int rsltsClmnCount { get { return (rsltsClmnWidths != null) ? rsltsClmnWidths.Length : 0; } }
+
+ int lvWidth;
+ int lvHeight;
+
+
+ public BatchResultsCtrl()
+ {
+ InitializeComponent();
+ }
+
+ public void Display(Results.BatchResults results)
+ {
+ this.results = results;
+ Redraw();
+ }
+
+
+ ///
+ /// Re-draw the results. Apply new settings if they changed.
+ ///
+ public void Redraw()
+ {
+ this.SuspendLayout();
+
+ try
+ {
+ /// Determine how many water meters were enabled for result evaluation and printing
+ int enabledWMsCount = 0;
+ for (int i = 0; i < results.WMPositionsCount; i++)
+ {
+ if (results.WaterMeters[i] != null && !results.WaterMeters[i].Disabled)
+ {
+ enabledWMsCount++;
+ }
+ }
+
+ int metersInOneGroup = Math.Max(1, Math.Min(enabledWMsCount, NrMetersInOneGroup));
+ int nrGroups = Math.Max(1, (enabledWMsCount + NrMetersInOneGroup - 1) / metersInOneGroup);
+
+ if (MetersArrangement == MetersArrangement.Horizontally)
+ {
+ flowLayoutPanel.FlowDirection = FlowDirection.LeftToRight;
+ lvWidth = flowLayoutPanel.Width / metersInOneGroup - 6;
+ lvHeight = flowLayoutPanel.Height / nrGroups - 6;
+ }
+ else
+ {
+ flowLayoutPanel.FlowDirection = FlowDirection.TopDown;
+ lvWidth = flowLayoutPanel.Width / nrGroups - 6;
+ lvHeight = flowLayoutPanel.Height / metersInOneGroup - 6;
+ }
+ flowLayoutPanel.Controls.Clear();
+ flowLayoutPanel.WrapContents = true;
+ flowLayoutPanel.AutoScroll = true;
+
+ bool first = true;
+ for (int i = 0; i < results.WMPositionsCount; i++)
+ {
+ if (results.WaterMeters[i] != null && !results.WaterMeters[i].Disabled)
+ {
+ if (TestsArrangement == TestsArrangement.Rows)
+ {
+ ListView lview = GetResultsTestsAreRows(results.WaterMeters[i], i + 1);
+ if (first) { firstListView = lview; first = false; }
+ if (lview != null) flowLayoutPanel.Controls.Add(lview);
+ }
+ else
+ {
+ ListView lview = GetResultsTestsAreColumns(results.WaterMeters[i], i + 1);
+ if (first) { firstListView = lview; first = false; }
+ if (lview != null) flowLayoutPanel.Controls.Add(lview);
+ }
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ log.FatalFormat("Redrawing results failed : {0}", e.Message);
+ if (e.InnerException != null)
+ {
+ log.FatalFormat("InnerMessage : {0}", e.InnerException.Message);
+ }
+ log.FatalFormat("StackTrace : {0}{1}", Environment.NewLine, e.StackTrace);
+ }
+
+ this.ResumeLayout(false);
+ }
+
+ ///
+ /// Get an empty ListView control with appropriate parameters.
+ ///
+ /// ListView control
+ ListView GetListView()
+ {
+ ListView lview = new ListView();
+ lview.AllowColumnReorder = false;
+ lview.Dock = System.Windows.Forms.DockStyle.None;
+ lview.FullRowSelect = true;
+ lview.GridLines = true;
+ lview.Location = new System.Drawing.Point(0, 0);
+ lview.Size = new System.Drawing.Size(lvWidth, lvHeight);
+ lview.TabIndex = 0;
+ lview.UseCompatibleStateImageBehavior = false;
+ lview.View = System.Windows.Forms.View.Details;
+ return lview;
+ }
+
+
+ ///
+ /// Get decorated test names for a specified watermeter
+ ///
+ /// Watermeter results entity
+ /// A list of strings
+ IList GetAllDecoratedTestNames(Results.Entities.WaterMeter wMtr)
+ {
+ IList testNames = new List();
+
+ foreach (var mtr in wMtr.MeterTestRslts)
+ {
+ if ((mtr.CompoundMeterId == (byte)CompoundMeterId.Single || mtr.CompoundMeterId == (byte)CompoundMeterId.Compound)
+ && mtr.TestDone
+ && (mtr.Publish() != Config.Entities.Publish.Never)
+ && (mtr.Publish() != Config.Entities.Publish.Internal))
+ {
+ testNames.Add(mtr.Name());
+ }
+ }
+
+ return testNames;
+ }
+
+
+ ///
+ /// Get a ListView control filled with results of the meter 'mtr'
+ ///
+ /// Water meter number (1-based): 1 .. Config.Data.WMsCount
+ /// ListView object
+ ListView GetResultsTestsAreRows(Results.Entities.WaterMeter wMtr, int printedWMNr)
+ {
+ compound = wMtr.Compound();
+
+ ListView lview = GetListView();
+
+ IList items = (compound ? RsltItems_Screen_CombinedWM : RsltItems_Screen_SingleWM);
+ if (items == null || items.Count == 0) return lview;
+
+ // Header
+ lview.Columns.Add(printedWMNr.ToString(), (rsltsClmnCount > 0) ? rsltsClmnWidths[0] : 40);
+ int i = 1;
+ foreach (var item in items)
+ {
+ lview.Columns.Add(item.ClmnHeaderText, (rsltsClmnCount > i) ? rsltsClmnWidths[i] : 70);
+ i++;
+ }
+
+
+ IList testNames = GetAllDecoratedTestNames(wMtr);
+ int ix = 0;
+ foreach (var mtr in wMtr.MeterTestRslts)
+ {
+ if ((mtr.CompoundMeterId == (byte)CompoundMeterId.Single || mtr.CompoundMeterId == (byte)CompoundMeterId.Compound)
+ && mtr.TestDone
+ && (mtr.Publish() != Config.Entities.Publish.Never)
+ && (mtr.Publish() != Config.Entities.Publish.Internal))
+ {
+ ListViewItem lvi = new ListViewItem(testNames[ix++]);
+
+ foreach (var item in items)
+ {
+ string str;
+ if (compound)
+ {
+ var main = wMtr.GetMeterTestRslt(mtr.Name(), CompoundMeterId.CompoundMain);
+ var aux = wMtr.GetMeterTestRslt(mtr.Name(), CompoundMeterId.CompoundAux);
+ str = (item.CanPrintCombined && main != null && aux != null)
+ ? item.PrintCombined(main, aux, mtr)
+ : string.Empty;
+ }
+ else
+ {
+ str = item.CanPrintSingle ? item.Print(mtr) : string.Empty;
+ }
+
+ string[] texts = str.Split(new char[] { '|' });
+ if (texts.Length == 1)
+ {
+ lvi.SubItems.Add(str);
+ }
+ else if (texts.Length == 2)
+ {
+ Color color = texts[1].Equals("Green") ? Color.Green : (texts[1].Equals("Red") ? Color.Red : Color.White);
+ lvi.UseItemStyleForSubItems = false;
+ lvi.SubItems.Add(texts[0]);
+ lvi.SubItems[lvi.SubItems.Count - 1].BackColor = color;
+ }
+ else
+ {
+ lvi.SubItems.Add(string.Empty);
+ }
+ }
+
+ lview.Items.Add(lvi);
+ }
+ }
+
+ return lview;
+ }
+
+
+ ///
+ /// Get a ListView control filled with results of the meter 'mtr'
+ ///
+ /// Water meter number (1-based): 1 .. Config.Data.WMsCount
+ /// ListView object
+ ListView GetResultsTestsAreColumns(Results.Entities.WaterMeter wMtr, int printedWMNr)
+ {
+ compound = wMtr.Compound();
+
+ ListView lview = GetListView();
+
+ IList items = (compound ? RsltItems_Screen_CombinedWM : RsltItems_Screen_SingleWM);
+ if (items == null || items.Count == 0) return lview;
+
+ // Header
+ lview.Columns.Add(printedWMNr.ToString(), (rsltsClmnCount > 0) ? rsltsClmnWidths[0] : 40);
+ int i = 1;
+ foreach (var str in GetAllDecoratedTestNames(wMtr))
+ {
+ lview.Columns.Add(str, (rsltsClmnCount > i) ? rsltsClmnWidths[i] : 70);
+ i++;
+ }
+
+ foreach (var item in items)
+ {
+ ListViewItem lvi = new ListViewItem(item.ClmnHeaderText);
+ if (compound)
+ {
+ foreach (var mtr in wMtr.MeterTestRslts)
+ {
+ if (mtr.CompoundMeterId == (byte)CompoundMeterId.Compound && mtr.TestDone
+ && (mtr.Publish() != Config.Entities.Publish.Never)
+ && (mtr.Publish() != Config.Entities.Publish.Internal))
+ {
+ var main = wMtr.GetMeterTestRslt(mtr.Name(), CompoundMeterId.CompoundMain);
+ var aux = wMtr.GetMeterTestRslt(mtr.Name(), CompoundMeterId.CompoundAux);
+
+ string str = (item.CanPrintCombined && main != null && aux != null)
+ ? item.PrintCombined(main, aux, mtr)
+ : string.Empty;
+
+ string[] texts = str.Split(new char[] { '|' });
+ if (texts.Length == 1)
+ {
+ lvi.SubItems.Add(str);
+ }
+ else if (texts.Length == 2)
+ {
+ Color color = texts[1].Equals("Green") ? Color.Green : (texts[1].Equals("Red") ? Color.Red : Color.White);
+ lvi.UseItemStyleForSubItems = false;
+ lvi.SubItems.Add(texts[0]);
+ lvi.SubItems[lvi.SubItems.Count - 1].BackColor = color;
+ }
+ else
+ {
+ lvi.SubItems.Add(string.Empty);
+ }
+ }
+ }
+ }
+ else
+ {
+ foreach (var mtr in wMtr.MeterTestRslts)
+ {
+ if (mtr.TestDone && (mtr.Publish() != Config.Entities.Publish.Never)
+ && (mtr.Publish() != Config.Entities.Publish.Internal))
+ {
+ string str = !item.CanPrintSingle ? string.Empty : item.Print(mtr);
+
+ string[] texts = str.Split(new char[] { '|' });
+ if (texts.Length == 1)
+ {
+ lvi.SubItems.Add(str);
+ }
+ else if (texts.Length == 2)
+ {
+ Color color = texts[1].Equals("Green") ? Color.Green : (texts[1].Equals("Red") ? Color.Red : Color.White);
+ lvi.UseItemStyleForSubItems = false;
+ lvi.SubItems.Add(texts[0]);
+ lvi.SubItems[lvi.SubItems.Count - 1].BackColor = color;
+ }
+ else
+ {
+ lvi.SubItems.Add(string.Empty);
+ }
+ }
+ }
+ }
+ lview.Items.Add(lvi);
+ }
+
+ return lview;
+ }
+ }
+}
diff --git a/Results/UiControls/BatchResultsCtrl.resx b/Results/UiControls/BatchResultsCtrl.resx
new file mode 100644
index 000000000..1af7de150
--- /dev/null
+++ b/Results/UiControls/BatchResultsCtrl.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/TestBenchFramework/Forms/PreviousResultCtrl.Designer.cs b/TestBenchFramework/Forms/PreviousResultCtrl.Designer.cs
index c013b73a5..e594135b9 100644
--- a/TestBenchFramework/Forms/PreviousResultCtrl.Designer.cs
+++ b/TestBenchFramework/Forms/PreviousResultCtrl.Designer.cs
@@ -28,117 +28,129 @@
///
private void InitializeComponent()
{
- this.sendButton = new System.Windows.Forms.Button();
- this.sentCheckBox = new System.Windows.Forms.CheckBox();
- this.failedCountLabel = new System.Windows.Forms.Label();
- this.passedCountLabel = new System.Windows.Forms.Label();
- this.purchaseOrderLabel = new System.Windows.Forms.Label();
- this.procedureLabel = new System.Windows.Forms.Label();
- this.endTimeLabel = new System.Windows.Forms.Label();
- this.startTimeLabel = new System.Windows.Forms.Label();
- this.batchNrLabel = new System.Windows.Forms.Label();
- this.SuspendLayout();
- //
- // sendButton
- //
- this.sendButton.Location = new System.Drawing.Point(832, 2);
- this.sendButton.Name = "sendButton";
- this.sendButton.Size = new System.Drawing.Size(75, 23);
- this.sendButton.TabIndex = 15;
- this.sendButton.Text = "Again";
- this.sendButton.UseVisualStyleBackColor = true;
- this.sendButton.Click += new System.EventHandler(this.sendButton_Click);
- //
- // sentCheckBox
- //
- this.sentCheckBox.AutoSize = true;
- this.sentCheckBox.Location = new System.Drawing.Point(748, 6);
- this.sentCheckBox.Name = "sentCheckBox";
- this.sentCheckBox.Size = new System.Drawing.Size(48, 17);
- this.sentCheckBox.TabIndex = 14;
- this.sentCheckBox.Text = "Sent";
- this.sentCheckBox.UseVisualStyleBackColor = true;
- //
- // failedCountLabel
- //
- this.failedCountLabel.AutoSize = true;
- this.failedCountLabel.Location = new System.Drawing.Point(681, 7);
- this.failedCountLabel.Name = "failedCountLabel";
- this.failedCountLabel.Size = new System.Drawing.Size(48, 13);
- this.failedCountLabel.TabIndex = 13;
- this.failedCountLabel.Text = "failedCnt";
- //
- // passedCountLabel
- //
- this.passedCountLabel.AutoSize = true;
- this.passedCountLabel.Location = new System.Drawing.Point(590, 7);
- this.passedCountLabel.Name = "passedCountLabel";
- this.passedCountLabel.Size = new System.Drawing.Size(57, 13);
- this.passedCountLabel.TabIndex = 12;
- this.passedCountLabel.Text = "passedCnt";
- //
- // purchaseOrderLabel
- //
- this.purchaseOrderLabel.AutoSize = true;
- this.purchaseOrderLabel.Location = new System.Drawing.Point(490, 7);
- this.purchaseOrderLabel.Name = "purchaseOrderLabel";
- this.purchaseOrderLabel.Size = new System.Drawing.Size(77, 13);
- this.purchaseOrderLabel.TabIndex = 11;
- this.purchaseOrderLabel.Text = "purchaseOrder";
- //
- // procedureLabel
- //
- this.procedureLabel.AutoSize = true;
- this.procedureLabel.Location = new System.Drawing.Point(334, 7);
- this.procedureLabel.Name = "procedureLabel";
- this.procedureLabel.Size = new System.Drawing.Size(55, 13);
- this.procedureLabel.TabIndex = 10;
- this.procedureLabel.Text = "procedure";
- //
- // endTimeLabel
- //
- this.endTimeLabel.AutoSize = true;
- this.endTimeLabel.Location = new System.Drawing.Point(188, 7);
- this.endTimeLabel.Name = "endTimeLabel";
- this.endTimeLabel.Size = new System.Drawing.Size(48, 13);
- this.endTimeLabel.TabIndex = 9;
- this.endTimeLabel.Text = "endTime";
- //
- // startTimeLabel
- //
- this.startTimeLabel.AutoSize = true;
- this.startTimeLabel.Location = new System.Drawing.Point(54, 7);
- this.startTimeLabel.Name = "startTimeLabel";
- this.startTimeLabel.Size = new System.Drawing.Size(50, 13);
- this.startTimeLabel.TabIndex = 8;
- this.startTimeLabel.Text = "startTime";
- //
- // batchNrLabel
- //
- this.batchNrLabel.AutoSize = true;
- this.batchNrLabel.Location = new System.Drawing.Point(3, 7);
- this.batchNrLabel.Name = "batchNrLabel";
- this.batchNrLabel.Size = new System.Drawing.Size(24, 13);
- this.batchNrLabel.TabIndex = 16;
- this.batchNrLabel.Text = "bNr";
- //
- // PreviousResultCtrl
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.Controls.Add(this.batchNrLabel);
- this.Controls.Add(this.sendButton);
- this.Controls.Add(this.sentCheckBox);
- this.Controls.Add(this.failedCountLabel);
- this.Controls.Add(this.passedCountLabel);
- this.Controls.Add(this.purchaseOrderLabel);
- this.Controls.Add(this.procedureLabel);
- this.Controls.Add(this.endTimeLabel);
- this.Controls.Add(this.startTimeLabel);
- this.Name = "PreviousResultCtrl";
- this.Size = new System.Drawing.Size(925, 26);
- this.ResumeLayout(false);
- this.PerformLayout();
+ this.sendButton = new System.Windows.Forms.Button();
+ this.sentCheckBox = new System.Windows.Forms.CheckBox();
+ this.failedCountLabel = new System.Windows.Forms.Label();
+ this.passedCountLabel = new System.Windows.Forms.Label();
+ this.purchaseOrderLabel = new System.Windows.Forms.Label();
+ this.procedureLabel = new System.Windows.Forms.Label();
+ this.endTimeLabel = new System.Windows.Forms.Label();
+ this.startTimeLabel = new System.Windows.Forms.Label();
+ this.batchNrLabel = new System.Windows.Forms.Label();
+ this.showButton = new System.Windows.Forms.Button();
+ this.SuspendLayout();
+ //
+ // sendButton
+ //
+ this.sendButton.Location = new System.Drawing.Point(832, 2);
+ this.sendButton.Name = "sendButton";
+ this.sendButton.Size = new System.Drawing.Size(75, 23);
+ this.sendButton.TabIndex = 15;
+ this.sendButton.Text = "Again";
+ this.sendButton.UseVisualStyleBackColor = true;
+ this.sendButton.Click += new System.EventHandler(this.sendButton_Click);
+ //
+ // sentCheckBox
+ //
+ this.sentCheckBox.AutoSize = true;
+ this.sentCheckBox.Location = new System.Drawing.Point(748, 6);
+ this.sentCheckBox.Name = "sentCheckBox";
+ this.sentCheckBox.Size = new System.Drawing.Size(48, 17);
+ this.sentCheckBox.TabIndex = 14;
+ this.sentCheckBox.Text = "Sent";
+ this.sentCheckBox.UseVisualStyleBackColor = true;
+ //
+ // failedCountLabel
+ //
+ this.failedCountLabel.AutoSize = true;
+ this.failedCountLabel.Location = new System.Drawing.Point(681, 7);
+ this.failedCountLabel.Name = "failedCountLabel";
+ this.failedCountLabel.Size = new System.Drawing.Size(48, 13);
+ this.failedCountLabel.TabIndex = 13;
+ this.failedCountLabel.Text = "failedCnt";
+ //
+ // passedCountLabel
+ //
+ this.passedCountLabel.AutoSize = true;
+ this.passedCountLabel.Location = new System.Drawing.Point(590, 7);
+ this.passedCountLabel.Name = "passedCountLabel";
+ this.passedCountLabel.Size = new System.Drawing.Size(57, 13);
+ this.passedCountLabel.TabIndex = 12;
+ this.passedCountLabel.Text = "passedCnt";
+ //
+ // purchaseOrderLabel
+ //
+ this.purchaseOrderLabel.AutoSize = true;
+ this.purchaseOrderLabel.Location = new System.Drawing.Point(490, 7);
+ this.purchaseOrderLabel.Name = "purchaseOrderLabel";
+ this.purchaseOrderLabel.Size = new System.Drawing.Size(77, 13);
+ this.purchaseOrderLabel.TabIndex = 11;
+ this.purchaseOrderLabel.Text = "purchaseOrder";
+ //
+ // procedureLabel
+ //
+ this.procedureLabel.AutoSize = true;
+ this.procedureLabel.Location = new System.Drawing.Point(334, 7);
+ this.procedureLabel.Name = "procedureLabel";
+ this.procedureLabel.Size = new System.Drawing.Size(55, 13);
+ this.procedureLabel.TabIndex = 10;
+ this.procedureLabel.Text = "procedure";
+ //
+ // endTimeLabel
+ //
+ this.endTimeLabel.AutoSize = true;
+ this.endTimeLabel.Location = new System.Drawing.Point(188, 7);
+ this.endTimeLabel.Name = "endTimeLabel";
+ this.endTimeLabel.Size = new System.Drawing.Size(48, 13);
+ this.endTimeLabel.TabIndex = 9;
+ this.endTimeLabel.Text = "endTime";
+ //
+ // startTimeLabel
+ //
+ this.startTimeLabel.AutoSize = true;
+ this.startTimeLabel.Location = new System.Drawing.Point(54, 7);
+ this.startTimeLabel.Name = "startTimeLabel";
+ this.startTimeLabel.Size = new System.Drawing.Size(50, 13);
+ this.startTimeLabel.TabIndex = 8;
+ this.startTimeLabel.Text = "startTime";
+ //
+ // batchNrLabel
+ //
+ this.batchNrLabel.AutoSize = true;
+ this.batchNrLabel.Location = new System.Drawing.Point(3, 7);
+ this.batchNrLabel.Name = "batchNrLabel";
+ this.batchNrLabel.Size = new System.Drawing.Size(24, 13);
+ this.batchNrLabel.TabIndex = 16;
+ this.batchNrLabel.Text = "bNr";
+ //
+ // showButton
+ //
+ this.showButton.Location = new System.Drawing.Point(913, 2);
+ this.showButton.Name = "showButton";
+ this.showButton.Size = new System.Drawing.Size(75, 23);
+ this.showButton.TabIndex = 17;
+ this.showButton.Text = "Show";
+ this.showButton.UseVisualStyleBackColor = true;
+ this.showButton.Click += new System.EventHandler(this.showButton_Click);
+ //
+ // PreviousResultCtrl
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.showButton);
+ this.Controls.Add(this.batchNrLabel);
+ this.Controls.Add(this.sendButton);
+ this.Controls.Add(this.sentCheckBox);
+ this.Controls.Add(this.failedCountLabel);
+ this.Controls.Add(this.passedCountLabel);
+ this.Controls.Add(this.purchaseOrderLabel);
+ this.Controls.Add(this.procedureLabel);
+ this.Controls.Add(this.endTimeLabel);
+ this.Controls.Add(this.startTimeLabel);
+ this.Name = "PreviousResultCtrl";
+ this.Size = new System.Drawing.Size(1016, 26);
+ this.ResumeLayout(false);
+ this.PerformLayout();
}
@@ -153,6 +165,7 @@
private System.Windows.Forms.Label endTimeLabel;
private System.Windows.Forms.Label startTimeLabel;
private System.Windows.Forms.Label batchNrLabel;
+ private System.Windows.Forms.Button showButton;
}
}
diff --git a/TestBenchFramework/Forms/PreviousResultCtrl.cs b/TestBenchFramework/Forms/PreviousResultCtrl.cs
index 415064ad9..3286bce0b 100644
--- a/TestBenchFramework/Forms/PreviousResultCtrl.cs
+++ b/TestBenchFramework/Forms/PreviousResultCtrl.cs
@@ -78,5 +78,10 @@ namespace TBF.Forms
{
parent.OnSendAgain(this, new PreviousResultIdEventArgs(BatchNr));
}
+
+ private void showButton_Click(object sender, EventArgs e)
+ {
+ parent.OnShowResults(this, new PreviousResultIdEventArgs(BatchNr));
+ }
}
}
diff --git a/TestBenchFramework/Forms/PreviousResultsDlg.cs b/TestBenchFramework/Forms/PreviousResultsDlg.cs
index c388dc5b4..6d370026c 100644
--- a/TestBenchFramework/Forms/PreviousResultsDlg.cs
+++ b/TestBenchFramework/Forms/PreviousResultsDlg.cs
@@ -36,7 +36,12 @@ namespace TBF.Forms
else DoSendAgain(sndr, args);
};
- }
+ ShowResultsHandler += delegate(object sndr, PreviousResultIdEventArgs args)
+ {
+ if (InvokeRequired) { Invoke(new EventHandler(DoShowResults), sndr, args); }
+ else DoShowResults(sndr, args);
+ };
+ }
private void PreviousResultsDlg_Load(object sender, EventArgs e)
{
@@ -129,6 +134,40 @@ namespace TBF.Forms
}
+ public event EventHandler ShowResultsHandler;
+
+ ///
+ /// Called from PreviousResultCtrl when 'Show' button pressed.
+ ///
+ public void OnShowResults(object sender, PreviousResultIdEventArgs data)
+ {
+ if (ShowResultsHandler == null) return;
+ try { ShowResultsHandler(sender, data); }
+ catch (Exception e) { log.Error("ShowResultsHandler(...) failed", e); }
+ }
+
+ public void DoShowResults(object sender, PreviousResultIdEventArgs data)
+ {
+ Results.Forms.BatchResultsDlg dlg = new Results.Forms.BatchResultsDlg();
+ dlg.MetersArrangement = Program.LocalSettings.ResultsConfigMeters;
+ dlg.TestsArrangement = Program.LocalSettings.ResultsConfigTests;
+ dlg.NrMetersInOneGroup = Math.Max(1, Program.LocalSettings.ResultsConfigMetersInOneGroup);
+
+ dlg.RsltItems_Screen_SingleWM = Results.ItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Screen_SingleWM);
+ dlg.RsltItems_Screen_CombinedWM = Results.ItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Screen_CombinedWM);
+ dlg.RsltsClmnWidths = Program.LocalSettings.RsltsClmnWidths;
+
+ foreach (var b in batches)
+ {
+ if (b.BatchNr == data.BatchNr)
+ {
+ dlg.Results = Results.BatchResults.FromBatch(b);
+ break;
+ }
+ }
+ }
+
+
void Redraw()
{
SuspendLayout();
diff --git a/TestBenchFramework/Properties/AssemblyInfo.cs b/TestBenchFramework/Properties/AssemblyInfo.cs
index be6371cbc..be0575045 100644
--- a/TestBenchFramework/Properties/AssemblyInfo.cs
+++ b/TestBenchFramework/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
-[assembly: AssemblyVersion("2.7.303.1")]
-[assembly: AssemblyFileVersion("2.7.303.1")]
+[assembly: AssemblyVersion("2.7.305.1")]
+[assembly: AssemblyFileVersion("2.7.305.1")]
diff --git a/TestBenchFramework/Screens/ResultsTabPageCtrl.Designer.cs b/TestBenchFramework/Screens/ResultsTabPageCtrl.Designer.cs
index 642239011..4a45d6851 100644
--- a/TestBenchFramework/Screens/ResultsTabPageCtrl.Designer.cs
+++ b/TestBenchFramework/Screens/ResultsTabPageCtrl.Designer.cs
@@ -31,104 +31,102 @@ namespace TBF.Screens
///
private void InitializeComponent()
{
- this.splitContainer = new System.Windows.Forms.SplitContainer();
- this.columnWidthsButton = new System.Windows.Forms.Button();
- this.previousResultsButton = new System.Windows.Forms.Button();
- this.configureButton = new System.Windows.Forms.Button();
- this.flowLayoutPanel = new System.Windows.Forms.FlowLayoutPanel();
- ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
- this.splitContainer.Panel1.SuspendLayout();
- this.splitContainer.Panel2.SuspendLayout();
- this.splitContainer.SuspendLayout();
- this.SuspendLayout();
- //
- // splitContainer
- //
- this.splitContainer.Dock = System.Windows.Forms.DockStyle.Fill;
- this.splitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
- this.splitContainer.IsSplitterFixed = true;
- this.splitContainer.Location = new System.Drawing.Point(0, 0);
- this.splitContainer.Name = "splitContainer";
- this.splitContainer.Orientation = System.Windows.Forms.Orientation.Horizontal;
- //
- // splitContainer.Panel1
- //
- this.splitContainer.Panel1.BackColor = System.Drawing.SystemColors.Control;
- this.splitContainer.Panel1.Controls.Add(this.columnWidthsButton);
- this.splitContainer.Panel1.Controls.Add(this.previousResultsButton);
- this.splitContainer.Panel1.Controls.Add(this.configureButton);
- //
- // splitContainer.Panel2
- //
- this.splitContainer.Panel2.Controls.Add(this.flowLayoutPanel);
- this.splitContainer.Size = new System.Drawing.Size(1057, 706);
- this.splitContainer.SplitterDistance = 42;
- this.splitContainer.TabIndex = 0;
- //
- // columnWidthsButton
- //
- this.columnWidthsButton.Location = new System.Drawing.Point(126, 10);
- this.columnWidthsButton.Name = "columnWidthsButton";
- this.columnWidthsButton.Size = new System.Drawing.Size(120, 30);
- this.columnWidthsButton.TabIndex = 1;
- this.columnWidthsButton.Text = "Save column widths";
- this.columnWidthsButton.UseVisualStyleBackColor = true;
- this.columnWidthsButton.Click += new System.EventHandler(this.columnWidthsButton_Click);
- //
- // previousResultsButton
- //
- this.previousResultsButton.Location = new System.Drawing.Point(252, 10);
- this.previousResultsButton.Name = "previousResultsButton";
- this.previousResultsButton.Size = new System.Drawing.Size(147, 30);
- this.previousResultsButton.TabIndex = 2;
- this.previousResultsButton.Text = "Previous results";
- this.previousResultsButton.UseVisualStyleBackColor = true;
- this.previousResultsButton.Click += new System.EventHandler(this.previousResultsButton_Click);
- //
- // configureButton
- //
- this.configureButton.Location = new System.Drawing.Point(20, 10);
- this.configureButton.Name = "configureButton";
- this.configureButton.Size = new System.Drawing.Size(100, 30);
- this.configureButton.TabIndex = 0;
- this.configureButton.Text = "Configure";
- this.configureButton.UseVisualStyleBackColor = true;
- this.configureButton.Click += new System.EventHandler(this.configureButton_Click);
- //
- // flowLayoutPanel
- //
- this.flowLayoutPanel.AutoScroll = true;
- this.flowLayoutPanel.BackColor = System.Drawing.SystemColors.Control;
- this.flowLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill;
- this.flowLayoutPanel.Location = new System.Drawing.Point(0, 0);
- this.flowLayoutPanel.Name = "flowLayoutPanel";
- this.flowLayoutPanel.Size = new System.Drawing.Size(1057, 660);
- this.flowLayoutPanel.TabIndex = 0;
- //
- // ResultsTabPageCtrl
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.Silver;
- this.Controls.Add(this.splitContainer);
- this.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
- this.Name = "ResultsTabPageCtrl";
- this.Size = new System.Drawing.Size(1057, 706);
- this.Load += new System.EventHandler(this.ResultsTabPageCtrl_Load);
- this.splitContainer.Panel1.ResumeLayout(false);
- this.splitContainer.Panel2.ResumeLayout(false);
- ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).EndInit();
- this.splitContainer.ResumeLayout(false);
- this.ResumeLayout(false);
+ this.splitContainer = new System.Windows.Forms.SplitContainer();
+ this.columnWidthsButton = new System.Windows.Forms.Button();
+ this.previousResultsButton = new System.Windows.Forms.Button();
+ this.configureButton = new System.Windows.Forms.Button();
+ this.batchResultsCtrl = new Results.UiControls.BatchResultsCtrl();
+ ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
+ this.splitContainer.Panel1.SuspendLayout();
+ this.splitContainer.Panel2.SuspendLayout();
+ this.splitContainer.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // splitContainer
+ //
+ this.splitContainer.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.splitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
+ this.splitContainer.IsSplitterFixed = true;
+ this.splitContainer.Location = new System.Drawing.Point(0, 0);
+ this.splitContainer.Name = "splitContainer";
+ this.splitContainer.Orientation = System.Windows.Forms.Orientation.Horizontal;
+ //
+ // splitContainer.Panel1
+ //
+ this.splitContainer.Panel1.BackColor = System.Drawing.SystemColors.Control;
+ this.splitContainer.Panel1.Controls.Add(this.columnWidthsButton);
+ this.splitContainer.Panel1.Controls.Add(this.previousResultsButton);
+ this.splitContainer.Panel1.Controls.Add(this.configureButton);
+ //
+ // splitContainer.Panel2
+ //
+ this.splitContainer.Panel2.Controls.Add(this.batchResultsCtrl);
+ this.splitContainer.Size = new System.Drawing.Size(1057, 706);
+ this.splitContainer.SplitterDistance = 42;
+ this.splitContainer.TabIndex = 0;
+ //
+ // columnWidthsButton
+ //
+ this.columnWidthsButton.Location = new System.Drawing.Point(126, 10);
+ this.columnWidthsButton.Name = "columnWidthsButton";
+ this.columnWidthsButton.Size = new System.Drawing.Size(120, 30);
+ this.columnWidthsButton.TabIndex = 1;
+ this.columnWidthsButton.Text = "Save column widths";
+ this.columnWidthsButton.UseVisualStyleBackColor = true;
+ this.columnWidthsButton.Click += new System.EventHandler(this.columnWidthsButton_Click);
+ //
+ // previousResultsButton
+ //
+ this.previousResultsButton.Location = new System.Drawing.Point(252, 10);
+ this.previousResultsButton.Name = "previousResultsButton";
+ this.previousResultsButton.Size = new System.Drawing.Size(147, 30);
+ this.previousResultsButton.TabIndex = 2;
+ this.previousResultsButton.Text = "Previous results";
+ this.previousResultsButton.UseVisualStyleBackColor = true;
+ this.previousResultsButton.Click += new System.EventHandler(this.previousResultsButton_Click);
+ //
+ // configureButton
+ //
+ this.configureButton.Location = new System.Drawing.Point(20, 10);
+ this.configureButton.Name = "configureButton";
+ this.configureButton.Size = new System.Drawing.Size(100, 30);
+ this.configureButton.TabIndex = 0;
+ this.configureButton.Text = "Configure";
+ this.configureButton.UseVisualStyleBackColor = true;
+ this.configureButton.Click += new System.EventHandler(this.configureButton_Click);
+ //
+ // batchResultsCtrl
+ //
+ this.batchResultsCtrl.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.batchResultsCtrl.Location = new System.Drawing.Point(0, 0);
+ this.batchResultsCtrl.Name = "batchResultsCtrl";
+ this.batchResultsCtrl.Size = new System.Drawing.Size(1057, 660);
+ this.batchResultsCtrl.TabIndex = 0;
+ //
+ // ResultsTabPageCtrl
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.BackColor = System.Drawing.Color.Silver;
+ this.Controls.Add(this.splitContainer);
+ this.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
+ this.Name = "ResultsTabPageCtrl";
+ this.Size = new System.Drawing.Size(1057, 706);
+ this.Load += new System.EventHandler(this.ResultsTabPageCtrl_Load);
+ this.splitContainer.Panel1.ResumeLayout(false);
+ this.splitContainer.Panel2.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).EndInit();
+ this.splitContainer.ResumeLayout(false);
+ this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.SplitContainer splitContainer;
- private System.Windows.Forms.Button configureButton;
- private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel;
+ private System.Windows.Forms.Button configureButton;
private System.Windows.Forms.Button columnWidthsButton;
private System.Windows.Forms.Button previousResultsButton;
+ private Results.UiControls.BatchResultsCtrl batchResultsCtrl;
}
}
diff --git a/TestBenchFramework/Screens/ResultsTabPageCtrl.cs b/TestBenchFramework/Screens/ResultsTabPageCtrl.cs
index 8408c5893..8aee53eec 100644
--- a/TestBenchFramework/Screens/ResultsTabPageCtrl.cs
+++ b/TestBenchFramework/Screens/ResultsTabPageCtrl.cs
@@ -4,14 +4,12 @@
using System;
using System.Collections.Generic;
using System.Drawing;
-using System.Linq;
-using System.Text;
using System.Windows.Forms;
using log4net;
-using Config;
using Config.Entities;
using TBF.Resources;
using TBF.UiBridge;
+using Results.UiControls;
namespace TBF.Screens
{
@@ -19,24 +17,8 @@ namespace TBF.Screens
{
static readonly ILog log = LogManager.GetLogger(typeof(ResultsTabPageCtrl));
- public MetersArrangement MetersArrangement;
- public TestsArrangement TestsArrangement;
- public int NrMetersInOneGroup;
-
- public IList RsltItems_Screen_SingleWM;
- public IList RsltItems_Screen_CombinedWM;
public IList RsltItems_Printer_SingleWM;
public IList RsltItems_Printer_CombinedWM;
- public IList RsltItems_Disk_SingleWM;
- public IList RsltItems_Disk_CombinedWM;
-
- Procedure procedure;
- IList testResults;
- bool compound;
- ListView firstListView;
-
- int lvWidth;
- int lvHeight;
///
/// Constructor
@@ -68,12 +50,12 @@ namespace TBF.Screens
void OnProcedureSelected(object sender, ProcedureSelectedEventArgs args)
{
- RedrawAll(TBF.BenchControl.Sequences.ProcessData.BatchRslts);
+ batchResultsCtrl.Display(TBF.BenchControl.Sequences.ProcessData.BatchRslts);
}
void OnTestCompleted(object sender, TestCompletedEventArgs args)
{
- RedrawAll(TBF.BenchControl.Sequences.ProcessData.BatchRslts);
+ batchResultsCtrl.Display(TBF.BenchControl.Sequences.ProcessData.BatchRslts);
}
private void ResultsTabPageCtrl_Load(object sender, EventArgs e)
@@ -83,15 +65,14 @@ namespace TBF.Screens
columnWidthsButton.Text = Strings.Save_column_widths;
previousResultsButton.Text = Strings.Previous_results;
- MetersArrangement = Program.LocalSettings.ResultsConfigMeters;
- TestsArrangement = Program.LocalSettings.ResultsConfigTests;
- NrMetersInOneGroup = Math.Max(1, Program.LocalSettings.ResultsConfigMetersInOneGroup);
- RsltItems_Screen_SingleWM = Results.ItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Screen_SingleWM);
- RsltItems_Screen_CombinedWM = Results.ItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Screen_CombinedWM);
- RsltItems_Printer_SingleWM = Results.ItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Printer_SingleWM);
- RsltItems_Printer_CombinedWM = Results.ItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Printer_CombinedWM);
+ RsltItems_Printer_SingleWM = Results.ItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Printer_SingleWM);
+ RsltItems_Printer_CombinedWM = Results.ItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Printer_CombinedWM);
- RedrawAll(TBF.BenchControl.Sequences.ProcessData.BatchRslts);
+ batchResultsCtrl.MetersArrangement = Program.LocalSettings.ResultsConfigMeters;
+ batchResultsCtrl.TestsArrangement = Program.LocalSettings.ResultsConfigTests;
+ batchResultsCtrl.NrMetersInOneGroup = Math.Max(1, Program.LocalSettings.ResultsConfigMetersInOneGroup);
+ batchResultsCtrl.RsltItems_Screen_SingleWM = Results.ItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Screen_SingleWM);
+ batchResultsCtrl.RsltItems_Screen_CombinedWM = Results.ItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Screen_CombinedWM);
}
///
@@ -99,39 +80,40 @@ namespace TBF.Screens
///
private void configureButton_Click(object sender, EventArgs e)
{
- TBF.Forms.ResultsConfig dlg = new TBF.Forms.ResultsConfig(compound);
+ TBF.Forms.ResultsConfig dlg = new TBF.Forms.ResultsConfig(batchResultsCtrl.Compound);
- dlg.TestsArrangement = TestsArrangement;
- dlg.MetersArrangement = MetersArrangement;
- dlg.NrMetersInOneGroup = NrMetersInOneGroup;
+ dlg.TestsArrangement = batchResultsCtrl.TestsArrangement;
+ dlg.MetersArrangement = batchResultsCtrl.MetersArrangement;
+ dlg.NrMetersInOneGroup = batchResultsCtrl.NrMetersInOneGroup;
- dlg.RsltItems_Screen_SingleWM = RsltItems_Screen_SingleWM;
- dlg.RsltItems_Screen_CombinedWM = RsltItems_Screen_CombinedWM;
+ dlg.RsltItems_Screen_SingleWM = batchResultsCtrl.RsltItems_Screen_SingleWM;
+ dlg.RsltItems_Screen_CombinedWM = batchResultsCtrl.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;
- NrMetersInOneGroup = dlg.NrMetersInOneGroup;
+ batchResultsCtrl.MetersArrangement = dlg.MetersArrangement;
+ batchResultsCtrl.TestsArrangement = dlg.TestsArrangement;
+ batchResultsCtrl.NrMetersInOneGroup = dlg.NrMetersInOneGroup;
- RsltItems_Screen_SingleWM = dlg.RsltItems_Screen_SingleWM;
- RsltItems_Screen_CombinedWM = dlg.RsltItems_Screen_CombinedWM;
+ batchResultsCtrl.RsltItems_Screen_SingleWM = dlg.RsltItems_Screen_SingleWM;
+ batchResultsCtrl.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.ResultsConfigMetersInOneGroup = NrMetersInOneGroup;
+ Program.LocalSettings.ResultsConfigMeters = batchResultsCtrl.MetersArrangement;
+ Program.LocalSettings.ResultsConfigTests = batchResultsCtrl.TestsArrangement;
+ Program.LocalSettings.ResultsConfigMetersInOneGroup = batchResultsCtrl.NrMetersInOneGroup;
- Program.LocalSettings.RsltItems_Screen_SingleWM = Results.ItemSpec.ToStrArray(RsltItems_Screen_SingleWM);
- Program.LocalSettings.RsltItems_Screen_CombinedWM = Results.ItemSpec.ToStrArray(RsltItems_Screen_CombinedWM);
+ Program.LocalSettings.RsltItems_Screen_SingleWM = Results.ItemSpec.ToStrArray(batchResultsCtrl.RsltItems_Screen_SingleWM);
+ Program.LocalSettings.RsltItems_Screen_CombinedWM = Results.ItemSpec.ToStrArray(batchResultsCtrl.RsltItems_Screen_CombinedWM);
Program.LocalSettings.RsltItems_Printer_SingleWM = Results.ItemSpec.ToStrArray(RsltItems_Printer_SingleWM);
Program.LocalSettings.RsltItems_Printer_CombinedWM = Results.ItemSpec.ToStrArray(RsltItems_Printer_CombinedWM);
Program.LocalSettings.Save();
}
- RedrawAll(TBF.BenchControl.Sequences.ProcessData.BatchRslts);
+
+ batchResultsCtrl.Redraw();
}
///
@@ -142,311 +124,15 @@ namespace TBF.Screens
new TBF.Forms.PreviousResultsDlg().ShowDialog();
}
- #region Redraw
-
- ///
- /// Re-draw the results. Apply new settings if they changed.
- ///
- void RedrawAll(Results.BatchResults results)
+ private void columnWidthsButton_Click(object sender, EventArgs e)
{
- this.SuspendLayout();
-
- try
- {
- /// Determine how many water meters were enabled for result evaluation and printing
- int enabledWMsCount = 0;
- for (int i = 0; i < results.WMPositionsCount; i++)
- {
- if (results.WaterMeters[i] != null && !results.WaterMeters[i].Disabled)
- {
- enabledWMsCount++;
- }
- }
-
- int metersInOneGroup = Math.Max(1, Math.Min(enabledWMsCount, NrMetersInOneGroup));
- int nrGroups = Math.Max(1, (enabledWMsCount + NrMetersInOneGroup - 1) / metersInOneGroup);
-
- if (MetersArrangement == MetersArrangement.Horizontally)
- {
- flowLayoutPanel.FlowDirection = FlowDirection.LeftToRight;
- lvWidth = flowLayoutPanel.Width / metersInOneGroup - 6;
- lvHeight = flowLayoutPanel.Height / nrGroups - 6;
- }
- else
- {
- flowLayoutPanel.FlowDirection = FlowDirection.TopDown;
- lvWidth = flowLayoutPanel.Width / nrGroups - 6;
- lvHeight = flowLayoutPanel.Height / metersInOneGroup - 6;
- }
- flowLayoutPanel.Controls.Clear();
- flowLayoutPanel.WrapContents = true;
- flowLayoutPanel.AutoScroll = true;
-
- bool first = true;
- for (int i = 0; i < results.WMPositionsCount; i++)
- {
- if (results.WaterMeters[i] != null && !results.WaterMeters[i].Disabled)
- {
- if (TestsArrangement == TestsArrangement.Rows)
- {
- ListView lview = GetResultsTestsAreRows(results.WaterMeters[i], i + 1);
- if (first) { firstListView = lview; first = false; }
- if (lview != null) flowLayoutPanel.Controls.Add(lview);
- }
- else
- {
- ListView lview = GetResultsTestsAreColumns(results.WaterMeters[i], i + 1);
- if (first) { firstListView = lview; first = false; }
- if (lview != null) flowLayoutPanel.Controls.Add(lview);
- }
- }
- }
- }
- catch (Exception e)
- {
- log.FatalFormat("Redrawing results failed : {0}", e.Message);
- if (e.InnerException != null)
- {
- log.FatalFormat("InnerMessage : {0}", e.InnerException.Message);
- }
- log.FatalFormat("StackTrace : {0}{1}", Environment.NewLine, e.StackTrace);
- }
-
- this.ResumeLayout(false);
- }
-
- ///
- /// Get an empty ListView control with appropriate parameters.
- ///
- /// ListView control
- ListView GetListView()
- {
- ListView lview = new ListView();
- lview.AllowColumnReorder = false;
- lview.Dock = System.Windows.Forms.DockStyle.None;
- lview.FullRowSelect = true;
- lview.GridLines = true;
- lview.Location = new System.Drawing.Point(0, 0);
- lview.Size = new System.Drawing.Size(lvWidth, lvHeight);
- lview.TabIndex = 0;
- lview.UseCompatibleStateImageBehavior = false;
- lview.View = System.Windows.Forms.View.Details;
- return lview;
- }
-
-
- ///
- /// Get decorated test names for a specified watermeter
- ///
- /// Watermeter results entity
- /// A list of strings
- IList GetAllDecoratedTestNames(Results.Entities.WaterMeter wMtr)
- {
- IList testNames = new List();
-
- foreach (var mtr in wMtr.MeterTestRslts)
- {
- if ( (mtr.CompoundMeterId == (byte)CompoundMeterId.Single || mtr.CompoundMeterId == (byte)CompoundMeterId.Compound)
- && mtr.TestDone
- && (mtr.Publish() != Config.Entities.Publish.Never)
- && (mtr.Publish() != Config.Entities.Publish.Internal))
- {
- testNames.Add(mtr.Name());
- }
- }
-
- return testNames;
- }
-
-
- ///
- /// Get a ListView control filled with results of the meter 'mtr'
- ///
- /// Water meter number (1-based): 1 .. Config.Data.WMsCount
- /// ListView object
- ListView GetResultsTestsAreRows(Results.Entities.WaterMeter wMtr, int printedWMNr)
- {
- compound = wMtr.Compound();
-
- ListView lview = GetListView();
-
- IList items = (compound ? RsltItems_Screen_CombinedWM : RsltItems_Screen_SingleWM);
- if (items == null || items.Count == 0) return lview;
-
- // Header
- TBF.LocalSettings ls = Program.LocalSettings;
- lview.Columns.Add(printedWMNr.ToString(), (ls.RsltsClmnCount > 0) ? ls.RsltsClmnWidths[0] : 40);
- int i = 1;
- foreach (var item in items)
- {
- lview.Columns.Add(item.ClmnHeaderText, (ls.RsltsClmnCount > i) ? ls.RsltsClmnWidths[i] : 70);
- i++;
- }
-
-
- IList testNames = GetAllDecoratedTestNames(wMtr);
- int ix = 0;
- foreach (var mtr in wMtr.MeterTestRslts)
- {
- if ((mtr.CompoundMeterId == (byte)CompoundMeterId.Single || mtr.CompoundMeterId == (byte)CompoundMeterId.Compound)
- && mtr.TestDone
- && (mtr.Publish() != Config.Entities.Publish.Never)
- && (mtr.Publish() != Config.Entities.Publish.Internal))
- {
- ListViewItem lvi = new ListViewItem(testNames[ix++]);
-
- foreach (var item in items)
- {
- string str;
- if (compound)
- {
- var main = wMtr.GetMeterTestRslt(mtr.Name(), CompoundMeterId.CompoundMain);
- var aux = wMtr.GetMeterTestRslt(mtr.Name(), CompoundMeterId.CompoundAux);
- str = (item.CanPrintCombined && main != null && aux != null)
- ? item.PrintCombined(main, aux, mtr)
- : string.Empty;
- }
- else
- {
- str = item.CanPrintSingle ? item.Print(mtr) : string.Empty;
- }
-
- string[] texts = str.Split(new char[] { '|' });
- if (texts.Length == 1)
- {
- lvi.SubItems.Add(str);
- }
- else if (texts.Length == 2)
- {
- Color color = texts[1].Equals("Green") ? Color.Green : (texts[1].Equals("Red") ? Color.Red : Color.White);
- lvi.UseItemStyleForSubItems = false;
- lvi.SubItems.Add(texts[0]);
- lvi.SubItems[lvi.SubItems.Count - 1].BackColor = color;
- }
- else
- {
- lvi.SubItems.Add(string.Empty);
- }
- }
-
- lview.Items.Add(lvi);
- }
- }
-
- return lview;
- }
-
-
- ///
- /// Get a ListView control filled with results of the meter 'mtr'
- ///
- /// Water meter number (1-based): 1 .. Config.Data.WMsCount
- /// ListView object
- ListView GetResultsTestsAreColumns(Results.Entities.WaterMeter wMtr, int printedWMNr)
- {
- compound = wMtr.Compound();
-
- ListView lview = GetListView();
-
- IList items = (compound ? RsltItems_Screen_CombinedWM : RsltItems_Screen_SingleWM);
- if (items == null || items.Count == 0) return lview;
-
- // Header
- TBF.LocalSettings ls = Program.LocalSettings;
- lview.Columns.Add(printedWMNr.ToString(), (ls.RsltsClmnCount > 0) ? ls.RsltsClmnWidths[0] : 40);
- int i = 1;
- foreach (var str in GetAllDecoratedTestNames(wMtr))
- {
- lview.Columns.Add(str, (ls.RsltsClmnCount > i) ? ls.RsltsClmnWidths[i] : 70);
- i++;
- }
-
- foreach (var item in items)
- {
- ListViewItem lvi = new ListViewItem(item.ClmnHeaderText);
- if (compound)
- {
- foreach (var mtr in wMtr.MeterTestRslts)
- {
- if (mtr.CompoundMeterId == (byte)CompoundMeterId.Compound && mtr.TestDone
- && (mtr.Publish() != Config.Entities.Publish.Never)
- && (mtr.Publish() != Config.Entities.Publish.Internal))
- {
- var main = wMtr.GetMeterTestRslt(mtr.Name(), CompoundMeterId.CompoundMain);
- var aux = wMtr.GetMeterTestRslt(mtr.Name(), CompoundMeterId.CompoundAux);
-
- string str = (item.CanPrintCombined && main != null && aux != null)
- ? item.PrintCombined(main, aux, mtr)
- : string.Empty;
-
- string[] texts = str.Split(new char[] { '|' });
- if (texts.Length == 1)
- {
- lvi.SubItems.Add(str);
- }
- else if (texts.Length == 2)
- {
- Color color = texts[1].Equals("Green") ? Color.Green : (texts[1].Equals("Red") ? Color.Red : Color.White);
- lvi.UseItemStyleForSubItems = false;
- lvi.SubItems.Add(texts[0]);
- lvi.SubItems[lvi.SubItems.Count - 1].BackColor = color;
- }
- else
- {
- lvi.SubItems.Add(string.Empty);
- }
- }
- }
- }
- else
- {
- foreach (var mtr in wMtr.MeterTestRslts)
- {
- if (mtr.TestDone && (mtr.Publish() != Config.Entities.Publish.Never)
- && (mtr.Publish() != Config.Entities.Publish.Internal))
- {
- string str = !item.CanPrintSingle ? string.Empty : item.Print(mtr);
-
- string[] texts = str.Split(new char[] { '|' });
- if (texts.Length == 1)
- {
- lvi.SubItems.Add(str);
- }
- else if (texts.Length == 2)
- {
- Color color = texts[1].Equals("Green") ? Color.Green : (texts[1].Equals("Red") ? Color.Red : Color.White);
- lvi.UseItemStyleForSubItems = false;
- lvi.SubItems.Add(texts[0]);
- lvi.SubItems[lvi.SubItems.Count - 1].BackColor = color;
- }
- else
- {
- lvi.SubItems.Add(string.Empty);
- }
- }
- }
- }
- lview.Items.Add(lvi);
- }
-
- return lview;
- }
-
- #endregion
-
- private void columnWidthsButton_Click(object sender, EventArgs e)
- {
- if (firstListView == null) return;
-
- /// Update the column widths
- Program.LocalSettings.RsltsClmnWidths = new int[firstListView.Columns.Count];
- for (int i = 0; i < firstListView.Columns.Count; i++)
- {
- Program.LocalSettings.RsltsClmnWidths[i] = firstListView.Columns[i].Width;
- }
- Program.LocalSettings.Save();
-
- RedrawAll(TBF.BenchControl.Sequences.ProcessData.BatchRslts);
+ int[] columnWidths = batchResultsCtrl.RsltsClmnWidths;
+ if (columnWidths != null)
+ {
+ Program.LocalSettings.RsltsClmnWidths = columnWidths;
+ Program.LocalSettings.Save();
+ batchResultsCtrl.Redraw();
+ }
}
}
}