(1) ProcedureDlg is initially unlocked after New/Copy/Import, (2) ProceduresDlg displays extra information in 'More' column.

This commit is contained in:
Milan Hanajik
2019-07-23 12:09:24 +02:00
parent e622718c27
commit 2f788adb7d
5 changed files with 48 additions and 12 deletions
+13 -4
View File
@@ -24,6 +24,8 @@ namespace TBF
public readonly int Dpi; public readonly int Dpi;
public const int Dpi100pct = 96; public const int Dpi100pct = 96;
readonly bool openUnlocked;
/// <summary> /// <summary>
/// Procedure to be updated by this dialog. /// Procedure to be updated by this dialog.
/// Set by the constructor or updated by the parent after creation and before loading. /// Set by the constructor or updated by the parent after creation and before loading.
@@ -58,6 +60,7 @@ namespace TBF
{ {
/// Detect display setting: 100% = 96dpi, 125% = 120dpi, 150% = 144dpi. /// Detect display setting: 100% = 96dpi, 125% = 120dpi, 150% = 144dpi.
Dpi = (int)this.CreateGraphics().DpiX; Dpi = (int)this.CreateGraphics().DpiX;
openUnlocked = false;
InitializeComponent(); InitializeComponent();
@@ -93,14 +96,14 @@ namespace TBF
SelectedTestIx = -1; SelectedTestIx = -1;
} }
public ProcedureDlg(Config.Entities.Procedure procedure, IList<string> usedNames) public ProcedureDlg(Config.Entities.Procedure procedure, IList<string> usedNames, bool openUnlocked = false)
: this() : this()
{ {
if (procedure == null) throw new ArgumentNullException("procedure"); if (procedure == null) throw new ArgumentNullException("procedure");
LoadedProcedure = procedure; LoadedProcedure = procedure;
this.usedNames = usedNames; this.usedNames = usedNames;
this.openUnlocked = openUnlocked;
sharedButtons.RequiredGroupMembership = procedure.Protected ? new Users.Grp.GID[] { Users.Grp.GID.Metrologists } sharedButtons.RequiredGroupMembership = procedure.Protected ? new Users.Grp.GID[] { Users.Grp.GID.Metrologists }
: new Users.Grp.GID[] { Users.Grp.GID.TestingSpecialists, Users.Grp.GID.Metrologists }; : new Users.Grp.GID[] { Users.Grp.GID.TestingSpecialists, Users.Grp.GID.Metrologists };
@@ -366,6 +369,13 @@ namespace TBF
{ {
ctrl.Initialize(); ctrl.Initialize();
} }
/// Optionally unlock this dialog
if (openUnlocked)
{
sharedButtons.UnlockButtons();
Unlocked(sender, e);
}
} }
void Localize() void Localize()
@@ -401,7 +411,6 @@ namespace TBF
metersKindRadioButton3.Text = Strings.Heat_meter; metersKindRadioButton3.Text = Strings.Heat_meter;
} }
#region General #region General
void RefreshGeneralTab() void RefreshGeneralTab()
+1 -1
View File
@@ -1,5 +1,5 @@
/// ///
/// Copyright (c) 2013-2017 Sensus Slovensko a.s. /// Copyright (c) 2013-2019 Sensus Slovensko a.s.
/// ///
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
+9
View File
@@ -2589,6 +2589,15 @@ namespace TBF.Resources {
} }
} }
/// <summary>
/// Looks up a localized string similar to More.
/// </summary>
internal static string More {
get {
return ResourceManager.GetString("More", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to More. /// Looks up a localized string similar to More.
/// </summary> /// </summary>
+3
View File
@@ -2005,4 +2005,7 @@
<data name="No_water_meter" xml:space="preserve"> <data name="No_water_meter" xml:space="preserve">
<value>No water meter</value> <value>No water meter</value>
</data> </data>
<data name="More" xml:space="preserve">
<value>More</value>
</data>
</root> </root>
+22 -7
View File
@@ -1,5 +1,5 @@
/// ///
/// Copyright (c) 2013-2017 Sensus Metering Systems /// Copyright (c) 2013-2019 Sensus Slovensko a.s.
/// ///
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -12,6 +12,7 @@ using Config.Entities;
using TBF.BenchControl; using TBF.BenchControl;
using TBF.BenchControl.GenericDevices; using TBF.BenchControl.GenericDevices;
using TBF.Resources; using TBF.Resources;
using System.Text;
namespace TBF.UiControls namespace TBF.UiControls
{ {
@@ -27,6 +28,7 @@ namespace TBF.UiControls
ItemNr, ItemNr,
Name, Name,
Description, Description,
More,
ColumnsCount, ColumnsCount,
} }
readonly int columnsCount = (int)Column.ColumnsCount; readonly int columnsCount = (int)Column.ColumnsCount;
@@ -56,17 +58,22 @@ namespace TBF.UiControls
Columns.Add(Strings.Nr, (ls.ProceduresColumnCount > 0) ? ls.ProceduresColumnWidths[0] : (30 * parent.Dpi / PathsDlg.Dpi100pct)); Columns.Add(Strings.Nr, (ls.ProceduresColumnCount > 0) ? ls.ProceduresColumnWidths[0] : (30 * parent.Dpi / PathsDlg.Dpi100pct));
Columns.Add(Strings.Name, (ls.ProceduresColumnCount > 1) ? ls.ProceduresColumnWidths[1] : (100 * parent.Dpi / PathsDlg.Dpi100pct)); Columns.Add(Strings.Name, (ls.ProceduresColumnCount > 1) ? ls.ProceduresColumnWidths[1] : (100 * parent.Dpi / PathsDlg.Dpi100pct));
Columns.Add(Strings.DescriptionColHdr, (ls.ProceduresColumnCount > 2) ? ls.ProceduresColumnWidths[2] : (300 * parent.Dpi / PathsDlg.Dpi100pct)); Columns.Add(Strings.DescriptionColHdr, (ls.ProceduresColumnCount > 2) ? ls.ProceduresColumnWidths[2] : (300 * parent.Dpi / PathsDlg.Dpi100pct));
Columns.Add(Strings.More, (ls.ProceduresColumnCount > 3) ? ls.ProceduresColumnWidths[3] : (300 * parent.Dpi / PathsDlg.Dpi100pct));
editors = new Control[columnsCount]; editors = new Control[columnsCount];
/// ///
editors[(int)Column.ItemNr] = new TextBox(); /// ItemNr editors[(int)Column.ItemNr] = new TextBox(); /// ItemNr
editors[(int)Column.Name] = new TextBox(); /// Name editors[(int)Column.Name] = new TextBox(); /// Name
editors[(int)Column.Description] = new TextBox(); /// Description editors[(int)Column.Description] = new TextBox(); /// Description
/// editors[(int)Column.More] = null;
///
for (int i = 0; i < editors.Length; i++) for (int i = 0; i < editors.Length; i++)
{ {
editors[i].Visible = false; if (editors[i] != null)
parent.Controls.Add(editors[i]); {
editors[i].Visible = false;
parent.Controls.Add(editors[i]);
}
} }
ReloadAndRedrawAll(); ReloadAndRedrawAll();
@@ -97,9 +104,17 @@ namespace TBF.UiControls
{ {
Procedure entity = (Procedure)myItem; Procedure entity = (Procedure)myItem;
StringBuilder tests = new StringBuilder();
foreach (var test in entity.Tests)
{
tests.Append(test.Name);
tests.Append(", ");
}
ListViewItem lvi = new ListViewItem((entity.ItemNr + 1).ToString()); ListViewItem lvi = new ListViewItem((entity.ItemNr + 1).ToString());
lvi.SubItems.Add(entity.Name); lvi.SubItems.Add(entity.Name);
lvi.SubItems.Add(entity.Description); lvi.SubItems.Add(entity.Description);
lvi.SubItems.Add(tests.ToString());
lvi.Tag = entity; lvi.Tag = entity;
Items.Add(lvi); Items.Add(lvi);
@@ -193,7 +208,7 @@ namespace TBF.UiControls
newProcedure.CreationUser = Users.GlobalData.CurrentUser.UserName; newProcedure.CreationUser = Users.GlobalData.CurrentUser.UserName;
newProcedure.CreationTime = DateTime.Now; newProcedure.CreationTime = DateTime.Now;
if (new ProcedureDlg(newProcedure, GetUsedNames()).ShowDialog() == DialogResult.OK) if (new ProcedureDlg(newProcedure, GetUsedNames(), true).ShowDialog() == DialogResult.OK)
{ {
/// TODO: Make name uniqueness test /// TODO: Make name uniqueness test
parent.Unlock(); parent.Unlock();
@@ -329,7 +344,7 @@ namespace TBF.UiControls
newProcedure.CreationTime = DateTime.Now; newProcedure.CreationTime = DateTime.Now;
newProcedure.Protected = false; newProcedure.Protected = false;
if ((new ProcedureDlg(newProcedure, GetUsedNames())).ShowDialog() == DialogResult.OK) if ((new ProcedureDlg(newProcedure, GetUsedNames(), true)).ShowDialog() == DialogResult.OK)
{ {
/// TODO: Make name uniqueness test /// TODO: Make name uniqueness test
parent.Unlock(); parent.Unlock();
@@ -382,7 +397,7 @@ namespace TBF.UiControls
newProcedure.CreationUser = Users.GlobalData.CurrentUser.UserName; newProcedure.CreationUser = Users.GlobalData.CurrentUser.UserName;
newProcedure.CreationTime = DateTime.Now; newProcedure.CreationTime = DateTime.Now;
if ((new ProcedureDlg(newProcedure, GetUsedNames())).ShowDialog() == DialogResult.OK) if ((new ProcedureDlg(newProcedure, GetUsedNames(), true)).ShowDialog() == DialogResult.OK)
{ {
/// TODO: Make name uniqueness test /// TODO: Make name uniqueness test
parent.Unlock(); parent.Unlock();