(1) ProcedureDlg is initially unlocked after New/Copy/Import, (2) ProceduresDlg displays extra information in 'More' column.
This commit is contained in:
+13
-4
@@ -24,6 +24,8 @@ namespace TBF
|
||||
public readonly int Dpi;
|
||||
public const int Dpi100pct = 96;
|
||||
|
||||
readonly bool openUnlocked;
|
||||
|
||||
/// <summary>
|
||||
/// Procedure to be updated by this dialog.
|
||||
/// 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.
|
||||
Dpi = (int)this.CreateGraphics().DpiX;
|
||||
openUnlocked = false;
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
@@ -93,14 +96,14 @@ namespace TBF
|
||||
SelectedTestIx = -1;
|
||||
}
|
||||
|
||||
public ProcedureDlg(Config.Entities.Procedure procedure, IList<string> usedNames)
|
||||
public ProcedureDlg(Config.Entities.Procedure procedure, IList<string> usedNames, bool openUnlocked = false)
|
||||
: this()
|
||||
{
|
||||
if (procedure == null) throw new ArgumentNullException("procedure");
|
||||
|
||||
LoadedProcedure = procedure;
|
||||
|
||||
LoadedProcedure = procedure;
|
||||
this.usedNames = usedNames;
|
||||
this.openUnlocked = openUnlocked;
|
||||
|
||||
sharedButtons.RequiredGroupMembership = procedure.Protected ? new Users.Grp.GID[] { Users.Grp.GID.Metrologists }
|
||||
: new Users.Grp.GID[] { Users.Grp.GID.TestingSpecialists, Users.Grp.GID.Metrologists };
|
||||
@@ -366,6 +369,13 @@ namespace TBF
|
||||
{
|
||||
ctrl.Initialize();
|
||||
}
|
||||
|
||||
/// Optionally unlock this dialog
|
||||
if (openUnlocked)
|
||||
{
|
||||
sharedButtons.UnlockButtons();
|
||||
Unlocked(sender, e);
|
||||
}
|
||||
}
|
||||
|
||||
void Localize()
|
||||
@@ -401,7 +411,6 @@ namespace TBF
|
||||
metersKindRadioButton3.Text = Strings.Heat_meter;
|
||||
}
|
||||
|
||||
|
||||
#region General
|
||||
|
||||
void RefreshGeneralTab()
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2017 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
Generated
+9
@@ -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>
|
||||
/// Looks up a localized string similar to More.
|
||||
/// </summary>
|
||||
|
||||
@@ -2005,4 +2005,7 @@
|
||||
<data name="No_water_meter" xml:space="preserve">
|
||||
<value>No water meter</value>
|
||||
</data>
|
||||
<data name="More" xml:space="preserve">
|
||||
<value>More</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2017 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -12,6 +12,7 @@ using Config.Entities;
|
||||
using TBF.BenchControl;
|
||||
using TBF.BenchControl.GenericDevices;
|
||||
using TBF.Resources;
|
||||
using System.Text;
|
||||
|
||||
namespace TBF.UiControls
|
||||
{
|
||||
@@ -27,6 +28,7 @@ namespace TBF.UiControls
|
||||
ItemNr,
|
||||
Name,
|
||||
Description,
|
||||
More,
|
||||
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.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.More, (ls.ProceduresColumnCount > 3) ? ls.ProceduresColumnWidths[3] : (300 * parent.Dpi / PathsDlg.Dpi100pct));
|
||||
|
||||
editors = new Control[columnsCount];
|
||||
///
|
||||
editors[(int)Column.ItemNr] = new TextBox(); /// ItemNr
|
||||
editors[(int)Column.Name] = new TextBox(); /// Name
|
||||
editors[(int)Column.Description] = new TextBox(); /// Description
|
||||
///
|
||||
editors[(int)Column.More] = null;
|
||||
///
|
||||
for (int i = 0; i < editors.Length; i++)
|
||||
{
|
||||
editors[i].Visible = false;
|
||||
parent.Controls.Add(editors[i]);
|
||||
if (editors[i] != null)
|
||||
{
|
||||
editors[i].Visible = false;
|
||||
parent.Controls.Add(editors[i]);
|
||||
}
|
||||
}
|
||||
|
||||
ReloadAndRedrawAll();
|
||||
@@ -97,9 +104,17 @@ namespace TBF.UiControls
|
||||
{
|
||||
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());
|
||||
lvi.SubItems.Add(entity.Name);
|
||||
lvi.SubItems.Add(entity.Description);
|
||||
lvi.SubItems.Add(tests.ToString());
|
||||
lvi.Tag = entity;
|
||||
|
||||
Items.Add(lvi);
|
||||
@@ -193,7 +208,7 @@ namespace TBF.UiControls
|
||||
newProcedure.CreationUser = Users.GlobalData.CurrentUser.UserName;
|
||||
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
|
||||
parent.Unlock();
|
||||
@@ -329,7 +344,7 @@ namespace TBF.UiControls
|
||||
newProcedure.CreationTime = DateTime.Now;
|
||||
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
|
||||
parent.Unlock();
|
||||
@@ -382,7 +397,7 @@ namespace TBF.UiControls
|
||||
newProcedure.CreationUser = Users.GlobalData.CurrentUser.UserName;
|
||||
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
|
||||
parent.Unlock();
|
||||
|
||||
Reference in New Issue
Block a user