ResultsBrowser: Statistics implemented (NOK yet), user options saved in LocalSettings.

This commit is contained in:
Milan Hanajik 2016-06-03 14:03:12 +02:00
parent 52f600cb94
commit 59fc7e30d8
14 changed files with 979 additions and 25 deletions

View File

@ -33,8 +33,8 @@ namespace ResultsBrowser.Forms
void Localize()
{
Text = "Select a Filters";
label1.Text = "Filters";
Text = Strings.Select_a_filter;
label1.Text = Strings.Filters;
okButton.Text = Strings.OkBtnText;
cancelButton.Text = Strings.CancelBtnText;
}

View File

@ -0,0 +1,126 @@
namespace ResultsBrowser.Forms
{
partial class StatisticsDlg
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.statisticsListView = new System.Windows.Forms.ListView();
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
this.okButton = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit();
this.splitContainer2.Panel2.SuspendLayout();
this.splitContainer2.SuspendLayout();
this.SuspendLayout();
//
// splitContainer1
//
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
this.splitContainer1.Name = "splitContainer1";
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.statisticsListView);
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.splitContainer2);
this.splitContainer1.Size = new System.Drawing.Size(572, 409);
this.splitContainer1.SplitterDistance = 320;
this.splitContainer1.TabIndex = 0;
//
// statisticsListView
//
this.statisticsListView.Dock = System.Windows.Forms.DockStyle.Fill;
this.statisticsListView.GridLines = true;
this.statisticsListView.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
this.statisticsListView.Location = new System.Drawing.Point(0, 0);
this.statisticsListView.Name = "statisticsListView";
this.statisticsListView.Size = new System.Drawing.Size(572, 320);
this.statisticsListView.TabIndex = 0;
this.statisticsListView.UseCompatibleStateImageBehavior = false;
//
// splitContainer2
//
this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer2.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
this.splitContainer2.Location = new System.Drawing.Point(0, 0);
this.splitContainer2.Name = "splitContainer2";
//
// splitContainer2.Panel2
//
this.splitContainer2.Panel2.Controls.Add(this.okButton);
this.splitContainer2.Size = new System.Drawing.Size(572, 85);
this.splitContainer2.SplitterDistance = 390;
this.splitContainer2.TabIndex = 0;
//
// okButton
//
this.okButton.Location = new System.Drawing.Point(45, 20);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(108, 41);
this.okButton.TabIndex = 0;
this.okButton.Text = "OK";
this.okButton.UseVisualStyleBackColor = true;
this.okButton.Click += new System.EventHandler(this.okButton_Click);
//
// StatisticsDlg
//
this.AcceptButton = this.okButton;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(572, 409);
this.Controls.Add(this.splitContainer1);
this.Name = "StatisticsDlg";
this.Text = "StatisticsDlg";
this.Load += new System.EventHandler(this.StatisticsDlg_Load);
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
this.splitContainer2.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit();
this.splitContainer2.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.ListView statisticsListView;
private System.Windows.Forms.SplitContainer splitContainer2;
private System.Windows.Forms.Button okButton;
}
}

View File

@ -0,0 +1,155 @@
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using Results.Entities;
using ResultsBrowser.Resources;
namespace ResultsBrowser.Forms
{
public partial class StatisticsDlg : Form
{
IList<WaterMeter> waterMeters;
bool twoDim;
//int rowItemID;
//int columnItemID;
//string rowTestSpec;
//string columnTestSpec;
Results.WMeterRsltItemSpec rowItem;
Results.WMeterRsltItemSpec columnItem;
IList<string> rowValues;
IList<string> columnValues;
public StatisticsDlg(IList<WaterMeter> waterMeters, bool twoDim, int rowItemID, int columnItemID, string rowTestSpec, string columnTestSpec)
{
InitializeComponent();
Text = Strings.Statistics;
okButton.Text = Strings.OkBtnText;
this.waterMeters = waterMeters;
this.twoDim = twoDim;
foreach (var item in Results.WMeterRsltItemSpec.AllItems)
{
if (item.Uid == rowItemID)
{
rowItem = item.Clone();
item.TestID = rowTestSpec;
}
if (twoDim && item.Uid == columnItemID)
{
columnItem = item.Clone();
item.TestID = columnTestSpec;
}
}
//this.rowItemID = rowItemID;
//this.columnItemID = columnItemID;
//this.rowTestSpec = rowTestSpec;
//this.columnTestSpec = columnTestSpec;
}
private void StatisticsDlg_Load(object sender, EventArgs e)
{
Calculate();
}
bool Calculate()
{
try
{
rowValues = new List<string>();
columnValues = new List<string>();
///
/// Find discrete values of rows and columns
///
foreach (var wm in waterMeters)
{
string value = rowItem.Print(wm);
if (!rowValues.Contains(value)) rowValues.Add(value);
if (twoDim)
{
value = columnItem.Print(wm);
if (!columnValues.Contains(value)) columnValues.Add(value);
}
}
///
/// Calculate occurances
///
int columns = Math.Max(1, columnValues.Count);
int[,] occurances = new int[rowValues.Count, columns];
foreach (var wm in waterMeters)
{
for (int row = 0; row < rowValues.Count; row++)
{
if (twoDim)
{
for (int column = 0; column < columns; column++)
{
if (rowItem.Print(wm).Equals(rowValues[row]) && columnItem.Print(wm).Equals(columnValues[column]))
{
occurances[row, column]++;
}
}
}
else
{
if (rowItem.Print(wm).Equals(rowValues[row])) occurances[row, 0]++;
}
}
}
///
/// Update ListBox
///
statisticsListView.Columns.Add(new ColumnHeader { Text = "*", Width = 200 });
statisticsListView.Columns.Add(new ColumnHeader { Text = "a", Width = 70 });
statisticsListView.Columns.Add(new ColumnHeader { Text = "b", Width = 70 });
ListViewItem lvi = new ListViewItem("row1");
lvi.SubItems.Add("c");
lvi.SubItems.Add("d");
statisticsListView.Items.Add(lvi);
lvi = new ListViewItem("row2");
lvi.SubItems.Add("e");
lvi.SubItems.Add("f");
statisticsListView.Items.Add(lvi);
//statisticsListView.Columns.Add(new ColumnHeader { Text = "*", Width = 200 });
//for (int column = 0; column < columns; column++)
//{
// statisticsListView.Columns.Add(new ColumnHeader { Text = twoDim ? columnValues[column] : "Count", Width = 70 });
//}
//for (int row = 0; row < rowValues.Count; row++)
//{
// ListViewItem lvi = new ListViewItem(rowValues[row]);
// for (int column = 0; column < columns; column++) lvi.SubItems.Add(occurances[row, column].ToString());
// statisticsListView.Items.Add(lvi);
//}
return true;
}
catch (Exception exc)
{
MessageBox.Show(exc.Message, Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return false;
}
}
private void okButton_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.OK;
Close();
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,188 @@
namespace ResultsBrowser.Forms
{
partial class StatisticsOptionsDlg
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.cancelButton = new System.Windows.Forms.Button();
this.okButton = new System.Windows.Forms.Button();
this.rowsGroupBox = new System.Windows.Forms.GroupBox();
this.rowTestSpecTextBox = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.rowsComboBox = new System.Windows.Forms.ComboBox();
this.columnsGroupBox = new System.Windows.Forms.GroupBox();
this.columnTestSpecTextBox = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.columnsComboBox = new System.Windows.Forms.ComboBox();
this.twoDimCheckBox = new System.Windows.Forms.CheckBox();
this.rowsGroupBox.SuspendLayout();
this.columnsGroupBox.SuspendLayout();
this.SuspendLayout();
//
// cancelButton
//
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Location = new System.Drawing.Point(368, 196);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(95, 38);
this.cancelButton.TabIndex = 9;
this.cancelButton.Text = "Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
//
// okButton
//
this.okButton.Location = new System.Drawing.Point(257, 196);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(95, 38);
this.okButton.TabIndex = 8;
this.okButton.Text = "OK";
this.okButton.UseVisualStyleBackColor = true;
this.okButton.Click += new System.EventHandler(this.okButton_Click);
//
// rowsGroupBox
//
this.rowsGroupBox.Controls.Add(this.rowTestSpecTextBox);
this.rowsGroupBox.Controls.Add(this.label1);
this.rowsGroupBox.Controls.Add(this.rowsComboBox);
this.rowsGroupBox.Location = new System.Drawing.Point(38, 50);
this.rowsGroupBox.Name = "rowsGroupBox";
this.rowsGroupBox.Size = new System.Drawing.Size(427, 56);
this.rowsGroupBox.TabIndex = 10;
this.rowsGroupBox.TabStop = false;
this.rowsGroupBox.Text = "Rows";
//
// rowTestSpecTextBox
//
this.rowTestSpecTextBox.Location = new System.Drawing.Point(326, 22);
this.rowTestSpecTextBox.Name = "rowTestSpecTextBox";
this.rowTestSpecTextBox.Size = new System.Drawing.Size(61, 20);
this.rowTestSpecTextBox.TabIndex = 2;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(242, 24);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(35, 13);
this.label1.TabIndex = 1;
this.label1.Text = "label1";
//
// rowsComboBox
//
this.rowsComboBox.FormattingEnabled = true;
this.rowsComboBox.Location = new System.Drawing.Point(32, 21);
this.rowsComboBox.Name = "rowsComboBox";
this.rowsComboBox.Size = new System.Drawing.Size(185, 21);
this.rowsComboBox.TabIndex = 0;
//
// columnsGroupBox
//
this.columnsGroupBox.Controls.Add(this.columnTestSpecTextBox);
this.columnsGroupBox.Controls.Add(this.label2);
this.columnsGroupBox.Controls.Add(this.columnsComboBox);
this.columnsGroupBox.Location = new System.Drawing.Point(38, 112);
this.columnsGroupBox.Name = "columnsGroupBox";
this.columnsGroupBox.Size = new System.Drawing.Size(427, 56);
this.columnsGroupBox.TabIndex = 11;
this.columnsGroupBox.TabStop = false;
this.columnsGroupBox.Text = "Columns";
//
// columnTestSpecTextBox
//
this.columnTestSpecTextBox.Location = new System.Drawing.Point(326, 21);
this.columnTestSpecTextBox.Name = "columnTestSpecTextBox";
this.columnTestSpecTextBox.Size = new System.Drawing.Size(61, 20);
this.columnTestSpecTextBox.TabIndex = 3;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(242, 23);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(35, 13);
this.label2.TabIndex = 2;
this.label2.Text = "label2";
//
// columnsComboBox
//
this.columnsComboBox.FormattingEnabled = true;
this.columnsComboBox.Location = new System.Drawing.Point(32, 20);
this.columnsComboBox.Name = "columnsComboBox";
this.columnsComboBox.Size = new System.Drawing.Size(185, 21);
this.columnsComboBox.TabIndex = 1;
//
// twoDimCheckBox
//
this.twoDimCheckBox.AutoSize = true;
this.twoDimCheckBox.Location = new System.Drawing.Point(39, 21);
this.twoDimCheckBox.Name = "twoDimCheckBox";
this.twoDimCheckBox.Size = new System.Drawing.Size(40, 17);
this.twoDimCheckBox.TabIndex = 12;
this.twoDimCheckBox.Text = "2D";
this.twoDimCheckBox.UseVisualStyleBackColor = true;
this.twoDimCheckBox.CheckedChanged += new System.EventHandler(this.twoDimCheckBox_CheckedChanged);
//
// StatisticsOptionsDlg
//
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(503, 262);
this.Controls.Add(this.columnsGroupBox);
this.Controls.Add(this.twoDimCheckBox);
this.Controls.Add(this.rowsGroupBox);
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.okButton);
this.Name = "StatisticsOptionsDlg";
this.Text = "StatisticsOptionsDlg";
this.Load += new System.EventHandler(this.StatisticsOptionsDlg_Load);
this.rowsGroupBox.ResumeLayout(false);
this.rowsGroupBox.PerformLayout();
this.columnsGroupBox.ResumeLayout(false);
this.columnsGroupBox.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button cancelButton;
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.GroupBox rowsGroupBox;
private System.Windows.Forms.ComboBox rowsComboBox;
private System.Windows.Forms.GroupBox columnsGroupBox;
private System.Windows.Forms.ComboBox columnsComboBox;
private System.Windows.Forms.CheckBox twoDimCheckBox;
private System.Windows.Forms.TextBox rowTestSpecTextBox;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox columnTestSpecTextBox;
private System.Windows.Forms.Label label2;
}
}

View File

@ -0,0 +1,119 @@
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 ResultsBrowser.Resources;
namespace ResultsBrowser.Forms
{
public partial class StatisticsOptionsDlg : Form
{
public bool TwoDim;
public int RowItemID;
public int ColumnItemID;
public string RowTestSpecifier;
public string ColumnTestSpecifier;
public StatisticsOptionsDlg()
{
InitializeComponent();
}
private void StatisticsOptionsDlg_Load(object sender, EventArgs e)
{
Localize();
twoDimCheckBox.Checked = TwoDim = Program.LocalSettings.TwoDim;
RowItemID = Math.Max(1, Program.LocalSettings.RowItemID);
ColumnItemID = Math.Max(1, Program.LocalSettings.ColumnItemID);
rowTestSpecTextBox.Text = RowTestSpecifier = Program.LocalSettings.RowTestSpecifier;
columnTestSpecTextBox.Text = ColumnTestSpecifier = Program.LocalSettings.ColumnTestSpecifier;
rowsComboBox.Text = Results.WMeterRsltItemSpec.AllItems[RowItemID].Name; /// TODO: Use Caption
columnsComboBox.Text = Results.WMeterRsltItemSpec.AllItems[ColumnItemID].Name; /// TODO: Use Caption
///
for (int i = 1; i < Results.WMeterRsltItemSpec.AllItems.Count; i++)
{
string item = Results.WMeterRsltItemSpec.AllItems[i].Name; /// TODO: Use Caption
rowsComboBox.Items.Add(item);
columnsComboBox.Items.Add(item);
}
columnsComboBox.Enabled = TwoDim;
}
void Localize()
{
Text = Strings.Statistics;
okButton.Text = Strings.OkBtnText;
cancelButton.Text = Strings.CancelBtnText;
rowsGroupBox.Text = Strings.Rows;
columnsGroupBox.Text = Strings.Columns;
label1.Text = Strings.Test;
label2.Text = Strings.Test;
}
private void twoDimCheckBox_CheckedChanged(object sender, EventArgs e)
{
columnsComboBox.Enabled = twoDimCheckBox.Checked;
}
private void okButton_Click(object sender, EventArgs e)
{
TwoDim = twoDimCheckBox.Checked;
RowTestSpecifier = rowTestSpecTextBox.Text;
ColumnTestSpecifier = columnTestSpecTextBox.Text;
RowItemID = 0;
for (int i = 0; i < rowsComboBox.Items.Count; i++)
{
if (rowsComboBox.Text.Equals(rowsComboBox.Items[i]))
{
RowItemID = i + 1;
break;
}
}
if (TwoDim)
{
ColumnItemID = 0;
for (int i = 0; i < columnsComboBox.Items.Count; i++)
{
if (columnsComboBox.Text.Equals(columnsComboBox.Items[i]))
{
ColumnItemID = i + 1;
break;
}
}
}
if (RowItemID == 0 || ColumnItemID == 0)
{
MessageBox.Show(Strings.Error, Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
DialogResult = DialogResult.Cancel;
}
Program.LocalSettings.TwoDim = TwoDim;
Program.LocalSettings.RowItemID = RowItemID;
Program.LocalSettings.ColumnItemID = ColumnItemID;
Program.LocalSettings.RowTestSpecifier = RowTestSpecifier;
Program.LocalSettings.ColumnTestSpecifier = ColumnTestSpecifier;
Program.LocalSettings.Save();
DialogResult = DialogResult.OK;
Close();
}
private void cancelButton_Click(object sender, EventArgs e)
{
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -34,6 +34,18 @@ namespace ResultsBrowser
public string ConnectionString2;
public string ConnectionString3;
public bool Bench1Selected;
public bool Bench2Selected;
public bool Bench3Selected;
public bool TwoDim;
public int RowItemID;
public int ColumnItemID;
public string RowTestSpecifier;
public string ColumnTestSpecifier;
public bool FilterPurchaseOrder;
public bool FilterProcedure;
public bool FilterBatchNr;

View File

@ -126,6 +126,9 @@
<data name="Clear_filters" xml:space="preserve">
<value>Filter löschen</value>
</data>
<data name="Columns" xml:space="preserve">
<value>Spalten</value>
</data>
<data name="Connection_string" xml:space="preserve">
<value>Datenbank-Verbindungszeichenfolge</value>
</data>
@ -172,17 +175,23 @@
<value>Ergebnisse</value>
</data>
<data name="Results_Browser" xml:space="preserve">
<value>Statistiken</value>
<value>Analyse der Ergebnisse</value>
</data>
<data name="RetryDatabaseText" xml:space="preserve">
<value>Datenbankverbindung wiederherstellen</value>
</data>
<data name="Rows" xml:space="preserve">
<value>Reihen</value>
</data>
<data name="Save_filters" xml:space="preserve">
<value>Filter speichern</value>
</data>
<data name="Selected_results" xml:space="preserve">
<value>Ergebnisse ausgewählt</value>
</data>
<data name="Select_a_filter" xml:space="preserve">
<value>Wählen Sie einen Filter</value>
</data>
<data name="Serial_Number" xml:space="preserve">
<value>Seriennummer</value>
</data>
@ -192,6 +201,12 @@
<data name="SingleBtnText" xml:space="preserve">
<value>Einzel</value>
</data>
<data name="Statistics" xml:space="preserve">
<value>Statistiken</value>
</data>
<data name="Test" xml:space="preserve">
<value>Prüfpunkt</value>
</data>
<data name="Test_bench" xml:space="preserve">
<value>Prüfstand</value>
</data>

View File

@ -753,4 +753,16 @@
<data name="To" xml:space="preserve">
<value>To</value>
</data>
<data name="Statistics" xml:space="preserve">
<value>Statistics</value>
</data>
<data name="Columns" xml:space="preserve">
<value>Columns</value>
</data>
<data name="Rows" xml:space="preserve">
<value>Rows</value>
</data>
<data name="Select_a_filter" xml:space="preserve">
<value>Select a filter</value>
</data>
</root>

View File

@ -483,6 +483,15 @@ namespace ResultsBrowser.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Columns.
/// </summary>
internal static string Columns {
get {
return ResourceManager.GetString("Columns", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Combined meters.
/// </summary>
@ -1851,6 +1860,15 @@ namespace ResultsBrowser.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Rows.
/// </summary>
internal static string Rows {
get {
return ResourceManager.GetString("Rows", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Save filters.
/// </summary>
@ -1860,6 +1878,15 @@ namespace ResultsBrowser.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Select a filter.
/// </summary>
internal static string Select_a_filter {
get {
return ResourceManager.GetString("Select_a_filter", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Selected results.
/// </summary>
@ -1896,6 +1923,15 @@ namespace ResultsBrowser.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Statistics.
/// </summary>
internal static string Statistics {
get {
return ResourceManager.GetString("Statistics", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Test.
/// </summary>

View File

@ -134,6 +134,18 @@
<Compile Include="Forms\ResultsConfig.designer.cs">
<DependentUpon>ResultsConfig.cs</DependentUpon>
</Compile>
<Compile Include="Forms\StatisticsDlg.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\StatisticsDlg.Designer.cs">
<DependentUpon>StatisticsDlg.cs</DependentUpon>
</Compile>
<Compile Include="Forms\StatisticsOptionsDlg.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\StatisticsOptionsDlg.Designer.cs">
<DependentUpon>StatisticsOptionsDlg.cs</DependentUpon>
</Compile>
<Compile Include="LocalSettings.cs" />
<Compile Include="MainWnd.cs">
<SubType>Form</SubType>
@ -188,6 +200,12 @@
<EmbeddedResource Include="Forms\ResultsConfig.resx">
<DependentUpon>ResultsConfig.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\StatisticsDlg.resx">
<DependentUpon>StatisticsDlg.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\StatisticsOptionsDlg.resx">
<DependentUpon>StatisticsOptionsDlg.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="MainWnd.resx">
<DependentUpon>MainWnd.cs</DependentUpon>
</EmbeddedResource>

View File

@ -34,6 +34,7 @@
this.filtersFlowLayoutPanel = new System.Windows.Forms.FlowLayoutPanel();
this.resultsGroupBox = new System.Windows.Forms.GroupBox();
this.resultsListBox = new System.Windows.Forms.ListBox();
this.statisticsBtn = new System.Windows.Forms.Button();
this.printQueryResultsBtn = new System.Windows.Forms.Button();
this.exportQueryResultsBtn = new System.Windows.Forms.Button();
this.formatOfResultsBtn = new System.Windows.Forms.Button();
@ -74,6 +75,7 @@
//
// vSplitContainer.Panel2
//
this.vSplitContainer.Panel2.Controls.Add(this.statisticsBtn);
this.vSplitContainer.Panel2.Controls.Add(this.printQueryResultsBtn);
this.vSplitContainer.Panel2.Controls.Add(this.exportQueryResultsBtn);
this.vSplitContainer.Panel2.Controls.Add(this.formatOfResultsBtn);
@ -146,6 +148,16 @@
this.resultsListBox.Size = new System.Drawing.Size(834, 409);
this.resultsListBox.TabIndex = 0;
//
// statisticsBtn
//
this.statisticsBtn.Location = new System.Drawing.Point(8, 521);
this.statisticsBtn.Name = "statisticsBtn";
this.statisticsBtn.Size = new System.Drawing.Size(125, 33);
this.statisticsBtn.TabIndex = 10;
this.statisticsBtn.Text = "Statistics";
this.statisticsBtn.UseVisualStyleBackColor = true;
this.statisticsBtn.Click += new System.EventHandler(this.statisticsBtn_Click);
//
// printQueryResultsBtn
//
this.printQueryResultsBtn.Location = new System.Drawing.Point(8, 461);
@ -258,6 +270,7 @@
this.checkBox3.TabStop = true;
this.checkBox3.Text = "radioButton3";
this.checkBox3.UseVisualStyleBackColor = true;
this.checkBox3.CheckedChanged += new System.EventHandler(this.checkBox3_CheckedChanged);
//
// checkBox2
//
@ -269,6 +282,7 @@
this.checkBox2.TabStop = true;
this.checkBox2.Text = "radioButton2";
this.checkBox2.UseVisualStyleBackColor = true;
this.checkBox2.CheckedChanged += new System.EventHandler(this.checkBox2_CheckedChanged);
//
// checkBox1
//
@ -280,6 +294,7 @@
this.checkBox1.TabStop = true;
this.checkBox1.Text = "radioButton1";
this.checkBox1.UseVisualStyleBackColor = true;
this.checkBox1.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged);
//
// ResultsBrowserWnd
//
@ -327,5 +342,6 @@
private System.Windows.Forms.Button exportQueryResultsBtn;
private System.Windows.Forms.Button formatOfResultsBtn;
private System.Windows.Forms.Button printQueryResultsBtn;
private System.Windows.Forms.Button statisticsBtn;
}
}

View File

@ -30,7 +30,9 @@ namespace ResultsBrowser
Localize();
RedrawTestBenches();
checkBox1.Checked = true;
checkBox1.Checked = Program.LocalSettings.Bench1Selected;
checkBox2.Checked = Program.LocalSettings.Bench2Selected;
checkBox3.Checked = Program.LocalSettings.Bench3Selected;
}
void RedrawTestBenches()
@ -59,6 +61,7 @@ namespace ResultsBrowser
formatOfResultsBtn.Text = Strings.Format_of_results;
exportQueryResultsBtn.Text = Strings.Export_query_results;
printQueryResultsBtn.Text = Strings.Print_query_results;
statisticsBtn.Text = Strings.Statistics;
}
private void settingsBtn_Click(object sender, EventArgs e)
@ -69,6 +72,24 @@ namespace ResultsBrowser
}
}
private void checkBox1_CheckedChanged(object sender, EventArgs e) { SaveCheckBoxes(); }
private void checkBox2_CheckedChanged(object sender, EventArgs e) { SaveCheckBoxes(); }
private void checkBox3_CheckedChanged(object sender, EventArgs e) { SaveCheckBoxes(); }
void SaveCheckBoxes()
{
Program.LocalSettings.Bench1Selected = checkBox1.Checked;
Program.LocalSettings.Bench2Selected = checkBox2.Checked;
Program.LocalSettings.Bench3Selected = checkBox3.Checked;
Program.LocalSettings.Save();
}
private void clearFiltersBtn_Click(object sender, EventArgs e)
{
filters.Clear();
filtersFlowLayoutPanel.Controls.Clear();
}
private void addFilterBtn_Click(object sender, EventArgs e)
{
Forms.AddFilterDlg dlg = new Forms.AddFilterDlg();
@ -129,21 +150,6 @@ namespace ResultsBrowser
}
}
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
}
private void checkBox2_CheckedChanged(object sender, EventArgs e)
{
}
private void checkBox3_CheckedChanged(object sender, EventArgs e)
{
}
private void executeQueryBtn_Click(object sender, EventArgs e)
{
try
@ -177,12 +183,6 @@ namespace ResultsBrowser
}
}
private void clearFiltersBtn_Click(object sender, EventArgs e)
{
filters.Clear();
filtersFlowLayoutPanel.Controls.Clear();
}
private void formatOfResultsBtn_Click(object sender, EventArgs e)
{
@ -203,5 +203,22 @@ namespace ResultsBrowser
new Results.Output.Printers.Munich.MunichPrintDocument("", wm, Config.Entities.PageOrientation.Portrait).Print();
}
}
private void statisticsBtn_Click(object sender, EventArgs e)
{
if (waterMeters == null || waterMeters.Count == 0) return;
///
/// Enter options
///
Forms.StatisticsOptionsDlg dlg = new Forms.StatisticsOptionsDlg();
if (dlg.ShowDialog() != DialogResult.OK) return;
///
/// Calculate statistics
///
Forms.StatisticsDlg statisticsDlg = new Forms.StatisticsDlg(waterMeters, dlg.TwoDim, dlg.RowItemID, dlg.ColumnItemID, dlg.RowTestSpecifier, dlg.ColumnTestSpecifier);
statisticsDlg.ShowDialog();
}
}
}