ComponentsManagerDlg : Up and down button implemented.
This commit is contained in:
parent
ab14866575
commit
33b349e333
114
TestBenchFramework/ComponentsManagerDlg.Designer.cs
generated
114
TestBenchFramework/ComponentsManagerDlg.Designer.cs
generated
@ -31,62 +31,64 @@ namespace TBF
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ComponentsManagerDlg));
|
||||
this.splitContainer = new System.Windows.Forms.SplitContainer();
|
||||
this.listViewEx = new Results.Forms.ListViewEx();
|
||||
this.sharedButtons = new TBF.UiControls.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.Name = "listViewEx";
|
||||
this.listViewEx.UseCompatibleStateImageBehavior = false;
|
||||
this.listViewEx.View = System.Windows.Forms.View.Details;
|
||||
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.splitContainer = new System.Windows.Forms.SplitContainer();
|
||||
this.listViewEx = new Results.Forms.ListViewEx();
|
||||
this.sharedButtons = new TBF.UiControls.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.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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2017 Sensus Metering Systems
|
||||
/// Author: Milan Hanajík
|
||||
///
|
||||
using System;
|
||||
@ -65,16 +65,16 @@ namespace TBF
|
||||
sharedButtons.RequiredGroupMembership = Config.Grp.GID.Metrologists;
|
||||
sharedButtons.OptionalButtons = SharedButtons.Buttons.Add |
|
||||
SharedButtons.Buttons.Remove |
|
||||
//SharedButtons.Buttons.Up |
|
||||
//SharedButtons.Buttons.Down |
|
||||
SharedButtons.Buttons.Up |
|
||||
SharedButtons.Buttons.Down |
|
||||
SharedButtons.Buttons.Edit;
|
||||
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.UpClicked += upButton_Click;
|
||||
sharedButtons.DownClicked += downButton_Click;
|
||||
sharedButtons.EditClicked += editButton_Click;
|
||||
}
|
||||
|
||||
@ -162,6 +162,14 @@ namespace TBF
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
void RedrawAll()
|
||||
@ -360,6 +368,50 @@ namespace TBF
|
||||
RedrawAll();
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
flags |= CfgUpdateFlags.AnyChange;
|
||||
|
||||
RedrawAll();
|
||||
|
||||
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;
|
||||
|
||||
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;
|
||||
|
||||
RedrawAll();
|
||||
|
||||
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)
|
||||
|
||||
@ -145,7 +145,7 @@
|
||||
<value>listViewEx</value>
|
||||
</data>
|
||||
<data name=">>listViewEx.Type" xml:space="preserve">
|
||||
<value>Results.Forms.ListViewEx, Results, Version=2.12.394.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>Results.Forms.ListViewEx, Results, Version=2.12.475.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>listViewEx.Parent" xml:space="preserve">
|
||||
<value>splitContainer.Panel1</value>
|
||||
@ -178,7 +178,7 @@
|
||||
<value>sharedButtons</value>
|
||||
</data>
|
||||
<data name=">>sharedButtons.Type" xml:space="preserve">
|
||||
<value>TBF.UiControls.SharedButtons, TBF, Version=2.12.395.1, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>TBF.UiControls.SharedButtons, TBF, Version=2.12.481.1, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>sharedButtons.Parent" xml:space="preserve">
|
||||
<value>splitContainer.Panel2</value>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user