MoreWMResultsDlg fixes.

This commit is contained in:
Milan Hanajik 2023-10-16 13:46:02 +02:00
parent d3126bd9ea
commit ed066a005f
4 changed files with 78 additions and 61 deletions

View File

@ -29,13 +29,15 @@
private void InitializeComponent()
{
this.tabControl1 = new System.Windows.Forms.TabControl();
this.allResultsTabPage = new System.Windows.Forms.TabPage();
this.graphsTabPage = new System.Windows.Forms.TabPage();
this.productionTracingTabPage = new System.Windows.Forms.TabPage();
this.productionTracingSplitContainer = new System.Windows.Forms.SplitContainer();
this.messageLabel = new System.Windows.Forms.Label();
this.tracingResultsListView = new System.Windows.Forms.ListView();
this.allResultsTabPage = new System.Windows.Forms.TabPage();
this.oneWMResultsCtrl = new Results.Forms.OneWMResultsRowsCtrl();
this.tabControl1.SuspendLayout();
this.allResultsTabPage.SuspendLayout();
this.productionTracingTabPage.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.productionTracingSplitContainer)).BeginInit();
this.productionTracingSplitContainer.Panel1.SuspendLayout();
@ -55,6 +57,17 @@
this.tabControl1.Size = new System.Drawing.Size(1195, 448);
this.tabControl1.TabIndex = 0;
//
// allResultsTabPage
//
this.allResultsTabPage.Controls.Add(this.oneWMResultsCtrl);
this.allResultsTabPage.Location = new System.Drawing.Point(4, 22);
this.allResultsTabPage.Name = "allResultsTabPage";
this.allResultsTabPage.Padding = new System.Windows.Forms.Padding(3);
this.allResultsTabPage.Size = new System.Drawing.Size(1187, 422);
this.allResultsTabPage.TabIndex = 0;
this.allResultsTabPage.Text = "All results";
this.allResultsTabPage.UseVisualStyleBackColor = true;
//
// graphsTabPage
//
this.graphsTabPage.Location = new System.Drawing.Point(4, 22);
@ -113,6 +126,7 @@
//
this.tracingResultsListView.Dock = System.Windows.Forms.DockStyle.Fill;
this.tracingResultsListView.GridLines = true;
this.tracingResultsListView.HideSelection = false;
this.tracingResultsListView.Location = new System.Drawing.Point(0, 0);
this.tracingResultsListView.Name = "tracingResultsListView";
this.tracingResultsListView.Size = new System.Drawing.Size(1187, 366);
@ -120,15 +134,14 @@
this.tracingResultsListView.UseCompatibleStateImageBehavior = false;
this.tracingResultsListView.View = System.Windows.Forms.View.Details;
//
// allResultsTabPage
// oneWMResultsRowsCtrl
//
this.allResultsTabPage.Location = new System.Drawing.Point(4, 22);
this.allResultsTabPage.Name = "allResultsTabPage";
this.allResultsTabPage.Padding = new System.Windows.Forms.Padding(3);
this.allResultsTabPage.Size = new System.Drawing.Size(1187, 422);
this.allResultsTabPage.TabIndex = 0;
this.allResultsTabPage.Text = "All results";
this.allResultsTabPage.UseVisualStyleBackColor = true;
this.oneWMResultsCtrl.Caption = "---";
this.oneWMResultsCtrl.Dock = System.Windows.Forms.DockStyle.Fill;
this.oneWMResultsCtrl.Location = new System.Drawing.Point(3, 3);
this.oneWMResultsCtrl.Name = "oneWMResultsRowsCtrl";
this.oneWMResultsCtrl.Size = new System.Drawing.Size(1181, 416);
this.oneWMResultsCtrl.TabIndex = 0;
//
// MoreWMResultsDlg
//
@ -140,6 +153,7 @@
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Water meter results";
this.tabControl1.ResumeLayout(false);
this.allResultsTabPage.ResumeLayout(false);
this.productionTracingTabPage.ResumeLayout(false);
this.productionTracingSplitContainer.Panel1.ResumeLayout(false);
this.productionTracingSplitContainer.Panel1.PerformLayout();
@ -153,12 +167,12 @@
#endregion
private System.Windows.Forms.TabControl tabControl1;
private OneWMResultsRowsCtrl oneWMResultsCtrl;
private System.Windows.Forms.TabPage graphsTabPage;
private System.Windows.Forms.TabPage productionTracingTabPage;
private System.Windows.Forms.SplitContainer productionTracingSplitContainer;
private System.Windows.Forms.Label messageLabel;
private System.Windows.Forms.ListView tracingResultsListView;
private System.Windows.Forms.TabPage allResultsTabPage;
private OneWMResultsRowsCtrl oneWMResultsCtrl;
}
}

View File

@ -59,57 +59,57 @@ namespace Results.Forms
/// <param name="wMtr">Water meter entity</param>
void ShowAllResults(Results.Entities.WaterMeter wMtr)
{
// string message;
// Color commonBackColor = wMtr.GetColorOfResults(false, out message); /// Ony message is used later on
//#if ORACLE_DB
// oneWMResultsCtrl.Caption = string.Format("{0} ({1}) {2}", (string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr), (wMtr.Pruefindex % 100), message);
//#else
// oneWMResultsCtrl.Caption = string.Format("s/n = {0}", string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr);
//#endif
string message;
Color commonBackColor = wMtr.GetColorOfResults(false, out message); /// Ony message is used later on
#if ORACLE_DB
oneWMResultsCtrl.Caption = string.Format("{0} ({1}) {2}", wMtr.SerialNr ?? string.Empty, wMtr.Pruefindex % 100, message);
#else
oneWMResultsCtrl.Caption = string.Format("s/n = {0}", wMtr.SerialNr ?? string.Empty);
#endif
// IList<Results.WMeterRsltItemSpec> items = Results.WMeterRsltItemSpec.AllItems;
IList<Results.WMeterRsltItemSpec> items = Results.WMeterRsltItemSpec.AllItems;
// // Header
// oneWMResultsCtrl.Columns.Add(wMtr.WMPosition.ToString(), 100);
// int i = 1;
// foreach (var str in wMtr.GetAllDecoratedTestNames())
// {
// oneWMResultsCtrl.Columns.Add(str, 100);
// i++;
// }
// Header
oneWMResultsCtrl.Columns.Add(wMtr.WMPosition.ToString(), 100);
int i = 1;
foreach (var str in wMtr.GetAllDecoratedTestNames())
{
oneWMResultsCtrl.Columns.Add(str, 100);
i++;
}
// foreach (var item in items)
// {
// ListViewItem lvi = new ListViewItem(item.Name);
foreach (var item in items)
{
ListViewItem lvi = new ListViewItem(item.Name);
// foreach (var mtr in wMtr.MeterTestRslts)
// {
// if (mtr != null && mtr.IsPilotRslt() && mtr.TestDone && mtr.Publish() != Publish.Never &&
// mtr.Publish() != Publish.Internal)
// {
// string str = item.Print(wMtr, mtr.Name());
foreach (var mtr in wMtr.MeterTestRslts)
{
if (mtr != null && mtr.IsPilotRslt() && mtr.TestDone && mtr.Publish() != Common.Publish.Never &&
mtr.Publish() != Common.Publish.Internal)
{
string str = item.Print(wMtr, mtr.Name());
// 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);
// }
// }
// }
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);
}
}
}
// oneWMResultsCtrl.Items.Add(lvi);
// }
oneWMResultsCtrl.Items.Add(lvi);
}
}

View File

@ -1,5 +1,5 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
/// Copyright (c) 2019-2023 Sensus Slovensko a.s.
///
using System;
using System.Drawing;
@ -24,13 +24,16 @@ namespace Results.Forms
}
}
public string Caption { set { caption = value; } get { return caption; } }
public ListView.ListViewItemCollection Items { get { return lView.Items; } }
bool disabled;
int wmPosition; /// 1-based water meter position
string caption;
Color bkColor;
int[] columnWidths;
IList<Results.WMeterRsltItemSpec> items;
IList<WMeterRsltItemSpec> items;
public bool Disabled { get { return disabled; } } /// Read only
@ -45,7 +48,7 @@ namespace Results.Forms
wmPosition = 0;
tBox.Text = caption = "---";
tBox.BackColor = lView.BackColor = bkColor = Color.White;
items = new List<Results.WMeterRsltItemSpec>();
items = new List<WMeterRsltItemSpec>();
columnWidths = new int[0];
}
@ -62,7 +65,7 @@ namespace Results.Forms
}
}
public void Update(IList<Results.WMeterRsltItemSpec> items)
public void Update(IList<WMeterRsltItemSpec> items)
{
this.items = items;

View File

@ -237,7 +237,7 @@ namespace TBF.UI.ResultsMI
{
if ((TracingDB.DB.SessionFactory == null) || string.IsNullOrEmpty(wm.SerialNr))
{
new Results.Forms.MoreWMResultsDlg(wm, null).ShowDialog();
new MoreWMResultsDlg(wm, null).ShowDialog();
}
else
{
@ -270,7 +270,7 @@ namespace TBF.UI.ResultsMI
}
}
new Results.Forms.MoreWMResultsDlg(wm, refRecords).ShowDialog();
new MoreWMResultsDlg(wm, refRecords).ShowDialog();
}
}
}