Procedures : Selection via profiles, More column can display profile, ver. 2.30.1982

This commit is contained in:
Milan Hanajik 2022-11-15 16:13:06 +01:00
parent be8f6814c8
commit 8d6d0c011b
5 changed files with 120 additions and 28 deletions

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
[assembly: AssemblyVersion("2.30.1980.0")]
[assembly: AssemblyFileVersion("2.30.1980.0")]
[assembly: AssemblyVersion("2.30.1982.0")]
[assembly: AssemblyFileVersion("2.30.1982.0")]

View File

@ -357,6 +357,15 @@ namespace TBF.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to any profile.
/// </summary>
internal static string any_profile {
get {
return ResourceManager.GetString("any_profile", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Approval.
/// </summary>
@ -3264,6 +3273,15 @@ namespace TBF.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to no profile.
/// </summary>
internal static string no_profile {
get {
return ResourceManager.GetString("no_profile", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to No results to print.
/// </summary>

View File

@ -2314,4 +2314,10 @@
<data name="Test_0_config_error_1_is_missing" xml:space="preserve">
<value>Test {0} config. error : {1} is missing</value>
</data>
<data name="any_profile" xml:space="preserve">
<value>any profile</value>
</data>
<data name="no_profile" xml:space="preserve">
<value>no profile</value>
</data>
</root>

View File

@ -38,6 +38,8 @@
this.q3ComboBox = new System.Windows.Forms.ComboBox();
this.dnComboBox = new System.Windows.Forms.ComboBox();
this.listViewEx = new Common.Forms.ListViewEx();
this.profileLabel = new System.Windows.Forms.Label();
this.profileComboBox = new System.Windows.Forms.ComboBox();
((System.ComponentModel.ISupportInitialize)(this.filtersSplitContainer)).BeginInit();
this.filtersSplitContainer.Panel1.SuspendLayout();
this.filtersSplitContainer.Panel2.SuspendLayout();
@ -54,6 +56,8 @@
//
// filtersSplitContainer.Panel1
//
this.filtersSplitContainer.Panel1.Controls.Add(this.profileLabel);
this.filtersSplitContainer.Panel1.Controls.Add(this.profileComboBox);
this.filtersSplitContainer.Panel1.Controls.Add(this.producerLabel);
this.filtersSplitContainer.Panel1.Controls.Add(this.mclassLabel);
this.filtersSplitContainer.Panel1.Controls.Add(this.q3Label);
@ -66,14 +70,14 @@
// filtersSplitContainer.Panel2
//
this.filtersSplitContainer.Panel2.Controls.Add(this.listViewEx);
this.filtersSplitContainer.Size = new System.Drawing.Size(600, 400);
this.filtersSplitContainer.Size = new System.Drawing.Size(800, 400);
this.filtersSplitContainer.SplitterDistance = 40;
this.filtersSplitContainer.TabIndex = 2;
//
// producerLabel
//
this.producerLabel.AutoSize = true;
this.producerLabel.Location = new System.Drawing.Point(381, 15);
this.producerLabel.Location = new System.Drawing.Point(581, 15);
this.producerLabel.Name = "producerLabel";
this.producerLabel.Size = new System.Drawing.Size(50, 13);
this.producerLabel.TabIndex = 7;
@ -82,7 +86,7 @@
// mclassLabel
//
this.mclassLabel.AutoSize = true;
this.mclassLabel.Location = new System.Drawing.Point(257, 15);
this.mclassLabel.Location = new System.Drawing.Point(457, 15);
this.mclassLabel.Name = "mclassLabel";
this.mclassLabel.Size = new System.Drawing.Size(32, 13);
this.mclassLabel.TabIndex = 6;
@ -91,7 +95,7 @@
// q3Label
//
this.q3Label.AutoSize = true;
this.q3Label.Location = new System.Drawing.Point(125, 15);
this.q3Label.Location = new System.Drawing.Point(325, 15);
this.q3Label.Name = "q3Label";
this.q3Label.Size = new System.Drawing.Size(40, 13);
this.q3Label.TabIndex = 5;
@ -100,7 +104,7 @@
// dnLabel
//
this.dnLabel.AutoSize = true;
this.dnLabel.Location = new System.Drawing.Point(12, 15);
this.dnLabel.Location = new System.Drawing.Point(212, 15);
this.dnLabel.Name = "dnLabel";
this.dnLabel.Size = new System.Drawing.Size(23, 13);
this.dnLabel.TabIndex = 4;
@ -109,7 +113,7 @@
// producerComboBox
//
this.producerComboBox.FormattingEnabled = true;
this.producerComboBox.Location = new System.Drawing.Point(437, 12);
this.producerComboBox.Location = new System.Drawing.Point(637, 12);
this.producerComboBox.Name = "producerComboBox";
this.producerComboBox.Size = new System.Drawing.Size(133, 21);
this.producerComboBox.TabIndex = 3;
@ -119,7 +123,7 @@
// mclassComboBox
//
this.mclassComboBox.FormattingEnabled = true;
this.mclassComboBox.Location = new System.Drawing.Point(295, 12);
this.mclassComboBox.Location = new System.Drawing.Point(495, 12);
this.mclassComboBox.Name = "mclassComboBox";
this.mclassComboBox.Size = new System.Drawing.Size(72, 21);
this.mclassComboBox.TabIndex = 2;
@ -129,7 +133,7 @@
// q3ComboBox
//
this.q3ComboBox.FormattingEnabled = true;
this.q3ComboBox.Location = new System.Drawing.Point(171, 12);
this.q3ComboBox.Location = new System.Drawing.Point(371, 12);
this.q3ComboBox.Name = "q3ComboBox";
this.q3ComboBox.Size = new System.Drawing.Size(72, 21);
this.q3ComboBox.TabIndex = 1;
@ -139,7 +143,7 @@
// dnComboBox
//
this.dnComboBox.FormattingEnabled = true;
this.dnComboBox.Location = new System.Drawing.Point(41, 12);
this.dnComboBox.Location = new System.Drawing.Point(241, 12);
this.dnComboBox.Name = "dnComboBox";
this.dnComboBox.Size = new System.Drawing.Size(72, 21);
this.dnComboBox.TabIndex = 0;
@ -155,7 +159,7 @@
this.listViewEx.GridLines = true;
this.listViewEx.Location = new System.Drawing.Point(0, 0);
this.listViewEx.Name = "listViewEx";
this.listViewEx.Size = new System.Drawing.Size(600, 356);
this.listViewEx.Size = new System.Drawing.Size(800, 356);
this.listViewEx.TabIndex = 0;
this.listViewEx.UseCompatibleStateImageBehavior = false;
this.listViewEx.View = System.Windows.Forms.View.Details;
@ -163,13 +167,32 @@
this.listViewEx.SelectedIndexChanged += new System.EventHandler(this.listViewEx_SelectedIndexChanged);
this.listViewEx.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.listViewEx_MouseDoubleClick);
//
// profileLabel
//
this.profileLabel.AutoSize = true;
this.profileLabel.Location = new System.Drawing.Point(12, 15);
this.profileLabel.Name = "profileLabel";
this.profileLabel.Size = new System.Drawing.Size(36, 13);
this.profileLabel.TabIndex = 9;
this.profileLabel.Text = "Profile";
//
// profileComboBox
//
this.profileComboBox.FormattingEnabled = true;
this.profileComboBox.Location = new System.Drawing.Point(68, 12);
this.profileComboBox.Name = "profileComboBox";
this.profileComboBox.Size = new System.Drawing.Size(133, 21);
this.profileComboBox.TabIndex = 8;
this.profileComboBox.SelectedIndexChanged += new System.EventHandler(this.profileComboBox_SelectedIndexChanged);
this.profileComboBox.TextChanged += new System.EventHandler(this.profileComboBox_TextChanged);
//
// ProceduresCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.filtersSplitContainer);
this.Name = "ProceduresCtrl";
this.Size = new System.Drawing.Size(600, 400);
this.Size = new System.Drawing.Size(800, 400);
this.filtersSplitContainer.Panel1.ResumeLayout(false);
this.filtersSplitContainer.Panel1.PerformLayout();
this.filtersSplitContainer.Panel2.ResumeLayout(false);
@ -191,5 +214,7 @@
private System.Windows.Forms.ComboBox q3ComboBox;
private System.Windows.Forms.ComboBox dnComboBox;
private Common.Forms.ListViewEx listViewEx;
private System.Windows.Forms.Label profileLabel;
private System.Windows.Forms.ComboBox profileComboBox;
}
}

View File

@ -1,5 +1,5 @@
///
/// Copyright (c) 2020 Sensus Slovensko a.s.
/// Copyright (c) 2020-2022 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@ -42,7 +42,7 @@ namespace TBF.UI.Procedures
public bool Unlocked { get { return unlocked; } } /// read only
bool unlocked;
string selectedProfile;
float selectedDN;
float selectedQ3;
string selectedMClass;
@ -77,21 +77,37 @@ namespace TBF.UI.Procedures
errorFlagsCmpnt = null;
ToBeRemovedProcedures = new List<Procedure>();
dnComboBox.Text = Strings.any;
dnComboBox.Items.Add(Strings.any);
/// Profile
selectedProfile = null;
ComboBox cb = profileComboBox;
cb.Items.Add(Strings.any);
cb.Items.Add(Strings.no_profile);
cb.Items.Add(Strings.any_profile);
cb.Text = cb.Items[0].ToString();
/// DN
selectedDN = 0;
cb = dnComboBox;
cb.Items.Add(Strings.any);
cb.Text = cb.Items[0].ToString();
q3ComboBox.Text = Strings.any;
q3ComboBox.Items.Add(Strings.any);
/// Q3 / Qn
selectedQ3 = 0;
cb = q3ComboBox;
cb.Items.Add(Strings.any);
cb.Text = cb.Items[0].ToString();
mclassComboBox.Text = Strings.any;
mclassComboBox.Items.Add(Strings.any);
/// Metrological class
selectedMClass = null;
cb = mclassComboBox;
cb.Items.Add(Strings.any);
cb.Text = cb.Items[0].ToString();
producerComboBox.Text = Strings.any;
producerComboBox.Items.Add(Strings.any);
/// Producer
selectedProducer = null;
cb = producerComboBox;
cb.Items.Add(Strings.any);
cb.Text = cb.Items[0].ToString();
moreContent = MoreContent.Description;
}
@ -145,7 +161,7 @@ namespace TBF.UI.Procedures
bool ReloadProcedures()
{
bool isFirstTime = AllProcedures == null;
bool isFirstTime = (AllProcedures == null);
try
{
@ -180,6 +196,10 @@ namespace TBF.UI.Procedures
if (isFirstTime)
{
if (!string.IsNullOrEmpty(proc.AltProcName) && !profileComboBox.Items.Contains(proc.AltProcName))
{
profileComboBox.Items.Add(proc.AltProcName);
}
if (!dnComboBox.Items.Contains(wmParams.DN.ToString())) dnComboBox.Items.Add(wmParams.DN.ToString());
if (!q3ComboBox.Items.Contains(wmParams.Qn.ToString())) q3ComboBox.Items.Add(wmParams.Qn.ToString());
if (!mclassComboBox.Items.Contains(wmParams.MetrologicalClass)) mclassComboBox.Items.Add(wmParams.MetrologicalClass);
@ -216,10 +236,14 @@ namespace TBF.UI.Procedures
{
foreach (var proc in AllProcedures)
{
if ((selectedDN == 0 || selectedDN == proc.DN) &&
if ((selectedProfile == null ||
(selectedProfile == Strings.no_profile && string.IsNullOrEmpty(proc.AltProcName)) ||
(selectedProfile == Strings.any_profile && !string.IsNullOrEmpty(proc.AltProcName)) ||
selectedProfile == proc.AltProcName) &&
(selectedDN == 0 || selectedDN == proc.DN) &&
(selectedQ3 == 0 || selectedQ3 == proc.Qn) &&
((selectedMClass == null) || (selectedMClass == proc.MClass)) &&
((selectedProducer == null) || (selectedProducer == proc.Producer)))
(selectedMClass == null || selectedMClass == proc.MClass) &&
(selectedProducer == null || selectedProducer == proc.Producer))
{
Procedures.Add(proc);
}
@ -885,6 +909,17 @@ namespace TBF.UI.Procedures
return usedNames;
}
private void profileComboBox_SelectedIndexChanged(object sender, EventArgs e) { UpdateSelectedProfile(); }
private void profileComboBox_TextChanged(object sender, EventArgs e) { UpdateSelectedProfile(); }
///
void UpdateSelectedProfile()
{
//selectedProfile = ... TODO
selectedProfile = (profileComboBox.Text != Strings.any) ? profileComboBox.Text : null;
RedrawAll();
listViewEx_SelectedIndexChanged(null, null);
}
private void dnComboBox_SelectedIndexChanged(object sender, EventArgs e) { UpdateSelectedDN(); }
private void dnComboBox_TextChanged(object sender, EventArgs e) { UpdateSelectedDN(); }
///
@ -929,7 +964,7 @@ namespace TBF.UI.Procedures
private void listViewEx_SelectedIndexChanged(object sender, EventArgs e)
{
bool isFilterAny = (selectedDN == 0) && (selectedQ3 == 0) && (selectedMClass == null) && (selectedProducer == null);
bool isFilterAny = (selectedProfile == null) && (selectedDN == 0) && (selectedQ3 == 0) && (selectedMClass == null) && (selectedProducer == null);
if (parent != null) parent.SelectedIndexChanged(listViewEx, isFilterAny);
}
@ -944,6 +979,7 @@ namespace TBF.UI.Procedures
Tests,
Writers,
Printers,
Profile,
#if ORACLE_DB
Oracle,
#endif
@ -973,6 +1009,9 @@ namespace TBF.UI.Procedures
case MoreContent.Printers:
listViewEx.Columns[(int)Column.More].Text = "Printers";
break;
case MoreContent.Profile:
listViewEx.Columns[(int)Column.More].Text = "Profile";
break;
#if ORACLE_DB
case MoreContent.Oracle:
listViewEx.Columns[(int)Column.More].Text = "Oracle";
@ -1039,6 +1078,10 @@ namespace TBF.UI.Procedures
foreach (var p in printers) { sb.Append(p); sb.Append(" "); }
}
break;
case MoreContent.Profile:
return string.IsNullOrEmpty(procedure.AltProcName) ? string.Empty : procedure.AltProcName;
#if ORACLE_DB
case MoreContent.Oracle:
if (!string.IsNullOrEmpty(procedure.ResultsWriter) && procedure.ResultsWriter.Contains("Sensus-Oracle-DB"))