Add search and navigation as UI>shared for ListBox-es and ListView-s to components listview, components listbox, procedure listview
This commit is contained in:
parent
b43657a4db
commit
80c651dbfd
@ -5,11 +5,12 @@
|
||||
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
|
||||
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
|
||||
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
|
||||
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\micha\.nuget\packages\</NuGetPackageFolders>
|
||||
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\MFRNIAK\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages</NuGetPackageFolders>
|
||||
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
|
||||
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">7.0.0</NuGetToolVersion>
|
||||
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.14.0</NuGetToolVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||
<SourceRoot Include="C:\Users\micha\.nuget\packages\" />
|
||||
<SourceRoot Include="C:\Users\MFRNIAK\.nuget\packages\" />
|
||||
<SourceRoot Include="C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages\" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@ -1456,7 +1456,9 @@
|
||||
<Compile Include="Rig\Scales\MettlerToledo\Factory.cs" />
|
||||
<Compile Include="Rig\Scales\MettlerToledo\GetSerNumOp.cs" />
|
||||
<Compile Include="Rig\Scales\MettlerToledo\ReadStableMassOp.cs" />
|
||||
<Compile Include="Rig\Scales\MettlerToledo\SerialPortDevice.cs" />
|
||||
<Compile Include="Rig\Scales\MettlerToledo\SerialPortDevice.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Rig\Scales\MettlerToledo\SerialPortDeviceFake.cs" />
|
||||
<Compile Include="Rig\Scales\MettlerToledo\SetUnitsOp.cs" />
|
||||
<Compile Include="Rig\Scales\MettlerToledo\TaringOp.cs" />
|
||||
@ -2947,6 +2949,18 @@
|
||||
<Compile Include="UI\Shared\SharedButtons.designer.cs">
|
||||
<DependentUpon>SharedButtons.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UI\Shared\SharedSearchForListBox.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="UI\Shared\SharedSearchForListBox.designer.cs">
|
||||
<DependentUpon>SharedSearchForListBox.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UI\Shared\SharedSearchForListView.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="UI\Shared\SharedSearchForListView.designer.cs">
|
||||
<DependentUpon>SharedSearchForListView.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UI\Shared\SuggestComboBox.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
@ -3859,6 +3873,12 @@
|
||||
<EmbeddedResource Include="UI\Shared\SharedButtons.resx">
|
||||
<DependentUpon>SharedButtons.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="UI\Shared\SharedSearchForListBox.resx">
|
||||
<DependentUpon>SharedSearchForListBox.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="UI\Shared\SharedSearchForListView.resx">
|
||||
<DependentUpon>SharedSearchForListView.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="UI\Shared\TabNameDlg.resx">
|
||||
<DependentUpon>TabNameDlg.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
||||
156
TBF/UI/Bench/Components/ComponentsManagerDlg.Designer.cs
generated
156
TBF/UI/Bench/Components/ComponentsManagerDlg.Designer.cs
generated
@ -31,66 +31,98 @@ namespace TBF.UI.Bench.Components
|
||||
/// </summary>
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -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));
|
||||
|
||||
/// <summary>
|
||||
/// List of components (=component configuration instances)
|
||||
/// </summary>
|
||||
IList<Component> cmpntEntities;
|
||||
/// <summary>
|
||||
/// List of components (=component configuration instances)
|
||||
/// </summary>
|
||||
IList<Component> cmpntEntities;
|
||||
|
||||
IList<Component> toBeDeletedEntities;
|
||||
IList<Component> 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
|
||||
|
||||
/// <summary>
|
||||
/// ListViewEx columns
|
||||
/// </summary>
|
||||
@ -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<Component>();
|
||||
public ComponentsManagerDlg()
|
||||
{
|
||||
toBeDeletedEntities = new List<Component>();
|
||||
|
||||
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<Component>()
|
||||
.OrderBy(x => x.ItemNr).Asc
|
||||
.List<Component>();
|
||||
session = TBF.DB.CreateSession(DBKind.Config);
|
||||
cmpntEntities = session.QueryOver<Component>()
|
||||
.OrderBy(x => x.ItemNr).Asc
|
||||
.List<Component>();
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Updates component configuration from a script file
|
||||
@ -810,7 +718,7 @@ namespace TBF.UI.Bench.Components
|
||||
/// <returns>true = udated component configuration should be saved, new component should be created</returns>
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -118,19 +118,58 @@
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="splitContainer.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
||||
<data name="splitContainer1.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
||||
<value>Fill</value>
|
||||
</data>
|
||||
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="splitContainer.IsSplitterFixed" type="System.Boolean, mscorlib">
|
||||
<data name="splitContainer1.IsSplitterFixed" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="splitContainer.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<data name="splitContainer1.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>0, 0</value>
|
||||
</data>
|
||||
<data name="splitContainer.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||
<value>4, 5, 4, 5</value>
|
||||
<data name="splitContainer1.Orientation" type="System.Windows.Forms.Orientation, System.Windows.Forms">
|
||||
<value>Horizontal</value>
|
||||
</data>
|
||||
<data name="sharedSearchForListView1.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
||||
<value>Fill</value>
|
||||
</data>
|
||||
<data name="sharedSearchForListView1.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>0, 0</value>
|
||||
</data>
|
||||
<data name="sharedSearchForListView1.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>777, 25</value>
|
||||
</data>
|
||||
<data name="sharedSearchForListView1.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<data name=">>sharedSearchForListView1.Name" xml:space="preserve">
|
||||
<value>sharedSearchForListView1</value>
|
||||
</data>
|
||||
<data name=">>sharedSearchForListView1.Type" xml:space="preserve">
|
||||
<value>TBF.UI.Shared.SharedSearchForListView, TBF, Version=3.9.2148.1, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>sharedSearchForListView1.Parent" xml:space="preserve">
|
||||
<value>splitContainer1.Panel1</value>
|
||||
</data>
|
||||
<data name=">>sharedSearchForListView1.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<data name=">>splitContainer1.Panel1.Name" xml:space="preserve">
|
||||
<value>splitContainer1.Panel1</value>
|
||||
</data>
|
||||
<data name=">>splitContainer1.Panel1.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.SplitterPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>splitContainer1.Panel1.Parent" xml:space="preserve">
|
||||
<value>splitContainer1</value>
|
||||
</data>
|
||||
<data name=">>splitContainer1.Panel1.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<data name="splitContainer1.Panel2.AutoScroll" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="listViewEx.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
||||
<value>Fill</value>
|
||||
@ -138,11 +177,8 @@
|
||||
<data name="listViewEx.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>0, 0</value>
|
||||
</data>
|
||||
<data name="listViewEx.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||
<value>4, 5, 4, 5</value>
|
||||
</data>
|
||||
<data name="listViewEx.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>711, 532</value>
|
||||
<value>777, 317</value>
|
||||
</data>
|
||||
<data name="listViewEx.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>7</value>
|
||||
@ -154,11 +190,53 @@
|
||||
<value>Common.Forms.ListViewEx, Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>listViewEx.Parent" xml:space="preserve">
|
||||
<value>splitContainer.Panel1</value>
|
||||
<value>splitContainer1.Panel2</value>
|
||||
</data>
|
||||
<data name=">>listViewEx.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<data name=">>splitContainer1.Panel2.Name" xml:space="preserve">
|
||||
<value>splitContainer1.Panel2</value>
|
||||
</data>
|
||||
<data name=">>splitContainer1.Panel2.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.SplitterPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>splitContainer1.Panel2.Parent" xml:space="preserve">
|
||||
<value>splitContainer1</value>
|
||||
</data>
|
||||
<data name=">>splitContainer1.Panel2.ZOrder" xml:space="preserve">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="splitContainer1.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>777, 346</value>
|
||||
</data>
|
||||
<data name="splitContainer1.SplitterDistance" type="System.Int32, mscorlib">
|
||||
<value>25</value>
|
||||
</data>
|
||||
<data name="splitContainer1.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>8</value>
|
||||
</data>
|
||||
<data name=">>splitContainer1.Name" xml:space="preserve">
|
||||
<value>splitContainer1</value>
|
||||
</data>
|
||||
<data name=">>splitContainer1.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.SplitContainer, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>splitContainer1.Parent" xml:space="preserve">
|
||||
<value>splitContainer.Panel1</value>
|
||||
</data>
|
||||
<data name=">>splitContainer1.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<data name="splitContainer.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
||||
<value>Fill</value>
|
||||
</data>
|
||||
<data name="splitContainer.IsSplitterFixed" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="splitContainer.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>0, 0</value>
|
||||
</data>
|
||||
<data name=">>splitContainer.Panel1.Name" xml:space="preserve">
|
||||
<value>splitContainer.Panel1</value>
|
||||
</data>
|
||||
@ -172,13 +250,13 @@
|
||||
<value>0</value>
|
||||
</data>
|
||||
<data name="sharedButtons.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>2, 0</value>
|
||||
<value>1, 0</value>
|
||||
</data>
|
||||
<data name="sharedButtons.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||
<value>6, 8, 6, 8</value>
|
||||
<value>4, 5, 4, 5</value>
|
||||
</data>
|
||||
<data name="sharedButtons.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>150, 802</value>
|
||||
<value>100, 521</value>
|
||||
</data>
|
||||
<data name="sharedButtons.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>0</value>
|
||||
@ -187,7 +265,7 @@
|
||||
<value>sharedButtons</value>
|
||||
</data>
|
||||
<data name=">>sharedButtons.Type" xml:space="preserve">
|
||||
<value>TBF.UI.Shared.SharedButtons, TBF, Version=3.9.2140.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>TBF.UI.Shared.SharedButtons, TBF, Version=3.9.2148.1, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>sharedButtons.Parent" xml:space="preserve">
|
||||
<value>splitContainer.Panel2</value>
|
||||
@ -208,13 +286,10 @@
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="splitContainer.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>818, 532</value>
|
||||
<value>884, 346</value>
|
||||
</data>
|
||||
<data name="splitContainer.SplitterDistance" type="System.Int32, mscorlib">
|
||||
<value>711</value>
|
||||
</data>
|
||||
<data name="splitContainer.SplitterWidth" type="System.Int32, mscorlib">
|
||||
<value>6</value>
|
||||
<value>777</value>
|
||||
</data>
|
||||
<data name="splitContainer.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>8</value>
|
||||
@ -235,13 +310,10 @@
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
|
||||
<value>9, 20</value>
|
||||
<value>6, 13</value>
|
||||
</data>
|
||||
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
|
||||
<value>818, 532</value>
|
||||
</data>
|
||||
<data name="$this.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||
<value>4, 5, 4, 5</value>
|
||||
<value>884, 346</value>
|
||||
</data>
|
||||
<data name="$this.StartPosition" type="System.Windows.Forms.FormStartPosition, System.Windows.Forms">
|
||||
<value>CenterParent</value>
|
||||
|
||||
@ -31,61 +31,69 @@ namespace TBF.UI.Bench.Components
|
||||
/// </summary>
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -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)
|
||||
{
|
||||
|
||||
@ -117,12 +117,16 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="availCmpntsLstBox.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Bottom, Left, Right</value>
|
||||
</data>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="availCmpntsLstBox.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>12, 34</value>
|
||||
<value>12, 73</value>
|
||||
</data>
|
||||
<data name="availCmpntsLstBox.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>288, 264</value>
|
||||
<value>510, 238</value>
|
||||
</data>
|
||||
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="availCmpntsLstBox.TabIndex" type="System.Int32, mscorlib">
|
||||
@ -138,13 +142,16 @@
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>availCmpntsLstBox.ZOrder" xml:space="preserve">
|
||||
<value>3</value>
|
||||
<value>4</value>
|
||||
</data>
|
||||
<data name="availableComponentsLabel.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="availableComponentsLabel.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="availableComponentsLabel.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>9, 9</value>
|
||||
<value>12, 46</value>
|
||||
</data>
|
||||
<data name="availableComponentsLabel.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>115, 13</value>
|
||||
@ -165,10 +172,16 @@
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>availableComponentsLabel.ZOrder" xml:space="preserve">
|
||||
<value>2</value>
|
||||
<value>3</value>
|
||||
</data>
|
||||
<data name="cancelButton.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Bottom, Right</value>
|
||||
</data>
|
||||
<data name="cancelButton.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="cancelButton.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>200, 310</value>
|
||||
<value>423, 324</value>
|
||||
</data>
|
||||
<data name="cancelButton.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>99, 25</value>
|
||||
@ -189,10 +202,16 @@
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>cancelButton.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="okButton.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Bottom, Right</value>
|
||||
</data>
|
||||
<data name="okButton.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="okButton.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>95, 310</value>
|
||||
<value>318, 324</value>
|
||||
</data>
|
||||
<data name="okButton.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>99, 25</value>
|
||||
@ -213,7 +232,28 @@
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>okButton.ZOrder" xml:space="preserve">
|
||||
<value>1</value>
|
||||
<value>2</value>
|
||||
</data>
|
||||
<data name="sharedSearchForListBox1.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>12, 1</value>
|
||||
</data>
|
||||
<data name="sharedSearchForListBox1.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>510, 42</value>
|
||||
</data>
|
||||
<data name="sharedSearchForListBox1.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>9</value>
|
||||
</data>
|
||||
<data name=">>sharedSearchForListBox1.Name" xml:space="preserve">
|
||||
<value>sharedSearchForListBox1</value>
|
||||
</data>
|
||||
<data name=">>sharedSearchForListBox1.Type" xml:space="preserve">
|
||||
<value>TBF.UI.Shared.SharedSearchForListBox, TBF, Version=3.9.2148.1, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>sharedSearchForListBox1.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>sharedSearchForListBox1.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
@ -222,9 +262,11 @@
|
||||
<value>6, 13</value>
|
||||
</data>
|
||||
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
|
||||
<value>311, 347</value>
|
||||
<value>534, 368</value>
|
||||
</data>
|
||||
<data name="$this.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="$this.StartPosition" type="System.Windows.Forms.FormStartPosition, System.Windows.Forms">
|
||||
<value>CenterParent</value>
|
||||
</data>
|
||||
|
||||
54
TBF/UI/Procedures/ProceduresCtrl.Designer.cs
generated
54
TBF/UI/Procedures/ProceduresCtrl.Designer.cs
generated
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -77,6 +77,11 @@ namespace TBF.UI.Procedures
|
||||
errorFlagsCmpnt = null;
|
||||
ToBeRemovedProcedures = new List<Procedure>();
|
||||
|
||||
/// SharedDlgSearchForListView configuration
|
||||
//sharedSearchForListView1.OwnerForm = this;
|
||||
sharedSearchForListView1.ListViewEx = listViewEx;
|
||||
sharedSearchForListView1.nrLabel.Text = "Procedure nr.";
|
||||
|
||||
/// Profile
|
||||
selectedProfile = null;
|
||||
ComboBox cb = profileComboBox;
|
||||
|
||||
311
TBF/UI/Shared/SharedSearchForListBox.cs
Normal file
311
TBF/UI/Shared/SharedSearchForListBox.cs
Normal file
@ -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; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
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;
|
||||
|
||||
/// <summary>
|
||||
/// Optional buttons are Add, Remove, Up, Down, Edit and Copy.
|
||||
/// OK and Cancel buttons are always visible (after unlock), but not always enabled.
|
||||
/// </summary>
|
||||
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;
|
||||
|
||||
/// <summary>
|
||||
/// Used by controls to indicate which item is selected
|
||||
/// and to appropriately update Remove, Up and Down Buttons.
|
||||
/// </summary>
|
||||
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;
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor
|
||||
/// </summary>
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initialize the buttons when the dialog is loaded
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Finds an item in the ListView starting from given index and direction.
|
||||
/// </summary>
|
||||
/// <param name="search">Search text (lowercase).</param>
|
||||
/// <param name="startIndex">Index to start from.</param>
|
||||
/// <param name="direction">+1 = forward, -1 = backward.</param>
|
||||
/// <returns>Index of found item or -1 if not found.</returns>
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Selects and scrolls to the item at given index.
|
||||
/// </summary>
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/*/// <summary>
|
||||
/// Events invoked when buttons are clicked (and in case of Unlock kbutton also accepted)
|
||||
/// </summary>
|
||||
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); }
|
||||
|
||||
*/
|
||||
}
|
||||
147
TBF/UI/Shared/SharedSearchForListBox.designer.cs
generated
Normal file
147
TBF/UI/Shared/SharedSearchForListBox.designer.cs
generated
Normal file
@ -0,0 +1,147 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Senus Slovensko a.s.
|
||||
///
|
||||
namespace TBF.UI.Shared
|
||||
{
|
||||
partial class SharedSearchForListBox
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
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;
|
||||
}
|
||||
}
|
||||
120
TBF/UI/Shared/SharedSearchForListBox.resx
Normal file
120
TBF/UI/Shared/SharedSearchForListBox.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
401
TBF/UI/Shared/SharedSearchForListView.cs
Normal file
401
TBF/UI/Shared/SharedSearchForListView.cs
Normal file
@ -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; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
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;
|
||||
|
||||
/// <summary>
|
||||
/// Optional buttons are Add, Remove, Up, Down, Edit and Copy.
|
||||
/// OK and Cancel buttons are always visible (after unlock), but not always enabled.
|
||||
/// </summary>
|
||||
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;
|
||||
|
||||
/// <summary>
|
||||
/// Used by controls to indicate which item is selected
|
||||
/// and to appropriately update Remove, Up and Down Buttons.
|
||||
/// </summary>
|
||||
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;
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor
|
||||
/// </summary>
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initialize the buttons when the dialog is loaded
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Finds an item in the ListView starting from given index and direction.
|
||||
/// </summary>
|
||||
/// <param name="search">Search text (lowercase).</param>
|
||||
/// <param name="startIndex">Index to start from.</param>
|
||||
/// <param name="direction">+1 = forward, -1 = backward.</param>
|
||||
/// <returns>Index of found item or -1 if not found.</returns>
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Selects and scrolls to the item at given index.
|
||||
/// </summary>
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/*/// <summary>
|
||||
/// Events invoked when buttons are clicked (and in case of Unlock kbutton also accepted)
|
||||
/// </summary>
|
||||
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); }
|
||||
|
||||
*/
|
||||
}
|
||||
186
TBF/UI/Shared/SharedSearchForListView.designer.cs
generated
Normal file
186
TBF/UI/Shared/SharedSearchForListView.designer.cs
generated
Normal file
@ -0,0 +1,186 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Senus Slovensko a.s.
|
||||
///
|
||||
namespace TBF.UI.Shared
|
||||
{
|
||||
partial class SharedSearchForListView
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
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;
|
||||
}
|
||||
}
|
||||
120
TBF/UI/Shared/SharedSearchForListView.resx
Normal file
120
TBF/UI/Shared/SharedSearchForListView.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
Loading…
Reference in New Issue
Block a user