From 59fc7e30d885d2bd6e9eb7f39df4900f3f66bc55 Mon Sep 17 00:00:00 2001 From: Milan Hanajik Date: Fri, 3 Jun 2016 14:03:12 +0200 Subject: [PATCH] ResultsBrowser: Statistics implemented (NOK yet), user options saved in LocalSettings. --- ResultsBrowser/Forms/AddFilterDlg.cs | 4 +- .../Forms/StatisticsDlg.Designer.cs | 126 ++++++++++++ ResultsBrowser/Forms/StatisticsDlg.cs | 155 +++++++++++++++ ResultsBrowser/Forms/StatisticsDlg.resx | 120 +++++++++++ .../Forms/StatisticsOptionsDlg.Designer.cs | 188 ++++++++++++++++++ ResultsBrowser/Forms/StatisticsOptionsDlg.cs | 119 +++++++++++ .../Forms/StatisticsOptionsDlg.resx | 120 +++++++++++ ResultsBrowser/LocalSettings.cs | 12 ++ ResultsBrowser/Resources/Strings.de.resx | 17 +- ResultsBrowser/Resources/Strings.resx | 12 ++ ResultsBrowser/Resources/Strings1.Designer.cs | 36 ++++ ResultsBrowser/ResultsBrowser.csproj | 18 ++ ResultsBrowser/ResultsBrowserWnd.Designer.cs | 16 ++ ResultsBrowser/ResultsBrowserWnd.cs | 61 ++++-- 14 files changed, 979 insertions(+), 25 deletions(-) create mode 100644 ResultsBrowser/Forms/StatisticsDlg.Designer.cs create mode 100644 ResultsBrowser/Forms/StatisticsDlg.cs create mode 100644 ResultsBrowser/Forms/StatisticsDlg.resx create mode 100644 ResultsBrowser/Forms/StatisticsOptionsDlg.Designer.cs create mode 100644 ResultsBrowser/Forms/StatisticsOptionsDlg.cs create mode 100644 ResultsBrowser/Forms/StatisticsOptionsDlg.resx diff --git a/ResultsBrowser/Forms/AddFilterDlg.cs b/ResultsBrowser/Forms/AddFilterDlg.cs index 738c28176..6515316d3 100644 --- a/ResultsBrowser/Forms/AddFilterDlg.cs +++ b/ResultsBrowser/Forms/AddFilterDlg.cs @@ -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; } diff --git a/ResultsBrowser/Forms/StatisticsDlg.Designer.cs b/ResultsBrowser/Forms/StatisticsDlg.Designer.cs new file mode 100644 index 000000000..abc52a051 --- /dev/null +++ b/ResultsBrowser/Forms/StatisticsDlg.Designer.cs @@ -0,0 +1,126 @@ +namespace ResultsBrowser.Forms +{ + partial class StatisticsDlg + { + /// + /// 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.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; + } +} \ No newline at end of file diff --git a/ResultsBrowser/Forms/StatisticsDlg.cs b/ResultsBrowser/Forms/StatisticsDlg.cs new file mode 100644 index 000000000..cc7e7b1eb --- /dev/null +++ b/ResultsBrowser/Forms/StatisticsDlg.cs @@ -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 waterMeters; + + bool twoDim; + //int rowItemID; + //int columnItemID; + //string rowTestSpec; + //string columnTestSpec; + + Results.WMeterRsltItemSpec rowItem; + Results.WMeterRsltItemSpec columnItem; + + IList rowValues; + IList columnValues; + + public StatisticsDlg(IList 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(); + columnValues = new List(); + + /// + /// 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(); + } + } +} diff --git a/ResultsBrowser/Forms/StatisticsDlg.resx b/ResultsBrowser/Forms/StatisticsDlg.resx new file mode 100644 index 000000000..1af7de150 --- /dev/null +++ b/ResultsBrowser/Forms/StatisticsDlg.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/ResultsBrowser/Forms/StatisticsOptionsDlg.Designer.cs b/ResultsBrowser/Forms/StatisticsOptionsDlg.Designer.cs new file mode 100644 index 000000000..e22c432cf --- /dev/null +++ b/ResultsBrowser/Forms/StatisticsOptionsDlg.Designer.cs @@ -0,0 +1,188 @@ +namespace ResultsBrowser.Forms +{ + partial class StatisticsOptionsDlg + { + /// + /// 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.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; + } +} \ No newline at end of file diff --git a/ResultsBrowser/Forms/StatisticsOptionsDlg.cs b/ResultsBrowser/Forms/StatisticsOptionsDlg.cs new file mode 100644 index 000000000..0e2f9343a --- /dev/null +++ b/ResultsBrowser/Forms/StatisticsOptionsDlg.cs @@ -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) + { + + } + } +} diff --git a/ResultsBrowser/Forms/StatisticsOptionsDlg.resx b/ResultsBrowser/Forms/StatisticsOptionsDlg.resx new file mode 100644 index 000000000..1af7de150 --- /dev/null +++ b/ResultsBrowser/Forms/StatisticsOptionsDlg.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/ResultsBrowser/LocalSettings.cs b/ResultsBrowser/LocalSettings.cs index f0825fc58..a284d208b 100644 --- a/ResultsBrowser/LocalSettings.cs +++ b/ResultsBrowser/LocalSettings.cs @@ -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; diff --git a/ResultsBrowser/Resources/Strings.de.resx b/ResultsBrowser/Resources/Strings.de.resx index 4edebdb39..350d5f56d 100644 --- a/ResultsBrowser/Resources/Strings.de.resx +++ b/ResultsBrowser/Resources/Strings.de.resx @@ -126,6 +126,9 @@ Filter löschen + + Spalten + Datenbank-Verbindungszeichenfolge @@ -172,17 +175,23 @@ Ergebnisse - Statistiken + Analyse der Ergebnisse Datenbankverbindung wiederherstellen + + Reihen + Filter speichern Ergebnisse ausgewählt + + Wählen Sie einen Filter + Seriennummer @@ -192,6 +201,12 @@ Einzel + + Statistiken + + + Prüfpunkt + Prüfstand diff --git a/ResultsBrowser/Resources/Strings.resx b/ResultsBrowser/Resources/Strings.resx index 03e9130be..41a3bfaae 100644 --- a/ResultsBrowser/Resources/Strings.resx +++ b/ResultsBrowser/Resources/Strings.resx @@ -753,4 +753,16 @@ To + + Statistics + + + Columns + + + Rows + + + Select a filter + \ No newline at end of file diff --git a/ResultsBrowser/Resources/Strings1.Designer.cs b/ResultsBrowser/Resources/Strings1.Designer.cs index c76455595..32b90e179 100644 --- a/ResultsBrowser/Resources/Strings1.Designer.cs +++ b/ResultsBrowser/Resources/Strings1.Designer.cs @@ -483,6 +483,15 @@ namespace ResultsBrowser.Resources { } } + /// + /// Looks up a localized string similar to Columns. + /// + internal static string Columns { + get { + return ResourceManager.GetString("Columns", resourceCulture); + } + } + /// /// Looks up a localized string similar to Combined meters. /// @@ -1851,6 +1860,15 @@ namespace ResultsBrowser.Resources { } } + /// + /// Looks up a localized string similar to Rows. + /// + internal static string Rows { + get { + return ResourceManager.GetString("Rows", resourceCulture); + } + } + /// /// Looks up a localized string similar to Save filters. /// @@ -1860,6 +1878,15 @@ namespace ResultsBrowser.Resources { } } + /// + /// Looks up a localized string similar to Select a filter. + /// + internal static string Select_a_filter { + get { + return ResourceManager.GetString("Select_a_filter", resourceCulture); + } + } + /// /// Looks up a localized string similar to Selected results. /// @@ -1896,6 +1923,15 @@ namespace ResultsBrowser.Resources { } } + /// + /// Looks up a localized string similar to Statistics. + /// + internal static string Statistics { + get { + return ResourceManager.GetString("Statistics", resourceCulture); + } + } + /// /// Looks up a localized string similar to Test. /// diff --git a/ResultsBrowser/ResultsBrowser.csproj b/ResultsBrowser/ResultsBrowser.csproj index 20d769b65..f50a8793d 100644 --- a/ResultsBrowser/ResultsBrowser.csproj +++ b/ResultsBrowser/ResultsBrowser.csproj @@ -134,6 +134,18 @@ ResultsConfig.cs + + Form + + + StatisticsDlg.cs + + + Form + + + StatisticsOptionsDlg.cs + Form @@ -188,6 +200,12 @@ ResultsConfig.cs + + StatisticsDlg.cs + + + StatisticsOptionsDlg.cs + MainWnd.cs diff --git a/ResultsBrowser/ResultsBrowserWnd.Designer.cs b/ResultsBrowser/ResultsBrowserWnd.Designer.cs index 8f6b91b40..5f753b7ae 100644 --- a/ResultsBrowser/ResultsBrowserWnd.Designer.cs +++ b/ResultsBrowser/ResultsBrowserWnd.Designer.cs @@ -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; } } \ No newline at end of file diff --git a/ResultsBrowser/ResultsBrowserWnd.cs b/ResultsBrowser/ResultsBrowserWnd.cs index 6c6135792..243693586 100644 --- a/ResultsBrowser/ResultsBrowserWnd.cs +++ b/ResultsBrowser/ResultsBrowserWnd.cs @@ -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(); + } } }