diff --git a/TBF/TBF.csproj b/TBF/TBF.csproj
index d369ece6f..07416170a 100644
--- a/TBF/TBF.csproj
+++ b/TBF/TBF.csproj
@@ -2961,6 +2961,18 @@
SharedButtons.cs
+
+ UserControl
+
+
+ SharedSearchForListBox.cs
+
+
+ UserControl
+
+
+ SharedSearchForListView.cs
+
Component
@@ -3876,6 +3888,12 @@
SharedButtons.cs
+
+ SharedSearchForListBox.cs
+
+
+ SharedSearchForListView.cs
+
TabNameDlg.cs
diff --git a/TBF/UI/Bench/Components/ComponentsManagerDlg.Designer.cs b/TBF/UI/Bench/Components/ComponentsManagerDlg.Designer.cs
index a1030caae..3d5cbb283 100644
--- a/TBF/UI/Bench/Components/ComponentsManagerDlg.Designer.cs
+++ b/TBF/UI/Bench/Components/ComponentsManagerDlg.Designer.cs
@@ -31,66 +31,98 @@ namespace TBF.UI.Bench.Components
///
private void InitializeComponent()
{
- System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ComponentsManagerDlg));
- this.splitContainer = new System.Windows.Forms.SplitContainer();
- this.listViewEx = new Common.Forms.ListViewEx();
- this.sharedButtons = new TBF.UI.Shared.SharedButtons();
- ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
- this.splitContainer.Panel1.SuspendLayout();
- this.splitContainer.Panel2.SuspendLayout();
- this.splitContainer.SuspendLayout();
- this.SuspendLayout();
- //
- // splitContainer
- //
- resources.ApplyResources(this.splitContainer, "splitContainer");
- this.splitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
- this.splitContainer.Name = "splitContainer";
- //
- // splitContainer.Panel1
- //
- this.splitContainer.Panel1.Controls.Add(this.listViewEx);
- //
- // splitContainer.Panel2
- //
- this.splitContainer.Panel2.Controls.Add(this.sharedButtons);
- //
- // listViewEx
- //
- this.listViewEx.AllowColumnReorder = true;
- resources.ApplyResources(this.listViewEx, "listViewEx");
- this.listViewEx.DoubleClickActivation = false;
- this.listViewEx.FullRowSelect = true;
- this.listViewEx.GridLines = true;
- this.listViewEx.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
- this.listViewEx.HideSelection = false;
- this.listViewEx.MultiSelect = false;
- this.listViewEx.Name = "listViewEx";
- this.listViewEx.UseCompatibleStateImageBehavior = false;
- this.listViewEx.View = System.Windows.Forms.View.Details;
- this.listViewEx.SubItemRightClicked += new Common.Forms.SubItemEventHandler(this.listViewEx_SubItemRightClicked);
- this.listViewEx.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.listViewEx_ColumnClick);
- this.listViewEx.SelectedIndexChanged += new System.EventHandler(this.componentsListView_SelectedIndexChanged);
- this.listViewEx.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.listViewEx_MouseDoubleClick);
- //
- // sharedButtons
- //
- resources.ApplyResources(this.sharedButtons, "sharedButtons");
- this.sharedButtons.Name = "sharedButtons";
- //
- // ComponentsManagerDlg
- //
- resources.ApplyResources(this, "$this");
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.Controls.Add(this.splitContainer);
- this.Name = "ComponentsManagerDlg";
- this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ComponentsManagerDlg_FormClosing);
- this.Load += new System.EventHandler(this.ComponentsManagerDlg_Load);
- this.splitContainer.Panel1.ResumeLayout(false);
- this.splitContainer.Panel2.ResumeLayout(false);
- ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).EndInit();
- this.splitContainer.ResumeLayout(false);
- this.ResumeLayout(false);
+ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ComponentsManagerDlg));
+ this.splitContainer1 = new System.Windows.Forms.SplitContainer();
+ this.sharedSearchForListView1 = new TBF.UI.Shared.SharedSearchForListView();
+ this.listViewEx = new Common.Forms.ListViewEx();
+ this.splitContainer = new System.Windows.Forms.SplitContainer();
+ this.sharedButtons = new TBF.UI.Shared.SharedButtons();
+ ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
+ this.splitContainer1.Panel1.SuspendLayout();
+ this.splitContainer1.Panel2.SuspendLayout();
+ this.splitContainer1.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
+ this.splitContainer.Panel1.SuspendLayout();
+ this.splitContainer.Panel2.SuspendLayout();
+ this.splitContainer.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // splitContainer1
+ //
+ resources.ApplyResources(this.splitContainer1, "splitContainer1");
+ this.splitContainer1.Name = "splitContainer1";
+ //
+ // splitContainer1.Panel1
+ //
+ this.splitContainer1.Panel1.Controls.Add(this.sharedSearchForListView1);
+ this.splitContainer1.Panel1.Cursor = System.Windows.Forms.Cursors.Default;
+ //
+ // splitContainer1.Panel2
+ //
+ resources.ApplyResources(this.splitContainer1.Panel2, "splitContainer1.Panel2");
+ this.splitContainer1.Panel2.Controls.Add(this.listViewEx);
+ //
+ // sharedSearchForListView1
+ //
+ resources.ApplyResources(this.sharedSearchForListView1, "sharedSearchForListView1");
+ this.sharedSearchForListView1.ListViewEx = null;
+ this.sharedSearchForListView1.Name = "sharedSearchForListView1";
+ //
+ // listViewEx
+ //
+ this.listViewEx.AllowColumnReorder = true;
+ resources.ApplyResources(this.listViewEx, "listViewEx");
+ this.listViewEx.DoubleClickActivation = false;
+ this.listViewEx.FullRowSelect = true;
+ this.listViewEx.GridLines = true;
+ this.listViewEx.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
+ this.listViewEx.HideSelection = false;
+ this.listViewEx.MultiSelect = false;
+ this.listViewEx.Name = "listViewEx";
+ this.listViewEx.UseCompatibleStateImageBehavior = false;
+ this.listViewEx.View = System.Windows.Forms.View.Details;
+ this.listViewEx.SubItemRightClicked += new Common.Forms.SubItemEventHandler(this.listViewEx_SubItemRightClicked);
+ this.listViewEx.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.listViewEx_ColumnClick);
+ this.listViewEx.SelectedIndexChanged += new System.EventHandler(this.componentsListView_SelectedIndexChanged);
+ this.listViewEx.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.listViewEx_MouseDoubleClick);
+ //
+ // splitContainer
+ //
+ resources.ApplyResources(this.splitContainer, "splitContainer");
+ this.splitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
+ this.splitContainer.Name = "splitContainer";
+ //
+ // splitContainer.Panel1
+ //
+ this.splitContainer.Panel1.Controls.Add(this.splitContainer1);
+ //
+ // splitContainer.Panel2
+ //
+ this.splitContainer.Panel2.Controls.Add(this.sharedButtons);
+ //
+ // sharedButtons
+ //
+ resources.ApplyResources(this.sharedButtons, "sharedButtons");
+ this.sharedButtons.Name = "sharedButtons";
+ //
+ // ComponentsManagerDlg
+ //
+ resources.ApplyResources(this, "$this");
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.splitContainer);
+ this.Name = "ComponentsManagerDlg";
+ this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ComponentsManagerDlg_FormClosing);
+ this.Load += new System.EventHandler(this.ComponentsManagerDlg_Load);
+ this.splitContainer1.Panel1.ResumeLayout(false);
+ this.splitContainer1.Panel2.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
+ this.splitContainer1.ResumeLayout(false);
+ this.splitContainer.Panel1.ResumeLayout(false);
+ this.splitContainer.Panel2.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).EndInit();
+ this.splitContainer.ResumeLayout(false);
+ this.ResumeLayout(false);
+
}
#endregion
@@ -98,5 +130,7 @@ namespace TBF.UI.Bench.Components
private Common.Forms.ListViewEx listViewEx;
private System.Windows.Forms.SplitContainer splitContainer;
private TBF.UI.Shared.SharedButtons sharedButtons;
- }
+ private System.Windows.Forms.SplitContainer splitContainer1;
+ private Shared.SharedSearchForListView sharedSearchForListView1;
+ }
}
\ No newline at end of file
diff --git a/TBF/UI/Bench/Components/ComponentsManagerDlg.cs b/TBF/UI/Bench/Components/ComponentsManagerDlg.cs
index 9df9e5690..48ec6c424 100644
--- a/TBF/UI/Bench/Components/ComponentsManagerDlg.cs
+++ b/TBF/UI/Bench/Components/ComponentsManagerDlg.cs
@@ -1,11 +1,9 @@
///
/// Copyright (c) 2013-2021 Sensus Slovensko a.s.
///
-
using System;
using System.Collections.Generic;
using System.IO;
-using System.Web.UI;
using System.Windows.Forms;
using log4net;
using NHibernate;
@@ -15,31 +13,27 @@ using Config.Entities;
using TBF.Rig;
using TBF.Rig.Generic;
using TBF.Resources;
-using TBF.Rig.GenericDevices;
-using TBF.Rig.WaterMeters.WaterMeter;
using TBF.UI.Shared;
namespace TBF.UI.Bench.Components
{
- public partial class ComponentsManagerDlg : Form, IParentOfListViewEx
- {
- static readonly ILog log = LogManager.GetLogger(typeof(ComponentsManagerDlg));
+ public partial class ComponentsManagerDlg : Form, IParentOfListViewEx
+ {
+ static readonly ILog log = LogManager.GetLogger(typeof(ComponentsManagerDlg));
- ///
- /// List of components (=component configuration instances)
- ///
- IList cmpntEntities;
+ ///
+ /// List of components (=component configuration instances)
+ ///
+ IList cmpntEntities;
- IList toBeDeletedEntities;
+ IList toBeDeletedEntities;
- ISession session;
+ ISession session;
- SelectComponentClassDlg selectComponentTypeDlg;
+ SelectComponentClassDlg selectComponentTypeDlg; /// Constructed once, the selection is kept between dialog usages
- /// Constructed once, the selection is kept between dialog usages
- CfgUpdateFlags flags;
-
- /// Or-ed from particular Flags from ComponentParametersDlg
+ CfgUpdateFlags flags; /// Or-ed from particular Flags from ComponentParametersDlg
+
///
/// ListViewEx columns
///
@@ -56,29 +50,32 @@ namespace TBF.UI.Bench.Components
}
MySortOrder sortOrder = MySortOrder.Ascending;
- int sortColumn = -1;
+ int sortColumn = -1; /// 0-based index of column to be used for sorting
- /// 0-based index of column to be used for sorting
- /// Editors used by listViewEx
+ /// Editors used by listViewEx
ComboBox debugCB;
-
ComboBox logCB;
- bool unlocked;
+ bool unlocked;
- public ComponentsManagerDlg()
- {
- toBeDeletedEntities = new List();
+ public ComponentsManagerDlg()
+ {
+ toBeDeletedEntities = new List();
- InitializeComponent();
+ InitializeComponent();
- flags = CfgUpdateFlags.None;
+ flags = CfgUpdateFlags.None;
- selectComponentTypeDlg = new SelectComponentClassDlg();
+ selectComponentTypeDlg = new SelectComponentClassDlg();
+
+ /// SharedDlgSearchForListView configuration
+ sharedSearchForListView1.OwnerForm = this;
+ sharedSearchForListView1.ListViewEx = listViewEx;
+ sharedSearchForListView1.nrLabel.Text = "Component nr.";
/// SharedDlgButtons configuration
sharedButtons.ParentForm = this;
- sharedButtons.RequiredGroupMembership = new GID[] { GID.Metrologists };
+ sharedButtons.RequiredGroupMembership = new GID[] { GID.Metrologists };
sharedButtons.OptionalButtons = SharedButtons.Buttons.Add |
SharedButtons.Buttons.Remove |
@@ -89,35 +86,34 @@ namespace TBF.UI.Bench.Components
SharedButtons.Buttons.Export |
SharedButtons.Buttons.Import;
sharedButtons.Unlocked += Unlocked;
- sharedButtons.OKClicked += okButton_Click;
- sharedButtons.CancelClicked += cancelButton_Click;
- sharedButtons.AddClicked += addButton_Click;
- sharedButtons.RemoveClicked += removeButton_Click;
- sharedButtons.UpClicked += upButton_Click;
- sharedButtons.DownClicked += downButton_Click;
- sharedButtons.EditClicked += editButton_Click;
+ sharedButtons.OKClicked += okButton_Click;
+ sharedButtons.CancelClicked += cancelButton_Click;
+ sharedButtons.AddClicked += addButton_Click;
+ sharedButtons.RemoveClicked += removeButton_Click;
+ sharedButtons.UpClicked += upButton_Click;
+ sharedButtons.DownClicked += downButton_Click;
+ sharedButtons.EditClicked += editButton_Click;
sharedButtons.CopyClicked += copyButton_Click;
sharedButtons.ExportClicked += exportButton_Click;
sharedButtons.ImportClicked += importButton_Click;
}
- private void ComponentsManagerDlg_Load(object sender, EventArgs e)
- {
+ private void ComponentsManagerDlg_Load(object sender, EventArgs e)
+ {
LoadFormPosition();
Text = Strings.Test_Bench_Components_Configuration;
LocalSettings ls = Program.LocalSettings;
- listViewEx.Columns.Add(Strings.Nr, (ls.ComponentsColumnCount > 0) ? ls.ComponentsColumnWidths[0] : 40);
- listViewEx.Columns.Add(Strings.Name, (ls.ComponentsColumnCount > 1) ? ls.ComponentsColumnWidths[1] : 80);
- listViewEx.Columns.Add(Strings.Type, (ls.ComponentsColumnCount > 2) ? ls.ComponentsColumnWidths[2] : 120);
- listViewEx.Columns.Add(Strings.Parent, (ls.ComponentsColumnCount > 3) ? ls.ComponentsColumnWidths[3] : 55);
- listViewEx.Columns.Add(Strings.Mode, (ls.ComponentsColumnCount > 4) ? ls.ComponentsColumnWidths[4] : 55);
- listViewEx.Columns.Add(Strings.Logging, (ls.ComponentsColumnCount > 5) ? ls.ComponentsColumnWidths[5] : 55);
- listViewEx.Columns.Add(Strings.Parameters,
- (ls.ComponentsColumnCount > 6) ? ls.ComponentsColumnWidths[6] : 600);
+ listViewEx.Columns.Add(Strings.Nr, (ls.ComponentsColumnCount > 0) ? ls.ComponentsColumnWidths[0] : 40);
+ listViewEx.Columns.Add(Strings.Name, (ls.ComponentsColumnCount > 1) ? ls.ComponentsColumnWidths[1] : 80);
+ listViewEx.Columns.Add(Strings.Type, (ls.ComponentsColumnCount > 2) ? ls.ComponentsColumnWidths[2] : 120);
+ listViewEx.Columns.Add(Strings.Parent, (ls.ComponentsColumnCount > 3) ? ls.ComponentsColumnWidths[3] : 55);
+ listViewEx.Columns.Add(Strings.Mode, (ls.ComponentsColumnCount > 4) ? ls.ComponentsColumnWidths[4] : 55);
+ listViewEx.Columns.Add(Strings.Logging, (ls.ComponentsColumnCount > 5) ? ls.ComponentsColumnWidths[5] : 55);
+ listViewEx.Columns.Add(Strings.Parameters, (ls.ComponentsColumnCount > 6) ? ls.ComponentsColumnWidths[6] : 600);
listViewEx.HeaderStyle = ColumnHeaderStyle.Clickable;
- debugCB = new ComboBox();
+ debugCB = new ComboBox();
for (DebugMode level = 0; level < DebugMode.Count; level++) debugCB.Items.Add(level.ToDescription());
splitContainer.Panel1.Controls.Add(debugCB);
@@ -128,23 +124,23 @@ namespace TBF.UI.Bench.Components
listViewEx.SubItemClicked += new SubItemEventHandler(listViewEx_SubItemClicked);
listViewEx.SubItemEndEditing += new SubItemEndEditingEventHandler(listViewEx_SubItemEndEditing);
- sharedButtons.DisableButtons(SharedButtons.Buttons.Remove | SharedButtons.Buttons.Edit);
+ sharedButtons.DisableButtons(SharedButtons.Buttons.Remove | SharedButtons.Buttons.Edit);
- session = TBF.DB.CreateSession(DBKind.Config);
- cmpntEntities = session.QueryOver()
- .OrderBy(x => x.ItemNr).Asc
- .List();
+ session = TBF.DB.CreateSession(DBKind.Config);
+ cmpntEntities = session.QueryOver()
+ .OrderBy(x => x.ItemNr).Asc
+ .List();
- RedrawAll();
- }
+ RedrawAll();
+ }
void listViewEx_SubItemClicked(object sender, SubItemEventArgs e)
{
- if (unlocked && e.SubItem == (int)Column.DebugMode)
+ if (unlocked && e.SubItem == (int)Column.DebugMode)
{
listViewEx.StartEditing(debugCB, e.Item, e.SubItem);
}
- else if (unlocked && e.SubItem == (int)Column.Logging)
+ else if (unlocked && e.SubItem == (int)Column.Logging)
{
listViewEx.StartEditing(logCB, e.Item, e.SubItem);
}
@@ -155,7 +151,7 @@ namespace TBF.UI.Bench.Components
if (!unlocked || ((e.SubItem != (int)Column.DebugMode) && (e.SubItem != (int)Column.Logging))) return;
if (DialogResult.Yes == MessageBox.Show(Strings.Do_you_want_to_copy_this_value_to_all_cells_below_this_cell,
- Strings.Confirmation, MessageBoxButtons.YesNo, MessageBoxIcon.Question))
+ Strings.Confirmation, MessageBoxButtons.YesNo, MessageBoxIcon.Question))
{
int columnNr = e.SubItem;
string value = null;
@@ -213,11 +209,10 @@ namespace TBF.UI.Bench.Components
if (debugCB.Text.Equals(level.ToDescription()))
{
cmpnt.DebugMode = level;
- flags |= CfgUpdateFlags.RestartRqrd;
+ flags |= CfgUpdateFlags.RestartRqrd;
return;
}
}
-
e.DisplayText = cmpnt.DebugMode.ToString();
}
else if (e.SubItem == (int)Column.Logging)
@@ -227,36 +222,35 @@ namespace TBF.UI.Bench.Components
if (logCB.Text.Equals(level.ToDescription()))
{
cmpnt.LogLevel = level;
- flags |= CfgUpdateFlags.RestartRqrd;
- return;
+ flags |= CfgUpdateFlags.RestartRqrd;
+ return;
}
}
-
e.DisplayText = cmpnt.LogLevel.ToString();
}
}
- private void Unlocked(object sender, EventArgs e)
- {
- unlocked = true;
+ private void Unlocked(object sender, EventArgs e)
+ {
+ unlocked = true;
- if (listViewEx.SelectedItems.Count == 1)
- {
- int ix = listViewEx.SelectedIndices[0];
- Focus();
- listViewEx.Items[ix].Selected = true;
- listViewEx.Items[ix].EnsureVisible();
- }
- }
+ if (listViewEx.SelectedItems.Count == 1)
+ {
+ int ix = listViewEx.SelectedIndices[0];
+ Focus();
+ listViewEx.Items[ix].Selected = true;
+ listViewEx.Items[ix].EnsureVisible();
+ }
+ }
- void RedrawAll()
- {
- listViewEx.Items.Clear();
- foreach (var cmpnt in cmpntEntities) DrawOne(cmpnt);
- }
+ void RedrawAll()
+ {
+ listViewEx.Items.Clear();
+ foreach (var cmpnt in cmpntEntities) DrawOne(cmpnt);
+ }
- void DrawOne(Component cmpnt)
- {
+ void DrawOne(Component cmpnt)
+ {
ListViewItem lvi = new ListViewItem(cmpnt.ItemNr.ToString());
lvi.Tag = cmpnt;
lvi.SubItems.Add(cmpnt.Name);
@@ -265,17 +259,18 @@ namespace TBF.UI.Bench.Components
IComponentCfg cmpCfg = TbfComponents.CmpntCfgFromCmpntEntity(cmpnt);
if (cmpCfg != null)
- {
+ {
lvi.SubItems.Add(cmpCfg.DebugLevel.ToDescription());
- lvi.SubItems.Add(cmpCfg.LogLevel.ToDescription());
- lvi.SubItems.Add(cmpCfg.ToString(-1));
- }
- else
- {
- lvi.SubItems.Add("---");
- lvi.SubItems.Add("---");
- lvi.SubItems.Add("Not a component");
- }
+ lvi.SubItems.Add(cmpCfg.LogLevel.ToDescription());
+ lvi.SubItems.Add(cmpCfg.ToString(-1));
+
+ }
+ else
+ {
+ lvi.SubItems.Add("---");
+ lvi.SubItems.Add("---");
+ lvi.SubItems.Add("Not a component");
+ }
listViewEx.Items.Add(lvi);
}
@@ -314,10 +309,10 @@ namespace TBF.UI.Bench.Components
private void LoadFormPosition()
{
LocalSettings ls = Program.LocalSettings;
- Width = (ls.ComponentsDlgWidth > 0) ? ls.ComponentsDlgWidth : 850;
+ Width = (ls.ComponentsDlgWidth > 0) ? ls.ComponentsDlgWidth : 850;
Height = (ls.ComponentsDlgHeight > 0) ? ls.ComponentsDlgHeight : 500;
- Left = (ls.ComponentsDlgLeft != 0) ? ls.ComponentsDlgLeft : 200;
- Top = (ls.ComponentsDlgTop != 0) ? ls.ComponentsDlgTop : 100;
+ Left = (ls.ComponentsDlgLeft != 0) ? ls.ComponentsDlgLeft : 200;
+ Top = (ls.ComponentsDlgTop != 0) ? ls.ComponentsDlgTop : 100;
}
///
@@ -344,11 +339,7 @@ namespace TBF.UI.Bench.Components
{
for (int i = 0; i < (int)Column.ColumnsCount; i++)
{
- if (listViewEx.Columns[i].Width != ls.ComponentsColumnWidths[i])
- {
- anyColumnDiffers = true;
- break;
- }
+ if (listViewEx.Columns[i].Width != ls.ComponentsColumnWidths[i]) { anyColumnDiffers = true; break; }
}
}
@@ -380,160 +371,84 @@ namespace TBF.UI.Bench.Components
}
///
- /// OK
+ /// OK
///
private void okButton_Click(object sender, EventArgs e)
- {
- ValidateComponents();
- if ((flags & CfgUpdateFlags.AnyChange) != 0 || (flags & CfgUpdateFlags.RestartRqrd) != 0)
- {
+ {
+ if ((flags & CfgUpdateFlags.AnyChange) != 0 || (flags & CfgUpdateFlags.RestartRqrd) != 0)
+ {
SaveDBChanges(session);
- flags = CfgUpdateFlags.None; /// Changes saved
+ flags = CfgUpdateFlags.None; /// Changes saved
}
SaveUISettings();
DialogResult = DialogResult.OK;
- Close();
- return;
- }
+ Close();
+ return;
+ }
- private void ValidateComponents()
- {
- Boolean invalid = false;
- string validationMessage = "";
- //validation cycle
- invalid = !ValidateMetersBatchCount(out validationMessage);
-
- if (invalid)
- {
- MessageBox.Show(validationMessage, Strings.Warning, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
- }
- }
-
- private Boolean ValidateMetersBatchCount(out string message)
- {
- bool invalid = false;
-
- TBF.Rig.DataContainer.BenchInfo.ComponentCfg benchInfo = null;
- int waterMetersCount = 0;
- int iWaterMeterComponentCount = 0;
- foreach (Component component in cmpntEntities)
- {
- if (component == null)
- {
- continue;
- }
-
- string className = (string.IsNullOrEmpty(component.ClassName) ? string.Empty : component.ClassName);
- if (className == "DataContainer.BenchInfo")
- {
- try
- {
- var cfg = new TBF.Rig.DataContainer.BenchInfo.Factory().CmpntCfgFromCmpntEntity(component)
- as TBF.Rig.DataContainer.BenchInfo.ComponentCfg;
-
- waterMetersCount = cfg.WaterMetersCount;
- }
- catch (Exception e)
- {
- log.Error("Finding of DataContainer.BenchInfo data unsuccessfully!");
- }
- }
-
- if (className == "WaterMeter")
- {
- iWaterMeterComponentCount++;
- }
- }
-
-
- invalid = (waterMetersCount != iWaterMeterComponentCount);
-
-
- if (invalid)
- {
- message = "The count of water meters on the bench does not match the count of their components!";
- return false;
- }
-
- message = "";
- return true;
- }
-
- /// Cancel
- private void cancelButton_Click(object sender, EventArgs e)
- {
+ /// Cancel
+ private void cancelButton_Click(object sender, EventArgs e)
+ {
SaveUISettings();
- if ((flags & CfgUpdateFlags.AnyChange) != 0 || (flags & CfgUpdateFlags.RestartRqrd) != 0)
- {
- DialogResult dr = MessageBox.Show(Strings.Changes_will_be_lost_Do_you_want_to_proceed,
- Strings.Warning,
- MessageBoxButtons.YesNo,
- MessageBoxIcon.Question);
- if (dr != DialogResult.Yes) return;
- }
+ if ((flags & CfgUpdateFlags.AnyChange) != 0 || (flags & CfgUpdateFlags.RestartRqrd) != 0)
+ {
+ DialogResult dr = MessageBox.Show(Strings.Changes_will_be_lost_Do_you_want_to_proceed,
+ Strings.Warning,
+ MessageBoxButtons.YesNo,
+ MessageBoxIcon.Question);
+ if (dr != DialogResult.Yes) return;
+ }
- flags = CfgUpdateFlags.None; /// Abandoning changes confirmed
+ flags = CfgUpdateFlags.None; /// Abandoning changes confirmed
DialogResult = DialogResult.Cancel;
- Close();
- return;
- }
+ Close();
+ return;
+ }
- /// Add a new component
- private void addButton_Click(object sender, EventArgs e)
- {
- selectComponentTypeDlg.SelectedScriptName = null;
- DialogResult dialogRslt = selectComponentTypeDlg.ShowDialog();
- if (dialogRslt != DialogResult.OK) return;
+ /// Add a new component
+ private void addButton_Click(object sender, EventArgs e)
+ {
+ selectComponentTypeDlg.SelectedScriptName = null;
+ DialogResult dialogRslt = selectComponentTypeDlg.ShowDialog();
+ if (dialogRslt != DialogResult.OK) return;
- IComponentFactory factory = selectComponentTypeDlg.SlctdCmpntFactory;
+ IComponentFactory factory = selectComponentTypeDlg.SlctdCmpntFactory;
IComponentCfg cfg = factory.DefaultConfig();
if (selectComponentTypeDlg.SelectedScriptName == null)
- {
+ {
///
/// Create a single component of the selected type
///
IComponentCfgCtrl cfgControl = cfg.GetControl(cmpntEntities);
- cfgControl.Config = cfg;
-
- if (cfgControl == null || cfgControl.Config == null)
- {
- MessageBox.Show(
- string.Format("Default configuration is not available for this component type {0}",
- factory.ClassName),
- "BUG");
-
- return;
- }
-
- cfgControl.Config.ItemNr =
- (cmpntEntities.Count > 0) ? (cmpntEntities[cmpntEntities.Count - 1].ItemNr + 1) : 1;
+ cfgControl.Config = cfg;
+ cfgControl.Config.ItemNr = (cmpntEntities.Count > 0) ? (cmpntEntities[cmpntEntities.Count - 1].ItemNr + 1) : 1;
- ComponentParametersDlg cfgForm = new ComponentParametersDlg(this);
- cfgForm.CmpntEntities = cmpntEntities;
- cfgForm.ComponentCfgCtrl = cfgControl;
- cfgForm.UnlockAfterStart = true;
- dialogRslt = cfgForm.ShowDialog();
- if (dialogRslt != DialogResult.OK) return;
+ ComponentParametersDlg cfgForm = new ComponentParametersDlg(this);
+ cfgForm.CmpntEntities = cmpntEntities;
+ cfgForm.ComponentCfgCtrl = cfgControl;
+ cfgForm.UnlockAfterStart = true;
+ dialogRslt = cfgForm.ShowDialog();
+ if (dialogRslt != DialogResult.OK) return;
- flags |= CfgUpdateFlags.RestartRqrd;
- AddOne(cfgForm.Config.CreateDbEntity());
- }
- else
- {
+ flags |= CfgUpdateFlags.RestartRqrd;
+ AddOne(cfgForm.Config.CreateDbEntity());
+ }
+ else
+ {
///
/// Create more components, read their names and other properties from a file
///
using (TextReader reader = new StreamReader(selectComponentTypeDlg.SelectedScriptName))
- {
- int zeroBasedIdx = 0;
- string line = reader.ReadLine();
- while (line != null)
- {
- line.Trim();
+ {
+ int zeroBasedIdx = 0;
+ string line = reader.ReadLine();
+ while (line != null)
+ {
+ line.Trim();
if (line.Length > 0)
{
string[] words = line.Split(new char[] { ' ', '\t' });
@@ -541,85 +456,83 @@ namespace TBF.UI.Bench.Components
if (UpdateCfg(ref cfg, words, ref zeroBasedIdx))
{
flags |= CfgUpdateFlags.RestartRqrd;
- cfg.ItemNr = (cmpntEntities.Count > 0)
- ? (cmpntEntities[cmpntEntities.Count - 1].ItemNr + 1)
- : 1;
+ cfg.ItemNr = (cmpntEntities.Count > 0) ? (cmpntEntities[cmpntEntities.Count - 1].ItemNr + 1) : 1;
AddOne(cfg.CreateDbEntity());
}
-
+
zeroBasedIdx++;
}
- line = reader.ReadLine();
- }
- }
- }
- }
+ line = reader.ReadLine();
+ }
+ }
+ }
+ }
- void AddOne(Component cmpnt)
- {
- cmpntEntities.Add(cmpnt);
- DrawOne(cmpnt);
- }
+ void AddOne(Component cmpnt)
+ {
+ cmpntEntities.Add(cmpnt);
+ DrawOne(cmpnt);
+ }
- /// Delete the component
- private void removeButton_Click(object sender, EventArgs e)
- {
- if (listViewEx.SelectedIndices.Count != 1) return;
- int ix = listViewEx.SelectedIndices[0];
- if (ix < 0) return;
-
- Component selectedCmpnt = (Component)listViewEx.Items[ix].Tag;
+ /// Delete the component
+ private void removeButton_Click(object sender, EventArgs e)
+ {
+ if (listViewEx.SelectedIndices.Count != 1) return;
+ int ix = listViewEx.SelectedIndices[0];
+ if (ix < 0) return;
+
+ Component selectedCmpnt = (Component)listViewEx.Items[ix].Tag;
if (selectedCmpnt.Id != 0) toBeDeletedEntities.Add(selectedCmpnt);
cmpntEntities.Remove(selectedCmpnt);
flags |= CfgUpdateFlags.AnyChange;
- RedrawAll();
- }
+ RedrawAll();
+ }
- /// DoubleClick -> Edit the component
- private void listViewEx_MouseDoubleClick(object sender, MouseEventArgs e)
- {
- editButton_Click(sender, e);
- }
+ /// DoubleClick -> Edit the component
+ private void listViewEx_MouseDoubleClick(object sender, MouseEventArgs e)
+ {
+ editButton_Click(sender, e);
+ }
- /// Edit a component
- private void editButton_Click(object sender, EventArgs e)
- {
+ /// Edit a component
+ private void editButton_Click(object sender, EventArgs e)
+ {
if (listViewEx.SelectedIndices.Count != 1) return;
ListViewItem lvi = listViewEx.SelectedItems[0];
Component component = lvi.Tag as Component;
if (component == null) return;
- IComponentCfg cfg = TbfComponents.CmpntCfgFromCmpntEntity(component);
- if (cfg != null)
- {
+ IComponentCfg cfg = TbfComponents.CmpntCfgFromCmpntEntity(component);
+ if (cfg != null)
+ {
ComponentParametersDlg cfgForm = new ComponentParametersDlg(this, component.Id);
- cfgForm.CmpntEntities = cmpntEntities;
+ cfgForm.CmpntEntities = cmpntEntities;
cfgForm.ComponentCfgCtrl = cfg.GetControl(cmpntEntities);
- cfgForm.ComponentCfgCtrl.Config = cfg;
- DialogResult dr = cfgForm.ShowDialog();
- if (dr != DialogResult.OK) return;
+ cfgForm.ComponentCfgCtrl.Config = cfg;
+ DialogResult dr = cfgForm.ShowDialog();
+ if (dr != DialogResult.OK) return;
- flags |= cfgForm.Flags;
+ flags |= cfgForm.Flags;
- sharedButtons.UnlockButtons(); /// Unlock this dialog buttons as changes were enabled
- unlocked = true; /// in the ComponentParametersDlg.
+ sharedButtons.UnlockButtons(); /// Unlock this dialog buttons as changes were enabled
+ unlocked = true; /// in the ComponentParametersDlg.
- Component modified = cfgForm.Config.CreateDbEntity();
- Component original = (Component)lvi.Tag;
+ Component modified = cfgForm.Config.CreateDbEntity();
+ Component original = (Component)lvi.Tag;
- original.Name = modified.Name;
- original.ClassName = modified.ClassName;
- original.Parent = modified.Parent;
- original.DebugMode = modified.DebugMode;
- original.LogLevel = modified.LogLevel;
- original.Parameters = modified.Parameters;
+ original.Name = modified.Name;
+ original.ClassName = modified.ClassName;
+ original.Parent = modified.Parent;
+ original.DebugMode = modified.DebugMode;
+ original.LogLevel = modified.LogLevel;
+ original.Parameters = modified.Parameters;
- RedrawAll();
- }
- }
+ RedrawAll();
+ }
+ }
/// Copy a component
private void copyButton_Click(object sender, EventArgs e)
@@ -627,7 +540,7 @@ namespace TBF.UI.Bench.Components
if (listViewEx.SelectedIndices.Count != 1) return;
ListViewItem lvi = listViewEx.SelectedItems[0];
- IComponentCfg cfg = TbfComponents.CmpntCfgFromCmpntEntity((Component)lvi.Tag);
+ IComponentCfg cfg = TbfComponents.CmpntCfgFromCmpntEntity((Component)lvi.Tag);
if (cfg != null)
{
cfg.Name += Strings.New_name_copy;
@@ -635,9 +548,7 @@ namespace TBF.UI.Bench.Components
{
IComponentCfgCtrl cfgControl = cfg.GetControl(cmpntEntities);
cfgControl.Config = cfg;
- cfgControl.Config.ItemNr = (cmpntEntities.Count > 0)
- ? (cmpntEntities[cmpntEntities.Count - 1].ItemNr + 1)
- : 1;
+ cfgControl.Config.ItemNr = (cmpntEntities.Count > 0) ? (cmpntEntities[cmpntEntities.Count - 1].ItemNr + 1) : 1;
ComponentParametersDlg cfgForm = new ComponentParametersDlg(this);
cfgForm.CmpntEntities = cmpntEntities;
@@ -682,8 +593,7 @@ namespace TBF.UI.Bench.Components
IComponentCfgCtrl cfgControl = cfg.GetControl(cmpntEntities);
cfgControl.Config = cfg;
cfgControl.Config.Name = cfgControl.Config.Name + " imported";
- cfgControl.Config.ItemNr =
- (cmpntEntities.Count > 0) ? (cmpntEntities[cmpntEntities.Count - 1].ItemNr + 1) : 1;
+ cfgControl.Config.ItemNr = (cmpntEntities.Count > 0) ? (cmpntEntities[cmpntEntities.Count - 1].ItemNr + 1) : 1;
ComponentParametersDlg cfgForm = new ComponentParametersDlg(this);
cfgForm.CmpntEntities = cmpntEntities;
@@ -696,90 +606,88 @@ namespace TBF.UI.Bench.Components
}
}
- private void upButton_Click(object sender, EventArgs e)
- {
- if (listViewEx.SelectedIndices.Count != 1) return;
- int ix = listViewEx.SelectedIndices[0];
- if (ix < 1) return;
+ private void upButton_Click(object sender, EventArgs e)
+ {
+ if (listViewEx.SelectedIndices.Count != 1) return;
+ int ix = listViewEx.SelectedIndices[0];
+ if (ix < 1) return;
- Component item1 = (Component)(listViewEx.Items[ix - 1].Tag);
- Component item2 = (Component)(listViewEx.Items[ix].Tag);
- (item1 as IHasItemNr).ItemNr++;
- (item2 as IHasItemNr).ItemNr--;
- cmpntEntities.RemoveAt(ix);
- cmpntEntities.Insert(ix - 1, item2);
+ Component item1 = (Component)(listViewEx.Items[ix - 1].Tag);
+ Component item2 = (Component)(listViewEx.Items[ix].Tag);
+ (item1 as IHasItemNr).ItemNr++;
+ (item2 as IHasItemNr).ItemNr--;
+ cmpntEntities.RemoveAt(ix);
+ cmpntEntities.Insert(ix - 1, item2);
- flags |= CfgUpdateFlags.AnyChange;
+ flags |= CfgUpdateFlags.AnyChange;
- RedrawAll();
+ RedrawAll();
- Focus();
- listViewEx.Items[ix - 1].Selected = true;
- listViewEx.Items[ix - 1].EnsureVisible();
- }
+ Focus();
+ listViewEx.Items[ix - 1].Selected = true;
+ listViewEx.Items[ix - 1].EnsureVisible();
+ }
- private void downButton_Click(object sender, EventArgs e)
- {
- if (listViewEx.SelectedIndices.Count != 1) return;
- int ix = listViewEx.SelectedIndices[0];
- if (ix >= listViewEx.Items.Count - 1) return;
+ private void downButton_Click(object sender, EventArgs e)
+ {
+ if (listViewEx.SelectedIndices.Count != 1) return;
+ int ix = listViewEx.SelectedIndices[0];
+ if (ix >= listViewEx.Items.Count - 1) return;
- Component item1 = (Component)(listViewEx.Items[ix].Tag);
- Component item2 = (Component)(listViewEx.Items[ix + 1].Tag);
- (item1 as IHasItemNr).ItemNr++;
- (item2 as IHasItemNr).ItemNr--;
- cmpntEntities.RemoveAt(ix + 1);
- cmpntEntities.Insert(ix, item2);
+ Component item1 = (Component)(listViewEx.Items[ix].Tag);
+ Component item2 = (Component)(listViewEx.Items[ix + 1].Tag);
+ (item1 as IHasItemNr).ItemNr++;
+ (item2 as IHasItemNr).ItemNr--;
+ cmpntEntities.RemoveAt(ix + 1);
+ cmpntEntities.Insert(ix, item2);
- flags |= CfgUpdateFlags.AnyChange;
+ flags |= CfgUpdateFlags.AnyChange;
- RedrawAll();
+ RedrawAll();
- Focus();
- listViewEx.Items[ix + 1].Selected = true;
- listViewEx.Items[ix + 1].EnsureVisible();
- }
+ Focus();
+ listViewEx.Items[ix + 1].Selected = true;
+ listViewEx.Items[ix + 1].EnsureVisible();
+ }
- private void componentsListView_SelectedIndexChanged(object sender, EventArgs e)
- {
- if (listViewEx.SelectedIndices.Count == 1)
- {
- sharedButtons.EnableButtons(SharedButtons.Buttons.Remove | SharedButtons.Buttons.Edit);
- }
- else
- {
- sharedButtons.DisableButtons(SharedButtons.Buttons.Remove | SharedButtons.Buttons.Edit);
- }
- }
+ private void componentsListView_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ if (listViewEx.SelectedIndices.Count == 1)
+ {
+ sharedButtons.EnableButtons(SharedButtons.Buttons.Remove | SharedButtons.Buttons.Edit);
+ }
+ else
+ {
+ sharedButtons.DisableButtons(SharedButtons.Buttons.Remove | SharedButtons.Buttons.Edit);
+ }
+ }
- public void UpdateButtonStates(SharedButtons.SelectedItemPos selectedItemPos)
- {
- if (selectedItemPos == SharedButtons.SelectedItemPos.None)
- {
- sharedButtons.DisableButtons(SharedButtons.Buttons.Remove | SharedButtons.Buttons.Up |
- SharedButtons.Buttons.Down);
- }
- else if (selectedItemPos == SharedButtons.SelectedItemPos.First)
- {
- sharedButtons.EnableButtons(SharedButtons.Buttons.Remove | SharedButtons.Buttons.Down);
- sharedButtons.DisableButtons(SharedButtons.Buttons.Up);
- }
- else if (selectedItemPos == SharedButtons.SelectedItemPos.Last)
- {
- sharedButtons.EnableButtons(SharedButtons.Buttons.Remove | SharedButtons.Buttons.Up);
- sharedButtons.DisableButtons(SharedButtons.Buttons.Down);
- }
- else if (selectedItemPos == SharedButtons.SelectedItemPos.FirstAndLast)
- {
- sharedButtons.EnableButtons(SharedButtons.Buttons.Remove);
- sharedButtons.DisableButtons(SharedButtons.Buttons.Up | SharedButtons.Buttons.Down);
- }
- else
- {
- sharedButtons.EnableButtons(SharedButtons.Buttons.Remove | SharedButtons.Buttons.Up |
- SharedButtons.Buttons.Down);
- }
- }
+ public void UpdateButtonStates(SharedButtons.SelectedItemPos selectedItemPos)
+ {
+ if (selectedItemPos == SharedButtons.SelectedItemPos.None)
+ {
+ sharedButtons.DisableButtons(SharedButtons.Buttons.Remove | SharedButtons.Buttons.Up | SharedButtons.Buttons.Down);
+ }
+ else if (selectedItemPos == SharedButtons.SelectedItemPos.First)
+ {
+ sharedButtons.EnableButtons(SharedButtons.Buttons.Remove | SharedButtons.Buttons.Down);
+ sharedButtons.DisableButtons(SharedButtons.Buttons.Up);
+ }
+ else if (selectedItemPos == SharedButtons.SelectedItemPos.Last)
+ {
+ sharedButtons.EnableButtons(SharedButtons.Buttons.Remove | SharedButtons.Buttons.Up);
+ sharedButtons.DisableButtons(SharedButtons.Buttons.Down);
+ }
+ else if (selectedItemPos == SharedButtons.SelectedItemPos.FirstAndLast)
+ {
+ sharedButtons.EnableButtons(SharedButtons.Buttons.Remove);
+ sharedButtons.DisableButtons(SharedButtons.Buttons.Up | SharedButtons.Buttons.Down);
+ }
+ else
+ {
+ sharedButtons.EnableButtons(SharedButtons.Buttons.Remove | SharedButtons.Buttons.Up | SharedButtons.Buttons.Down);
+ }
+ }
private void ComponentsManagerDlg_FormClosing(object sender, FormClosingEventArgs e)
{
@@ -788,9 +696,9 @@ namespace TBF.UI.Bench.Components
if ((flags & CfgUpdateFlags.AnyChange) != 0 || (flags & CfgUpdateFlags.RestartRqrd) != 0)
{
DialogResult dr = MessageBox.Show(Strings.Do_you_want_to_save_changes,
- Strings.Warning,
- MessageBoxButtons.YesNo,
- MessageBoxIcon.Question);
+ Strings.Warning,
+ MessageBoxButtons.YesNo,
+ MessageBoxIcon.Question);
if (dr == DialogResult.Yes)
{
SaveDBChanges(session);
@@ -799,7 +707,7 @@ namespace TBF.UI.Bench.Components
if (CurrentUser.Restore(this)) Program.MainWnd.UpdateUser();
}
-
+
///
/// Updates component configuration from a script file
@@ -810,7 +718,7 @@ namespace TBF.UI.Bench.Components
/// true = udated component configuration should be saved, new component should be created
bool UpdateCfg(ref IComponentCfg cfg, string[] words, ref int zeroBasedIdx)
{
- string name = words[words.Length - 1]; /// The last word is the component name
+ string name = words[words.Length - 1]; /// The last word is the component name
cfg.Name = name.Replace("#", (zeroBasedIdx + 1).ToString());
if (cfg is Rig.BuiltIn.Valve.ValveCfg)
@@ -857,9 +765,9 @@ namespace TBF.UI.Bench.Components
}
else if (cfg is Rig.Modbus.Meret.AdjustableScale.AdjustableMeterCfg)
{
- (cfg as IChildComponentCfg).ParentName = "CB";
- (cfg as Rig.Modbus.Meret.AdjustableScale.AdjustableMeterCfg).ModbusAddress = (byte)(zeroBasedIdx + 1);
- return true;
+ (cfg as IChildComponentCfg).ParentName = "CB";
+ (cfg as Rig.Modbus.Meret.AdjustableScale.AdjustableMeterCfg).ModbusAddress = (byte)(zeroBasedIdx + 1);
+ return true;
}
else if (cfg is Rig.RegisterReaders.PulsesFromUniCB.RRCfg)
{
@@ -915,4 +823,4 @@ namespace TBF.UI.Bench.Components
listViewEx.Sort();
}
}
-}
\ No newline at end of file
+}
diff --git a/TBF/UI/Bench/Components/ComponentsManagerDlg.resx b/TBF/UI/Bench/Components/ComponentsManagerDlg.resx
index 431a86c09..5043490d2 100644
--- a/TBF/UI/Bench/Components/ComponentsManagerDlg.resx
+++ b/TBF/UI/Bench/Components/ComponentsManagerDlg.resx
@@ -118,19 +118,58 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
+
Fill
-
+
True
-
+
0, 0
-
- 4, 5, 4, 5
+
+ Horizontal
+
+
+ Fill
+
+
+ 0, 0
+
+
+ 777, 25
+
+
+ 0
+
+
+ sharedSearchForListView1
+
+
+ TBF.UI.Shared.SharedSearchForListView, TBF, Version=3.9.2148.1, Culture=neutral, PublicKeyToken=null
+
+
+ splitContainer1.Panel1
+
+
+ 0
+
+
+ splitContainer1.Panel1
+
+
+ System.Windows.Forms.SplitterPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ splitContainer1
+
+
+ 0
+
+
+ True
Fill
@@ -138,11 +177,8 @@
0, 0
-
- 4, 5, 4, 5
-
- 711, 532
+ 777, 317
7
@@ -154,11 +190,53 @@
Common.Forms.ListViewEx, Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
- splitContainer.Panel1
+ splitContainer1.Panel2
0
+
+ splitContainer1.Panel2
+
+
+ System.Windows.Forms.SplitterPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ splitContainer1
+
+
+ 1
+
+
+ 777, 346
+
+
+ 25
+
+
+ 8
+
+
+ splitContainer1
+
+
+ System.Windows.Forms.SplitContainer, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ splitContainer.Panel1
+
+
+ 0
+
+
+ Fill
+
+
+ True
+
+
+ 0, 0
+
splitContainer.Panel1
@@ -172,13 +250,13 @@
0
- 2, 0
+ 1, 0
- 6, 8, 6, 8
+ 4, 5, 4, 5
- 150, 802
+ 100, 521
0
@@ -187,7 +265,7 @@
sharedButtons
- TBF.UI.Shared.SharedButtons, TBF, Version=3.9.2140.0, Culture=neutral, PublicKeyToken=null
+ TBF.UI.Shared.SharedButtons, TBF, Version=3.9.2148.1, Culture=neutral, PublicKeyToken=null
splitContainer.Panel2
@@ -208,13 +286,10 @@
1
- 818, 532
+ 884, 346
- 711
-
-
- 6
+ 777
8
@@ -235,13 +310,10 @@
True
- 9, 20
+ 6, 13
- 818, 532
-
-
- 4, 5, 4, 5
+ 884, 346
CenterParent
diff --git a/TBF/UI/Bench/Components/SelectComponentClassDlg.Designer.cs b/TBF/UI/Bench/Components/SelectComponentClassDlg.Designer.cs
index 19284c768..5ea887977 100644
--- a/TBF/UI/Bench/Components/SelectComponentClassDlg.Designer.cs
+++ b/TBF/UI/Bench/Components/SelectComponentClassDlg.Designer.cs
@@ -31,61 +31,69 @@ namespace TBF.UI.Bench.Components
///
private void InitializeComponent()
{
- System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SelectComponentClassDlg));
- this.availCmpntsLstBox = new System.Windows.Forms.ListBox();
- this.availableComponentsLabel = new System.Windows.Forms.Label();
- this.cancelButton = new System.Windows.Forms.Button();
- this.okButton = new System.Windows.Forms.Button();
- this.SuspendLayout();
- //
- // availCmpntsLstBox
- //
- this.availCmpntsLstBox.FormattingEnabled = true;
- resources.ApplyResources(this.availCmpntsLstBox, "availCmpntsLstBox");
- this.availCmpntsLstBox.Name = "availCmpntsLstBox";
- this.availCmpntsLstBox.DoubleClick += new System.EventHandler(this.availCmpntsLstBox_DoubleClick);
- this.availCmpntsLstBox.MouseUp += new System.Windows.Forms.MouseEventHandler(this.availCmpntsLstBox_MouseUp);
- //
- // availableComponentsLabel
- //
- resources.ApplyResources(this.availableComponentsLabel, "availableComponentsLabel");
- this.availableComponentsLabel.ImageKey = global::TBF.Resources.Strings.Closing_the_tank;
- this.availableComponentsLabel.Name = "availableComponentsLabel";
- //
- // cancelButton
- //
- this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
- this.cancelButton.ImageKey = global::TBF.Resources.Strings.Closing_the_tank;
- resources.ApplyResources(this.cancelButton, "cancelButton");
- this.cancelButton.Name = "cancelButton";
- this.cancelButton.UseVisualStyleBackColor = true;
- this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
- //
- // okButton
- //
- this.okButton.ImageKey = global::TBF.Resources.Strings.Closing_the_tank;
- resources.ApplyResources(this.okButton, "okButton");
- this.okButton.Name = "okButton";
- this.okButton.UseVisualStyleBackColor = true;
- this.okButton.Click += new System.EventHandler(this.okButton_Click);
- //
- // SelectComponentClassDlg
- //
- this.AcceptButton = this.okButton;
- resources.ApplyResources(this, "$this");
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.CancelButton = this.cancelButton;
- this.Controls.Add(this.cancelButton);
- this.Controls.Add(this.okButton);
- this.Controls.Add(this.availableComponentsLabel);
- this.Controls.Add(this.availCmpntsLstBox);
- this.MaximizeBox = false;
- this.MinimizeBox = false;
- this.Name = "SelectComponentClassDlg";
- this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
- this.Load += new System.EventHandler(this.SelectComponentClassDlg_Load);
- this.ResumeLayout(false);
- this.PerformLayout();
+ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SelectComponentClassDlg));
+ this.availCmpntsLstBox = new System.Windows.Forms.ListBox();
+ this.availableComponentsLabel = new System.Windows.Forms.Label();
+ this.cancelButton = new System.Windows.Forms.Button();
+ this.okButton = new System.Windows.Forms.Button();
+ this.sharedSearchForListBox1 = new TBF.UI.Shared.SharedSearchForListBox();
+ this.SuspendLayout();
+ //
+ // availCmpntsLstBox
+ //
+ resources.ApplyResources(this.availCmpntsLstBox, "availCmpntsLstBox");
+ this.availCmpntsLstBox.FormattingEnabled = true;
+ this.availCmpntsLstBox.Name = "availCmpntsLstBox";
+ this.availCmpntsLstBox.DoubleClick += new System.EventHandler(this.availCmpntsLstBox_DoubleClick);
+ this.availCmpntsLstBox.MouseUp += new System.Windows.Forms.MouseEventHandler(this.availCmpntsLstBox_MouseUp);
+ //
+ // availableComponentsLabel
+ //
+ resources.ApplyResources(this.availableComponentsLabel, "availableComponentsLabel");
+ this.availableComponentsLabel.ImageKey = global::TBF.Resources.Strings.Closing_the_tank;
+ this.availableComponentsLabel.Name = "availableComponentsLabel";
+ //
+ // cancelButton
+ //
+ resources.ApplyResources(this.cancelButton, "cancelButton");
+ this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
+ this.cancelButton.ImageKey = global::TBF.Resources.Strings.Closing_the_tank;
+ this.cancelButton.Name = "cancelButton";
+ this.cancelButton.UseVisualStyleBackColor = true;
+ this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
+ //
+ // okButton
+ //
+ resources.ApplyResources(this.okButton, "okButton");
+ this.okButton.ImageKey = global::TBF.Resources.Strings.Closing_the_tank;
+ this.okButton.Name = "okButton";
+ this.okButton.UseVisualStyleBackColor = true;
+ this.okButton.Click += new System.EventHandler(this.okButton_Click);
+ //
+ // sharedSearchForListBox1
+ //
+ this.sharedSearchForListBox1.ListBoxEx = null;
+ resources.ApplyResources(this.sharedSearchForListBox1, "sharedSearchForListBox1");
+ this.sharedSearchForListBox1.Name = "sharedSearchForListBox1";
+ //
+ // SelectComponentClassDlg
+ //
+ this.AcceptButton = this.okButton;
+ resources.ApplyResources(this, "$this");
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.CancelButton = this.cancelButton;
+ this.Controls.Add(this.sharedSearchForListBox1);
+ this.Controls.Add(this.cancelButton);
+ this.Controls.Add(this.okButton);
+ this.Controls.Add(this.availableComponentsLabel);
+ this.Controls.Add(this.availCmpntsLstBox);
+ this.MaximizeBox = false;
+ this.MinimizeBox = false;
+ this.Name = "SelectComponentClassDlg";
+ this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
+ this.Load += new System.EventHandler(this.SelectComponentClassDlg_Load);
+ this.ResumeLayout(false);
+ this.PerformLayout();
}
@@ -95,5 +103,6 @@ namespace TBF.UI.Bench.Components
private System.Windows.Forms.Label availableComponentsLabel;
private System.Windows.Forms.Button cancelButton;
private System.Windows.Forms.Button okButton;
- }
+ private Shared.SharedSearchForListBox sharedSearchForListBox1;
+ }
}
\ No newline at end of file
diff --git a/TBF/UI/Bench/Components/SelectComponentClassDlg.cs b/TBF/UI/Bench/Components/SelectComponentClassDlg.cs
index 7c5d42552..09099d748 100644
--- a/TBF/UI/Bench/Components/SelectComponentClassDlg.cs
+++ b/TBF/UI/Bench/Components/SelectComponentClassDlg.cs
@@ -1,10 +1,12 @@
-///
+using Common.Forms;
+///
/// Copyright (c) 2013-2015 Sensus Slovensko a.s.
///
using System;
using System.Windows.Forms;
-using TBF.Rig.Generic;
using TBF.Resources;
+using TBF.Rig.Generic;
+using TBF.UI.Shared;
namespace TBF.UI.Bench.Components
{
@@ -22,6 +24,10 @@ namespace TBF.UI.Bench.Components
{
InitializeComponent();
+ /// SharedDlgSearchForListBox configuration
+ sharedSearchForListBox1.ParentForm = this;
+ sharedSearchForListBox1.ListBoxEx = availCmpntsLstBox;
+
classNamePrefix = (prefix != null) ? prefix : string.Empty;
foreach (var componentFactory in Rig.TbfComponents.Factories)
{
diff --git a/TBF/UI/Bench/Components/SelectComponentClassDlg.resx b/TBF/UI/Bench/Components/SelectComponentClassDlg.resx
index a3c7f5829..b342a1b9f 100644
--- a/TBF/UI/Bench/Components/SelectComponentClassDlg.resx
+++ b/TBF/UI/Bench/Components/SelectComponentClassDlg.resx
@@ -117,12 +117,16 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ Top, Bottom, Left, Right
+
- 12, 34
+ 12, 73
- 288, 264
+ 510, 238
@@ -138,13 +142,16 @@
$this
- 3
+ 4
True
+
+ NoControl
+
- 9, 9
+ 12, 46
115, 13
@@ -165,10 +172,16 @@
$this
- 2
+ 3
+
+
+ Bottom, Right
+
+
+ NoControl
- 200, 310
+ 423, 324
99, 25
@@ -189,10 +202,16 @@
$this
- 0
+ 1
+
+
+ Bottom, Right
+
+
+ NoControl
- 95, 310
+ 318, 324
99, 25
@@ -213,7 +232,28 @@
$this
- 1
+ 2
+
+
+ 12, 1
+
+
+ 510, 42
+
+
+ 9
+
+
+ sharedSearchForListBox1
+
+
+ TBF.UI.Shared.SharedSearchForListBox, TBF, Version=3.9.2148.1, Culture=neutral, PublicKeyToken=null
+
+
+ $this
+
+
+ 0
True
@@ -222,9 +262,11 @@
6, 13
- 311, 347
+ 534, 368
+
+
+ NoControl
-
CenterParent
diff --git a/TBF/UI/Procedures/ProceduresCtrl.Designer.cs b/TBF/UI/Procedures/ProceduresCtrl.Designer.cs
index ea2dfbba4..01e2916fe 100644
--- a/TBF/UI/Procedures/ProceduresCtrl.Designer.cs
+++ b/TBF/UI/Procedures/ProceduresCtrl.Designer.cs
@@ -29,6 +29,8 @@
private void InitializeComponent()
{
this.filtersSplitContainer = new System.Windows.Forms.SplitContainer();
+ this.profileLabel = new System.Windows.Forms.Label();
+ this.profileComboBox = new System.Windows.Forms.ComboBox();
this.producerLabel = new System.Windows.Forms.Label();
this.mclassLabel = new System.Windows.Forms.Label();
this.q3Label = new System.Windows.Forms.Label();
@@ -38,8 +40,7 @@
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();
+ this.sharedSearchForListView1 = new TBF.UI.Shared.SharedSearchForListView();
((System.ComponentModel.ISupportInitialize)(this.filtersSplitContainer)).BeginInit();
this.filtersSplitContainer.Panel1.SuspendLayout();
this.filtersSplitContainer.Panel2.SuspendLayout();
@@ -56,6 +57,7 @@
//
// filtersSplitContainer.Panel1
//
+ this.filtersSplitContainer.Panel1.Controls.Add(this.sharedSearchForListView1);
this.filtersSplitContainer.Panel1.Controls.Add(this.profileLabel);
this.filtersSplitContainer.Panel1.Controls.Add(this.profileComboBox);
this.filtersSplitContainer.Panel1.Controls.Add(this.producerLabel);
@@ -71,9 +73,28 @@
//
this.filtersSplitContainer.Panel2.Controls.Add(this.listViewEx);
this.filtersSplitContainer.Size = new System.Drawing.Size(800, 400);
- this.filtersSplitContainer.SplitterDistance = 40;
+ this.filtersSplitContainer.SplitterDistance = 80;
this.filtersSplitContainer.TabIndex = 2;
//
+ // 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);
+ //
// producerLabel
//
this.producerLabel.AutoSize = true;
@@ -157,9 +178,10 @@
this.listViewEx.DoubleClickActivation = false;
this.listViewEx.FullRowSelect = true;
this.listViewEx.GridLines = true;
+ this.listViewEx.HideSelection = false;
this.listViewEx.Location = new System.Drawing.Point(0, 0);
this.listViewEx.Name = "listViewEx";
- this.listViewEx.Size = new System.Drawing.Size(800, 356);
+ this.listViewEx.Size = new System.Drawing.Size(800, 316);
this.listViewEx.TabIndex = 0;
this.listViewEx.UseCompatibleStateImageBehavior = false;
this.listViewEx.View = System.Windows.Forms.View.Details;
@@ -167,24 +189,13 @@
this.listViewEx.SelectedIndexChanged += new System.EventHandler(this.listViewEx_SelectedIndexChanged);
this.listViewEx.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.listViewEx_MouseDoubleClick);
//
- // profileLabel
+ // sharedSearchForListView1
//
- 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);
+ this.sharedSearchForListView1.ListViewEx = null;
+ this.sharedSearchForListView1.Location = new System.Drawing.Point(0, 35);
+ this.sharedSearchForListView1.Name = "sharedSearchForListView1";
+ this.sharedSearchForListView1.Size = new System.Drawing.Size(736, 42);
+ this.sharedSearchForListView1.TabIndex = 10;
//
// ProceduresCtrl
//
@@ -216,5 +227,6 @@
private Common.Forms.ListViewEx listViewEx;
private System.Windows.Forms.Label profileLabel;
private System.Windows.Forms.ComboBox profileComboBox;
+ private Shared.SharedSearchForListView sharedSearchForListView1;
}
}
diff --git a/TBF/UI/Procedures/ProceduresCtrl.cs b/TBF/UI/Procedures/ProceduresCtrl.cs
index 4fa56f2ad..c40e1d663 100644
--- a/TBF/UI/Procedures/ProceduresCtrl.cs
+++ b/TBF/UI/Procedures/ProceduresCtrl.cs
@@ -77,6 +77,11 @@ namespace TBF.UI.Procedures
errorFlagsCmpnt = null;
ToBeRemovedProcedures = new List();
+ /// SharedDlgSearchForListView configuration
+ //sharedSearchForListView1.OwnerForm = this;
+ sharedSearchForListView1.ListViewEx = listViewEx;
+ sharedSearchForListView1.nrLabel.Text = "Procedure nr.";
+
/// Profile
selectedProfile = null;
ComboBox cb = profileComboBox;
diff --git a/TBF/UI/Shared/SharedSearchForListBox.cs b/TBF/UI/Shared/SharedSearchForListBox.cs
new file mode 100644
index 000000000..197b2d42d
--- /dev/null
+++ b/TBF/UI/Shared/SharedSearchForListBox.cs
@@ -0,0 +1,311 @@
+using Common;
+///
+/// Copyright (c) 2013-2015 Senus Slovensko a.s.
+///
+using System;
+using System.Windows.Forms;
+using TBF.Resources;
+
+namespace TBF.UI.Shared
+{
+ public partial class SharedSearchForListBox : UserControl
+ {
+
+ private System.Windows.Forms.ListBox listBoxEx;
+
+ public System.Windows.Forms.ListBox ListBoxEx
+ {
+ get { return listBoxEx; }
+ set { listBoxEx = value; }
+ }
+
+ ///
+ /// Masks to specify the enabled state and the visibility of buttons.
+ /// Unlock button is hard coded in this control, cannot be set from the parent.
+ ///
+ public enum Buttons
+ {
+ None = 0,
+ Find = (1 << 0), /// optional
+ FindNext = (1 << 1), /// optional
+ FindBack = (1 << 2), /// optional
+ JumpToTop = (1 << 3), /// optional
+ JumpToBottom = (1 << 4), /// optional
+ }
+
+ readonly System.Windows.Forms.Button[] buttonCtrls;
+
+ ///
+ /// Optional buttons are Add, Remove, Up, Down, Edit and Copy.
+ /// OK and Cancel buttons are always visible (after unlock), but not always enabled.
+ ///
+ public Buttons OptionalButtons;
+
+ public enum LState
+ {
+ Locked, /// 'Unlock', 'Close' (=OK) are shown, all the othere are hidden
+ Unlocked, /// Unlock, Ok, Cancel, Add,Remove and all optional buttons are shown
+ }
+ LState lockState;
+ public LState LockState { get { return lockState; } }
+
+ bool buttonsRepositionsed;
+
+ public bool MoreActive;
+ public int MoreButtonTop;
+
+ ///
+ /// Used by controls to indicate which item is selected
+ /// and to appropriately update Remove, Up and Down Buttons.
+ ///
+ public enum SelectedItemPos
+ {
+ None,
+ First,
+ Last,
+ FirstAndLast,
+ Middle,
+ }
+
+ public Form ParentForm; /// Used as a current form reference when changing and restoring a user
+
+ public GID[] RequiredGroupMembership;
+
+ ///
+ /// Default constructor
+ ///
+ public SharedSearchForListBox()
+ {
+ InitializeComponent();
+ lockState = LState.Locked;
+ MoreActive = false;
+ RequiredGroupMembership = null;
+ buttonCtrls = new System.Windows.Forms.Button[]
+ {
+ findButton, findNextButton, findBackButton,
+ jumpToTopButton, jumpToBottomButton,
+ };
+ OptionalButtons = Buttons.None;
+ buttonsRepositionsed = false;
+ }
+
+ void ShowOrHideButtons(Buttons selectedButtons, bool value)
+ {
+ for (int i = 0; i < buttonCtrls.Length; i++)
+ {
+ if ((selectedButtons & (Buttons)(1 << i)) != 0) buttonCtrls[i].Visible = value;
+ }
+ }
+
+ public void EnableOrDisableButtons(Buttons selectedButtons, bool value)
+ {
+ for (int i = 0; i < buttonCtrls.Length; i++)
+ {
+ if ((selectedButtons & (Buttons)(1 << i)) != 0) buttonCtrls[i].Enabled = value;
+ }
+ }
+
+ ///
+ /// Initialize the buttons when the dialog is loaded
+ ///
+ ///
+ ///
+ private void SharedDlgSearchForListBox_Load(object sender, EventArgs e)
+ {
+ searchLabel.Text = "Search";
+ findButton.Text = "Find";
+ jumpToBottomButton.Text = "Jump down";
+ jumpToTopButton.Text = "Jump up";
+
+ ShowOrHideButtons((Buttons)0x1F, true);
+ }
+
+ // Stores the last search text
+ private string _lastSearchText = string.Empty;
+
+ // Stores the index of the last found item in the ListView
+ private int _lastFoundIndex = -1;
+
+ private void findButton_Click(object sender, EventArgs e)
+ {
+ string search = searchTextBox.Text.Trim();
+ if (string.IsNullOrEmpty(search))
+ return;
+
+ _lastSearchText = search;
+ _lastFoundIndex = -1;
+
+ int index = FindItemIndex(search, 0, +1);
+ if (index == -1)
+ {
+ MessageBox.Show("No results found.");
+ return;
+ }
+
+ _lastFoundIndex = index;
+ SelectItemAtIndex(index);
+ }
+
+ ///
+ /// Finds an item in the ListView starting from given index and direction.
+ ///
+ /// Search text (lowercase).
+ /// Index to start from.
+ /// +1 = forward, -1 = backward.
+ /// Index of found item or -1 if not found.
+ private int FindItemIndex(string search, int startIndex, int direction)
+ {
+ // No items
+ if (listBoxEx.Items.Count == 0)
+ return -1;
+
+ // Clamp bounds
+ if (startIndex < 0)
+ startIndex = 0;
+ if (startIndex >= listBoxEx.Items.Count)
+ startIndex = listBoxEx.Items.Count - 1;
+
+ search = search.ToLower();
+
+ // Forward search
+ if (direction > 0)
+ {
+ for (int i = startIndex; i < listBoxEx.Items.Count; i++)
+ {
+ string text = listBoxEx.Items[i].ToString().ToLower();
+ if (text.Contains(search))
+ return i;
+ }
+ }
+ else // Backward search
+ {
+ for (int i = startIndex; i >= 0; i--)
+ {
+ string text = listBoxEx.Items[i].ToString().ToLower();
+ if (text.Contains(search))
+ return i;
+ }
+ }
+
+ return -1;
+ }
+
+ ///
+ /// Selects and scrolls to the item at given index.
+ ///
+ private void SelectItemAtIndex(int index)
+ {
+ if (index < 0 || index >= listBoxEx.Items.Count)
+ return;
+
+ listBoxEx.SelectedIndex = index; // selects item
+ listBoxEx.TopIndex = index; // scrolls to item
+ listBoxEx.Focus(); // ensures highlight is visible
+ }
+
+ private void findNextButton_Click(object sender, EventArgs e)
+ {
+ string search = searchTextBox.Text.Trim();
+ if (string.IsNullOrEmpty(search))
+ return;
+
+ if (search != _lastSearchText)
+ {
+ _lastSearchText = search;
+ _lastFoundIndex = -1;
+ }
+
+ int index = FindItemIndex(search, _lastFoundIndex + 1, +1);
+ if (index == -1)
+ {
+ MessageBox.Show("No more results.");
+ return;
+ }
+
+ _lastFoundIndex = index;
+ SelectItemAtIndex(index);
+ }
+
+ private void findBackButton_Click(object sender, EventArgs e)
+ {
+ string search = searchTextBox.Text.Trim();
+ if (string.IsNullOrEmpty(search))
+ return;
+
+ if (search != _lastSearchText)
+ {
+ _lastSearchText = search;
+ _lastFoundIndex = listBoxEx.Items.Count;
+ }
+
+ int index = FindItemIndex(search, _lastFoundIndex - 1, -1);
+ if (index == -1)
+ {
+ MessageBox.Show("No more results.");
+ return;
+ }
+
+ _lastFoundIndex = index;
+ SelectItemAtIndex(index);
+ }
+
+ private void jumpToBottomButton_Click(object sender, EventArgs e)
+ {
+ // Scroll to the bottom without selecting any item
+ if (listBoxEx.Items.Count == 0)
+ return;
+
+ listBoxEx.TopIndex = listBoxEx.Items.Count - 1; // last item index
+ }
+
+ private void jumpToTopButton_Click(object sender, EventArgs e)
+ {
+ // Scroll to the top without selecting any item
+ if (listBoxEx.Items.Count == 0)
+ return;
+
+ listBoxEx.TopIndex = 0; // first item index
+ }
+
+ private void searchTextBox_Enter(object sender, EventArgs e)
+ {
+ // When Search textbox has focus, Enter will trigger Find button
+ var form = this.FindForm();
+ if (form != null)
+ form.AcceptButton = findButton;
+ }
+ }
+
+ /*///
+ /// Events invoked when buttons are clicked (and in case of Unlock kbutton also accepted)
+ ///
+ public event EventHandler Unlocked;
+ public event EventHandler GoClicked;
+ public event EventHandler FindClicked;
+ public event EventHandler FindNextClicked;
+ public event EventHandler FindBackClicked;
+ public event EventHandler JumpToTopClicked;
+ public event EventHandler JumpToBottomClicked;
+
+ ///
+ /// All remaining handlers:
+ ///
+ private void cancelBtn_Click(object s, EventArgs e) { if (CancelClicked != null) CancelClicked(s, e); }
+ private void addBtn_Click(object s, EventArgs e) { if (AddClicked != null) AddClicked(s, e); }
+ private void removeBtn_Click(object s, EventArgs e) { if (RemoveClicked != null) RemoveClicked(s, e); }
+ private void upBtn_Click(object s, EventArgs e) { if (UpClicked != null) UpClicked(s, e); }
+ private void downBtn_Click(object s, EventArgs e) { if (DownClicked != null) DownClicked(s, e); }
+ private void editBtn_Click(object s, EventArgs e) { if (EditClicked != null) EditClicked(s, e); }
+ private void copyBtn_Click(object s, EventArgs e) { if (CopyClicked != null) CopyClicked(s, e); }
+ private void exportButton_Click(object s, EventArgs e) { if (ExportClicked != null) ExportClicked(s, e); }
+ private void importButton_Click(object s, EventArgs e) { if (ImportClicked != null) ImportClicked(s, e); }
+ private void compareButton_Click(object s, EventArgs e) { if (CompareClicked != null) CompareClicked(s, e); }
+ private void newTabButton_Click(object s, EventArgs e) { if (NewTabClicked != null) NewTabClicked(s, e); }
+ private void renameTabButton_Click(object s, EventArgs e) { if (RenameTabClicked != null) RenameTabClicked(s, e); }
+ private void removeTabButton_Click(object s, EventArgs e) { if (RemoveTabClicked != null) RemoveTabClicked(s, e); }
+ private void customButton1_Click(object s, EventArgs e) { if (Custom1Clicked != null) Custom1Clicked(s, e); }
+ private void customButton2_Click(object s, EventArgs e) { if (Custom2Clicked != null) Custom2Clicked(s, e); }
+ private void customButton3_Click(object s, EventArgs e) { if (Custom3Clicked != null) Custom3Clicked(s, e); }
+
+ */
+}
diff --git a/TBF/UI/Shared/SharedSearchForListBox.designer.cs b/TBF/UI/Shared/SharedSearchForListBox.designer.cs
new file mode 100644
index 000000000..b5ba1a11c
--- /dev/null
+++ b/TBF/UI/Shared/SharedSearchForListBox.designer.cs
@@ -0,0 +1,147 @@
+///
+/// Copyright (c) 2013-2015 Senus Slovensko a.s.
+///
+namespace TBF.UI.Shared
+{
+ partial class SharedSearchForListBox
+ {
+ ///
+ /// 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 Component Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.findNextButton = new System.Windows.Forms.Button();
+ this.findButton = new System.Windows.Forms.Button();
+ this.findBackButton = new System.Windows.Forms.Button();
+ this.jumpToTopButton = new System.Windows.Forms.Button();
+ this.jumpToBottomButton = new System.Windows.Forms.Button();
+ this.searchLabel = new System.Windows.Forms.Label();
+ this.searchTextBox = new System.Windows.Forms.TextBox();
+ this.SuspendLayout();
+ //
+ // findNextButton
+ //
+ this.findNextButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold);
+ this.findNextButton.ImeMode = System.Windows.Forms.ImeMode.NoControl;
+ this.findNextButton.Location = new System.Drawing.Point(274, 10);
+ this.findNextButton.Name = "findNextButton";
+ this.findNextButton.Size = new System.Drawing.Size(23, 23);
+ this.findNextButton.TabIndex = 39;
+ this.findNextButton.Text = "↓";
+ this.findNextButton.UseVisualStyleBackColor = true;
+ this.findNextButton.Click += new System.EventHandler(this.findNextButton_Click);
+ //
+ // findButton
+ //
+ this.findButton.ImeMode = System.Windows.Forms.ImeMode.NoControl;
+ this.findButton.Location = new System.Drawing.Point(228, 10);
+ this.findButton.Name = "findButton";
+ this.findButton.Size = new System.Drawing.Size(46, 23);
+ this.findButton.TabIndex = 35;
+ this.findButton.Text = "find";
+ this.findButton.UseVisualStyleBackColor = true;
+ this.findButton.Click += new System.EventHandler(this.findButton_Click);
+ //
+ // findBackButton
+ //
+ this.findBackButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold);
+ this.findBackButton.ImeMode = System.Windows.Forms.ImeMode.NoControl;
+ this.findBackButton.Location = new System.Drawing.Point(297, 10);
+ this.findBackButton.Name = "findBackButton";
+ this.findBackButton.Size = new System.Drawing.Size(23, 23);
+ this.findBackButton.TabIndex = 38;
+ this.findBackButton.Tag = "aa";
+ this.findBackButton.Text = "↑";
+ this.findBackButton.UseVisualStyleBackColor = true;
+ this.findBackButton.Click += new System.EventHandler(this.findBackButton_Click);
+ //
+ // jumpToTopButton
+ //
+ this.jumpToTopButton.ImeMode = System.Windows.Forms.ImeMode.NoControl;
+ this.jumpToTopButton.Location = new System.Drawing.Point(326, 10);
+ this.jumpToTopButton.Name = "jumpToTopButton";
+ this.jumpToTopButton.Size = new System.Drawing.Size(65, 23);
+ this.jumpToTopButton.TabIndex = 37;
+ this.jumpToTopButton.Text = "jump up";
+ this.jumpToTopButton.UseVisualStyleBackColor = true;
+ this.jumpToTopButton.Click += new System.EventHandler(this.jumpToTopButton_Click);
+ //
+ // jumpToBottomButton
+ //
+ this.jumpToBottomButton.ImeMode = System.Windows.Forms.ImeMode.NoControl;
+ this.jumpToBottomButton.Location = new System.Drawing.Point(390, 10);
+ this.jumpToBottomButton.Name = "jumpToBottomButton";
+ this.jumpToBottomButton.Size = new System.Drawing.Size(75, 23);
+ this.jumpToBottomButton.TabIndex = 36;
+ this.jumpToBottomButton.Text = "jump down";
+ this.jumpToBottomButton.UseVisualStyleBackColor = true;
+ this.jumpToBottomButton.Click += new System.EventHandler(this.jumpToBottomButton_Click);
+ //
+ // searchLabel
+ //
+ this.searchLabel.AutoSize = true;
+ this.searchLabel.ImeMode = System.Windows.Forms.ImeMode.NoControl;
+ this.searchLabel.Location = new System.Drawing.Point(6, 15);
+ this.searchLabel.Name = "searchLabel";
+ this.searchLabel.Size = new System.Drawing.Size(41, 13);
+ this.searchLabel.TabIndex = 32;
+ this.searchLabel.Text = "Search";
+ //
+ // searchTextBox
+ //
+ this.searchTextBox.Location = new System.Drawing.Point(53, 12);
+ this.searchTextBox.Name = "searchTextBox";
+ this.searchTextBox.Size = new System.Drawing.Size(169, 20);
+ this.searchTextBox.TabIndex = 33;
+ //
+ // SharedSearchForListBox
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.findNextButton);
+ this.Controls.Add(this.findButton);
+ this.Controls.Add(this.findBackButton);
+ this.Controls.Add(this.jumpToTopButton);
+ this.Controls.Add(this.jumpToBottomButton);
+ this.Controls.Add(this.searchLabel);
+ this.Controls.Add(this.searchTextBox);
+ this.Name = "SharedSearchForListBox";
+ this.Size = new System.Drawing.Size(472, 42);
+ this.Load += new System.EventHandler(this.SharedDlgSearchForListBox_Load);
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Button findNextButton;
+ private System.Windows.Forms.Button findButton;
+ private System.Windows.Forms.Button findBackButton;
+ private System.Windows.Forms.Button jumpToTopButton;
+ private System.Windows.Forms.Button jumpToBottomButton;
+ private System.Windows.Forms.Label searchLabel;
+ private System.Windows.Forms.TextBox searchTextBox;
+ }
+}
diff --git a/TBF/UI/Shared/SharedSearchForListBox.resx b/TBF/UI/Shared/SharedSearchForListBox.resx
new file mode 100644
index 000000000..1af7de150
--- /dev/null
+++ b/TBF/UI/Shared/SharedSearchForListBox.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/TBF/UI/Shared/SharedSearchForListView.cs b/TBF/UI/Shared/SharedSearchForListView.cs
new file mode 100644
index 000000000..3efc65f25
--- /dev/null
+++ b/TBF/UI/Shared/SharedSearchForListView.cs
@@ -0,0 +1,401 @@
+using Common;
+///
+/// Copyright (c) 2013-2015 Senus Slovensko a.s.
+///
+using System;
+using System.Windows.Forms;
+using TBF.Resources;
+using static System.Windows.Forms.VisualStyles.VisualStyleElement;
+
+namespace TBF.UI.Shared
+{
+ public partial class SharedSearchForListView : UserControl
+ {
+
+ private Common.Forms.ListViewEx listViewEx;
+
+ public Common.Forms.ListViewEx ListViewEx
+ {
+ get { return listViewEx; }
+ set { listViewEx = value; }
+ }
+
+ ///
+ /// Masks to specify the enabled state and the visibility of buttons.
+ /// Unlock button is hard coded in this control, cannot be set from the parent.
+ ///
+ public enum Buttons
+ {
+ None = 0,
+ Go = (1 << 0), /// optional
+ Find = (1 << 1), /// optional
+ FindNext = (1 << 2), /// optional
+ FindBack = (1 << 3), /// optional
+ JumpToTop = (1 << 4), /// optional
+ JumpToBottom = (1 << 5), /// optional
+ }
+
+ readonly System.Windows.Forms.Button[] buttonCtrls;
+
+ ///
+ /// Optional buttons are Add, Remove, Up, Down, Edit and Copy.
+ /// OK and Cancel buttons are always visible (after unlock), but not always enabled.
+ ///
+ public Buttons OptionalButtons;
+
+ public enum LState
+ {
+ Locked, /// 'Unlock', 'Close' (=OK) are shown, all the othere are hidden
+ Unlocked, /// Unlock, Ok, Cancel, Add,Remove and all optional buttons are shown
+ }
+ LState lockState;
+ public LState LockState { get { return lockState; } }
+
+ bool buttonsRepositionsed;
+
+ public bool MoreActive;
+ public int MoreButtonTop;
+
+ ///
+ /// Used by controls to indicate which item is selected
+ /// and to appropriately update Remove, Up and Down Buttons.
+ ///
+ public enum SelectedItemPos
+ {
+ None,
+ First,
+ Last,
+ FirstAndLast,
+ Middle,
+ }
+
+ public Form OwnerForm; /// Used as a current form reference when changing and restoring a user
+
+ public GID[] RequiredGroupMembership;
+
+ ///
+ /// Default constructor
+ ///
+ public SharedSearchForListView()
+ {
+ InitializeComponent();
+ lockState = LState.Locked;
+ MoreActive = false;
+ RequiredGroupMembership = null;
+ buttonCtrls = new System.Windows.Forms.Button[]
+ {
+ findButton, findNextButton, findBackButton,
+ goButton,
+ jumpToTopButton, jumpToBottomButton,
+ };
+ OptionalButtons = Buttons.None;
+ buttonsRepositionsed = false;
+ }
+
+ void ShowOrHideButtons(Buttons selectedButtons, bool value)
+ {
+ for (int i = 0; i < buttonCtrls.Length; i++)
+ {
+ if ((selectedButtons & (Buttons)(1 << i)) != 0) buttonCtrls[i].Visible = value;
+ }
+ }
+
+ public void EnableOrDisableButtons(Buttons selectedButtons, bool value)
+ {
+ for (int i = 0; i < buttonCtrls.Length; i++)
+ {
+ if ((selectedButtons & (Buttons)(1 << i)) != 0) buttonCtrls[i].Enabled = value;
+ }
+ }
+
+ ///
+ /// Initialize the buttons when the dialog is loaded
+ ///
+ ///
+ ///
+ private void SharedDlgSearchForListView_Load(object sender, EventArgs e)
+ {
+ //Label.Text = "nr.";//Strings.UnlockBtnText;
+ searchLabel.Text = "Search";
+ findButton.Text = "Find";
+ goButton.Text = "Go";
+ jumpToBottomButton.Text = "Jump to bottom";
+ jumpToTopButton.Text = "Jump to top";
+
+ ShowOrHideButtons((Buttons)0x1F, true);
+ }
+
+ private void goButton_Click(object sender, EventArgs e)
+ {
+ if (int.TryParse(nrTextBox.Text, out int index))
+ {
+ // ListView indexing: first = 0
+ index--;
+
+ if (index >= 0 && index < listViewEx.Items.Count)
+ {
+ //listViewEx.SelectedItems.Clear();
+
+ /*listViewEx.FullRowSelect = true;
+ listViewEx.HideSelection = false;
+ listViewEx.OwnerDraw = false;*/
+
+ var item = listViewEx.Items[index];
+ listViewEx.HideSelection = false;
+ item.Selected = true;
+ listViewEx.Select();
+ item.Focused = true;
+ item.EnsureVisible(); // automatic scroll
+ }
+ }
+ else
+ {
+ MessageBox.Show("Invalid character.");
+ }
+ }
+
+ // Stores the last search text
+ private string _lastSearchText = string.Empty;
+
+ // Stores the index of the last found item in the ListView
+ private int _lastFoundIndex = -1;
+
+ private void findButton_Click(object sender, EventArgs e)
+ {
+ // Get search text
+ string search = searchTextBox.Text.Trim();
+ if (string.IsNullOrEmpty(search))
+ return;
+
+ string searchLower = search.ToLower();
+
+ // Store search state
+ _lastSearchText = search;
+ _lastFoundIndex = -1;
+
+ // Find first occurrence from the top
+ int index = FindItemIndex(searchLower, 0, +1);
+ if (index == -1)
+ {
+ MessageBox.Show("No results found.");
+ return;
+ }
+
+ // Remember last found index
+ _lastFoundIndex = index;
+
+ // Select item
+ SelectItemAtIndex(index);
+ }
+
+ ///
+ /// Finds an item in the ListView starting from given index and direction.
+ ///
+ /// Search text (lowercase).
+ /// Index to start from.
+ /// +1 = forward, -1 = backward.
+ /// Index of found item or -1 if not found.
+ private int FindItemIndex(string search, int startIndex, int direction)
+ {
+ // No items -> nothing to search
+ if (listViewEx.Items.Count == 0)
+ return -1;
+
+ // Clamp start index to valid range
+ if (startIndex < 0)
+ startIndex = 0;
+ if (startIndex >= listViewEx.Items.Count)
+ startIndex = listViewEx.Items.Count - 1;
+
+ // Forward search
+ if (direction > 0)
+ {
+ for (int i = startIndex; i < listViewEx.Items.Count; i++)
+ {
+ var item = listViewEx.Items[i];
+
+ // Check all subitems (columns)
+ foreach (ListViewItem.ListViewSubItem sub in item.SubItems)
+ {
+ if (sub.Text.ToLower().Contains(search))
+ return i;
+ }
+ }
+ }
+ // Backward search
+ else if (direction < 0)
+ {
+ for (int i = startIndex; i >= 0; i--)
+ {
+ var item = listViewEx.Items[i];
+
+ // Check all subitems (columns)
+ foreach (ListViewItem.ListViewSubItem sub in item.SubItems)
+ {
+ if (sub.Text.ToLower().Contains(search))
+ return i;
+ }
+ }
+ }
+
+ // Nothing found
+ return -1;
+ }
+
+ ///
+ /// Selects and scrolls to the item at given index.
+ ///
+ private void SelectItemAtIndex(int index)
+ {
+ if (index < 0 || index >= listViewEx.Items.Count)
+ return;
+
+ // Clear previous selection
+ listViewEx.SelectedItems.Clear();
+
+ // Select and focus item
+ var item = listViewEx.Items[index];
+ listViewEx.HideSelection = false;
+ item.Selected = true;
+ listViewEx.Select();
+ item.Focused = true;
+ item.EnsureVisible();
+ }
+
+ private void findNextButton_Click(object sender, EventArgs e)
+ {
+ // Get current search text
+ string search = searchTextBox.Text.Trim();
+ if (string.IsNullOrEmpty(search))
+ return;
+
+ string searchLower = search.ToLower();
+
+ // If search text changed, start from scratch
+ if (search != _lastSearchText)
+ {
+ _lastSearchText = search;
+ _lastFoundIndex = -1;
+ }
+
+ // Start searching from the next item after the last found one
+ int startIndex = _lastFoundIndex + 1;
+ int index = FindItemIndex(searchLower, startIndex, +1);
+ if (index == -1)
+ {
+ MessageBox.Show("No more results.");
+ return;
+ }
+
+ _lastFoundIndex = index;
+ SelectItemAtIndex(index);
+ }
+
+ private void findBackButton_Click(object sender, EventArgs e)
+ {
+ // Get current search text
+ string search = searchTextBox.Text.Trim();
+ if (string.IsNullOrEmpty(search))
+ return;
+
+ string searchLower = search.ToLower();
+
+ // If search text changed, start from scratch
+ if (search != _lastSearchText)
+ {
+ _lastSearchText = search;
+ _lastFoundIndex = listViewEx.Items.Count; // start from bottom
+ }
+
+ // Start searching from the previous item before the last found one
+ int startIndex = _lastFoundIndex - 1;
+ int index = FindItemIndex(searchLower, startIndex, -1);
+ if (index == -1)
+ {
+ MessageBox.Show("No more results.");
+ return;
+ }
+
+ _lastFoundIndex = index;
+ SelectItemAtIndex(index);
+ }
+
+ private void jumpToTopButton_Click(object sender, EventArgs e)
+ {
+ // Check if there are any items in the ListView
+ if (listViewEx.Items.Count == 0)
+ return;
+
+ // Get the first item (index 0)
+ ListViewItem firstItem = listViewEx.Items[0];
+
+ // Clear previous selection
+ //listViewEx.SelectedItems.Clear();
+
+ // Select the first item
+ firstItem.Selected = true;
+ firstItem.Focused = true; // give keyboard focus to the item
+ firstItem.EnsureVisible(); // scroll so the item is visible (top)
+ }
+
+ private void jumpToBottomButton_Click(object sender, EventArgs e)
+ {
+ if (listViewEx.Items.Count == 0) return;
+
+ var last = listViewEx.Items[listViewEx.Items.Count - 1];
+ //listViewEx.SelectedItems.Clear();
+ last.Selected = true;
+ last.Focused = true;
+ last.EnsureVisible();
+ }
+
+ private void procedureNrTextBox_Enter(object sender, EventArgs e)
+ {
+ // When ProcedureNr textbox has focus, Enter will trigger Go button
+ var form = this.FindForm();
+ if (form != null)
+ form.AcceptButton = goButton;
+ }
+
+ private void searchTextBox_Enter(object sender, EventArgs e)
+ {
+ // When Search textbox has focus, Enter will trigger Find button
+ var form = this.FindForm();
+ if (form != null)
+ form.AcceptButton = findButton;
+ }
+ }
+
+ /*///
+ /// Events invoked when buttons are clicked (and in case of Unlock kbutton also accepted)
+ ///
+ public event EventHandler Unlocked;
+ public event EventHandler GoClicked;
+ public event EventHandler FindClicked;
+ public event EventHandler FindNextClicked;
+ public event EventHandler FindBackClicked;
+ public event EventHandler JumpToTopClicked;
+ public event EventHandler JumpToBottomClicked;
+
+ ///
+ /// All remaining handlers:
+ ///
+ private void cancelBtn_Click(object s, EventArgs e) { if (CancelClicked != null) CancelClicked(s, e); }
+ private void addBtn_Click(object s, EventArgs e) { if (AddClicked != null) AddClicked(s, e); }
+ private void removeBtn_Click(object s, EventArgs e) { if (RemoveClicked != null) RemoveClicked(s, e); }
+ private void upBtn_Click(object s, EventArgs e) { if (UpClicked != null) UpClicked(s, e); }
+ private void downBtn_Click(object s, EventArgs e) { if (DownClicked != null) DownClicked(s, e); }
+ private void editBtn_Click(object s, EventArgs e) { if (EditClicked != null) EditClicked(s, e); }
+ private void copyBtn_Click(object s, EventArgs e) { if (CopyClicked != null) CopyClicked(s, e); }
+ private void exportButton_Click(object s, EventArgs e) { if (ExportClicked != null) ExportClicked(s, e); }
+ private void importButton_Click(object s, EventArgs e) { if (ImportClicked != null) ImportClicked(s, e); }
+ private void compareButton_Click(object s, EventArgs e) { if (CompareClicked != null) CompareClicked(s, e); }
+ private void newTabButton_Click(object s, EventArgs e) { if (NewTabClicked != null) NewTabClicked(s, e); }
+ private void renameTabButton_Click(object s, EventArgs e) { if (RenameTabClicked != null) RenameTabClicked(s, e); }
+ private void removeTabButton_Click(object s, EventArgs e) { if (RemoveTabClicked != null) RemoveTabClicked(s, e); }
+ private void customButton1_Click(object s, EventArgs e) { if (Custom1Clicked != null) Custom1Clicked(s, e); }
+ private void customButton2_Click(object s, EventArgs e) { if (Custom2Clicked != null) Custom2Clicked(s, e); }
+ private void customButton3_Click(object s, EventArgs e) { if (Custom3Clicked != null) Custom3Clicked(s, e); }
+
+ */
+}
diff --git a/TBF/UI/Shared/SharedSearchForListView.designer.cs b/TBF/UI/Shared/SharedSearchForListView.designer.cs
new file mode 100644
index 000000000..c2285aa19
--- /dev/null
+++ b/TBF/UI/Shared/SharedSearchForListView.designer.cs
@@ -0,0 +1,186 @@
+///
+/// Copyright (c) 2013-2015 Senus Slovensko a.s.
+///
+namespace TBF.UI.Shared
+{
+ partial class SharedSearchForListView
+ {
+ ///
+ /// 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 Component Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.findNextButton = new System.Windows.Forms.Button();
+ this.findButton = new System.Windows.Forms.Button();
+ this.findBackButton = new System.Windows.Forms.Button();
+ this.nrLabel = new System.Windows.Forms.Label();
+ this.jumpToTopButton = new System.Windows.Forms.Button();
+ this.nrTextBox = new System.Windows.Forms.TextBox();
+ this.jumpToBottomButton = new System.Windows.Forms.Button();
+ this.searchLabel = new System.Windows.Forms.Label();
+ this.searchTextBox = new System.Windows.Forms.TextBox();
+ this.goButton = new System.Windows.Forms.Button();
+ this.SuspendLayout();
+ //
+ // findNextButton
+ //
+ this.findNextButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold);
+ this.findNextButton.ImeMode = System.Windows.Forms.ImeMode.NoControl;
+ this.findNextButton.Location = new System.Drawing.Point(475, 11);
+ this.findNextButton.Name = "findNextButton";
+ this.findNextButton.Size = new System.Drawing.Size(23, 23);
+ this.findNextButton.TabIndex = 39;
+ this.findNextButton.Text = "↓";
+ this.findNextButton.UseVisualStyleBackColor = true;
+ this.findNextButton.Click += new System.EventHandler(this.findNextButton_Click);
+ //
+ // findButton
+ //
+ this.findButton.ImeMode = System.Windows.Forms.ImeMode.NoControl;
+ this.findButton.Location = new System.Drawing.Point(429, 11);
+ this.findButton.Name = "findButton";
+ this.findButton.Size = new System.Drawing.Size(46, 23);
+ this.findButton.TabIndex = 35;
+ this.findButton.Text = "find";
+ this.findButton.UseVisualStyleBackColor = true;
+ this.findButton.Click += new System.EventHandler(this.findButton_Click);
+ //
+ // findBackButton
+ //
+ this.findBackButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold);
+ this.findBackButton.ImeMode = System.Windows.Forms.ImeMode.NoControl;
+ this.findBackButton.Location = new System.Drawing.Point(498, 11);
+ this.findBackButton.Name = "findBackButton";
+ this.findBackButton.Size = new System.Drawing.Size(23, 23);
+ this.findBackButton.TabIndex = 38;
+ this.findBackButton.Tag = "aa";
+ this.findBackButton.Text = "↑";
+ this.findBackButton.UseVisualStyleBackColor = true;
+ this.findBackButton.Click += new System.EventHandler(this.findBackButton_Click);
+ //
+ // nrLabel
+ //
+ this.nrLabel.AutoSize = true;
+ this.nrLabel.ImeMode = System.Windows.Forms.ImeMode.NoControl;
+ this.nrLabel.Location = new System.Drawing.Point(12, 17);
+ this.nrLabel.Name = "nrLabel";
+ this.nrLabel.Size = new System.Drawing.Size(71, 13);
+ this.nrLabel.TabIndex = 30;
+ this.nrLabel.Text = "Procedure nr.";
+ //
+ // jumpToTopButton
+ //
+ this.jumpToTopButton.ImeMode = System.Windows.Forms.ImeMode.NoControl;
+ this.jumpToTopButton.Location = new System.Drawing.Point(527, 11);
+ this.jumpToTopButton.Name = "jumpToTopButton";
+ this.jumpToTopButton.Size = new System.Drawing.Size(77, 23);
+ this.jumpToTopButton.TabIndex = 37;
+ this.jumpToTopButton.Text = "jump to top";
+ this.jumpToTopButton.UseVisualStyleBackColor = true;
+ this.jumpToTopButton.Click += new System.EventHandler(this.jumpToTopButton_Click);
+ //
+ // nrTextBox
+ //
+ this.nrTextBox.Location = new System.Drawing.Point(90, 13);
+ this.nrTextBox.Name = "nrTextBox";
+ this.nrTextBox.Size = new System.Drawing.Size(60, 20);
+ this.nrTextBox.TabIndex = 31;
+ this.nrTextBox.Enter += procedureNrTextBox_Enter;
+ //
+ // jumpToBottomButton
+ //
+ this.jumpToBottomButton.ImeMode = System.Windows.Forms.ImeMode.NoControl;
+ this.jumpToBottomButton.Location = new System.Drawing.Point(610, 11);
+ this.jumpToBottomButton.Name = "jumpToBottomButton";
+ this.jumpToBottomButton.Size = new System.Drawing.Size(97, 23);
+ this.jumpToBottomButton.TabIndex = 36;
+ this.jumpToBottomButton.Text = "jump to bottom";
+ this.jumpToBottomButton.UseVisualStyleBackColor = true;
+ this.jumpToBottomButton.Click += new System.EventHandler(this.jumpToBottomButton_Click);
+ //
+ // searchLabel
+ //
+ this.searchLabel.AutoSize = true;
+ this.searchLabel.ImeMode = System.Windows.Forms.ImeMode.NoControl;
+ this.searchLabel.Location = new System.Drawing.Point(207, 16);
+ this.searchLabel.Name = "searchLabel";
+ this.searchLabel.Size = new System.Drawing.Size(41, 13);
+ this.searchLabel.TabIndex = 32;
+ this.searchLabel.Text = "Search";
+ //
+ // searchTextBox
+ //
+ this.searchTextBox.Location = new System.Drawing.Point(254, 13);
+ this.searchTextBox.Name = "searchTextBox";
+ this.searchTextBox.Size = new System.Drawing.Size(169, 20);
+ this.searchTextBox.TabIndex = 33;
+ this.searchTextBox.Enter += searchTextBox_Enter;
+ //
+ // goButton
+ //
+ this.goButton.ImeMode = System.Windows.Forms.ImeMode.NoControl;
+ this.goButton.Location = new System.Drawing.Point(155, 11);
+ this.goButton.Name = "goButton";
+ this.goButton.Size = new System.Drawing.Size(46, 23);
+ this.goButton.TabIndex = 34;
+ this.goButton.Text = "go";
+ this.goButton.UseVisualStyleBackColor = true;
+ this.goButton.Click += new System.EventHandler(this.goButton_Click);
+ //
+ // SharedSearchForListView
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.findNextButton);
+ this.Controls.Add(this.findButton);
+ this.Controls.Add(this.findBackButton);
+ this.Controls.Add(this.nrLabel);
+ this.Controls.Add(this.jumpToTopButton);
+ this.Controls.Add(this.nrTextBox);
+ this.Controls.Add(this.jumpToBottomButton);
+ this.Controls.Add(this.searchLabel);
+ this.Controls.Add(this.searchTextBox);
+ this.Controls.Add(this.goButton);
+ this.Name = "SharedSearchForListView";
+ this.Size = new System.Drawing.Size(718, 42);
+ this.Load += new System.EventHandler(this.SharedDlgSearchForListView_Load);
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ public System.Windows.Forms.Button findNextButton;
+ public System.Windows.Forms.Button findButton;
+ public System.Windows.Forms.Button findBackButton;
+ public System.Windows.Forms.Label nrLabel;
+ public System.Windows.Forms.Button jumpToTopButton;
+ public System.Windows.Forms.TextBox nrTextBox;
+ public System.Windows.Forms.Button jumpToBottomButton;
+ public System.Windows.Forms.Label searchLabel;
+ public System.Windows.Forms.TextBox searchTextBox;
+ public System.Windows.Forms.Button goButton;
+ }
+}
diff --git a/TBF/UI/Shared/SharedSearchForListView.resx b/TBF/UI/Shared/SharedSearchForListView.resx
new file mode 100644
index 000000000..1af7de150
--- /dev/null
+++ b/TBF/UI/Shared/SharedSearchForListView.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