ResultsConfigDlg : Up and Down buttons added, ver.2.6.279

This commit is contained in:
Milan Hanajik
2016-05-04 11:03:59 +02:00
parent dcd795b778
commit f44713eec3
3 changed files with 99 additions and 12 deletions
@@ -6,6 +6,7 @@ using System.Collections.Generic;
using System.Windows.Forms;
using log4net;
using Config.Entities;
using Results;
using TBF.Resources;
using TBF.UiControls;
@@ -52,6 +53,8 @@ namespace TBF.BenchControl.Output.FileWriters.Basic
removeAllButton.Text = Strings.Remove_all;
okButton.Text = Strings.OkBtnText;
cancelButton.Text = Strings.CancelBtnText;
upButton.Text = Strings.UpBtnText;
downButton.Text = Strings.DownBtnText;
}
void ResultsConfig_Load(object sender, EventArgs e)
@@ -213,7 +216,12 @@ namespace TBF.BenchControl.Output.FileWriters.Basic
SelectedItems.Add(oriItem.Clone());
RedrawAvailable();
RedrawSelected();
}
/// Select the last item
selectedResultsListViewEx.Focus();
selectedResultsListViewEx.Items[SelectedItems.Count - 1].Selected = true;
selectedResultsListViewEx.Items[SelectedItems.Count - 1].EnsureVisible();
}
}
void addButton_Click(object sender, EventArgs e)
@@ -228,7 +236,12 @@ namespace TBF.BenchControl.Output.FileWriters.Basic
}
RedrawAvailable();
RedrawSelected();
}
/// Select the last item
selectedResultsListViewEx.Focus();
selectedResultsListViewEx.Items[SelectedItems.Count - 1].Selected = true;
selectedResultsListViewEx.Items[SelectedItems.Count - 1].EnsureVisible();
}
private void selectedResultsListBox_DoubleClick(object sender, EventArgs e)
{
@@ -273,5 +286,53 @@ namespace TBF.BenchControl.Output.FileWriters.Basic
{
e.Handled = true;
}
private void upButton_Click(object sender, EventArgs e)
{
if (selectedResultsListViewEx.SelectedIndices.Count != 1) return;
int selIdx = selectedResultsListViewEx.SelectedIndices[0];
if (selIdx == 0)
{
/// Cannot move up
selectedResultsListViewEx.Focus();
selectedResultsListViewEx.Items[0].Selected = true;
return;
}
Results.WMeterRsltItemSpec tmp = SelectedItems[selIdx - 1];
SelectedItems[selIdx - 1] = SelectedItems[selIdx];
SelectedItems[selIdx] = tmp;
RedrawSelected();
selectedResultsListViewEx.Focus();
selectedResultsListViewEx.Items[selIdx - 1].Selected = true;
selectedResultsListViewEx.Items[selIdx - 1].EnsureVisible();
}
private void downButton_Click(object sender, EventArgs e)
{
if (selectedResultsListViewEx.SelectedIndices.Count != 1) return;
int selIdx = selectedResultsListViewEx.SelectedIndices[0];
if (selIdx == SelectedItems.Count - 1)
{
/// Cannot move down
selectedResultsListViewEx.Focus();
selectedResultsListViewEx.Items[SelectedItems.Count - 1].Selected = true;
return;
}
Results.WMeterRsltItemSpec tmp = SelectedItems[selIdx + 1];
SelectedItems[selIdx + 1] = SelectedItems[selIdx];
SelectedItems[selIdx] = tmp;
RedrawSelected();
selectedResultsListViewEx.Focus();
selectedResultsListViewEx.Items[selIdx + 1].Selected = true;
selectedResultsListViewEx.Items[selIdx + 1].EnsureVisible();
}
}
}
@@ -40,11 +40,13 @@ namespace TBF.BenchControl.Output.FileWriters.Basic
this.removeButton = new System.Windows.Forms.Button();
this.addButton = new System.Windows.Forms.Button();
this.selectedResultsListViewEx = new TBF.UiControls.ListViewEx();
this.upButton = new System.Windows.Forms.Button();
this.downButton = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// okButton
//
this.okButton.Location = new System.Drawing.Point(344, 324);
this.okButton.Location = new System.Drawing.Point(344, 401);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(104, 30);
this.okButton.TabIndex = 4;
@@ -55,7 +57,7 @@ namespace TBF.BenchControl.Output.FileWriters.Basic
// cancelButton
//
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Location = new System.Drawing.Point(465, 324);
this.cancelButton.Location = new System.Drawing.Point(465, 401);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(104, 30);
this.cancelButton.TabIndex = 5;
@@ -67,7 +69,7 @@ namespace TBF.BenchControl.Output.FileWriters.Basic
this.availableResultsListBox.FormattingEnabled = true;
this.availableResultsListBox.Location = new System.Drawing.Point(12, 31);
this.availableResultsListBox.Name = "availableResultsListBox";
this.availableResultsListBox.Size = new System.Drawing.Size(162, 277);
this.availableResultsListBox.Size = new System.Drawing.Size(162, 355);
this.availableResultsListBox.TabIndex = 6;
this.availableResultsListBox.DoubleClick += new System.EventHandler(this.availableResultsListBox_DoubleClick);
//
@@ -91,7 +93,7 @@ namespace TBF.BenchControl.Output.FileWriters.Basic
//
// removeAllButton
//
this.removeAllButton.Location = new System.Drawing.Point(184, 182);
this.removeAllButton.Location = new System.Drawing.Point(184, 144);
this.removeAllButton.Name = "removeAllButton";
this.removeAllButton.Size = new System.Drawing.Size(94, 30);
this.removeAllButton.TabIndex = 46;
@@ -101,7 +103,7 @@ namespace TBF.BenchControl.Output.FileWriters.Basic
//
// removeButton
//
this.removeButton.Location = new System.Drawing.Point(184, 147);
this.removeButton.Location = new System.Drawing.Point(184, 109);
this.removeButton.Name = "removeButton";
this.removeButton.Size = new System.Drawing.Size(93, 30);
this.removeButton.TabIndex = 45;
@@ -111,7 +113,7 @@ namespace TBF.BenchControl.Output.FileWriters.Basic
//
// addButton
//
this.addButton.Location = new System.Drawing.Point(184, 112);
this.addButton.Location = new System.Drawing.Point(184, 74);
this.addButton.Name = "addButton";
this.addButton.Size = new System.Drawing.Size(93, 30);
this.addButton.TabIndex = 44;
@@ -126,20 +128,42 @@ namespace TBF.BenchControl.Output.FileWriters.Basic
this.selectedResultsListViewEx.FullRowSelect = true;
this.selectedResultsListViewEx.Location = new System.Drawing.Point(287, 31);
this.selectedResultsListViewEx.Name = "selectedResultsListViewEx";
this.selectedResultsListViewEx.Size = new System.Drawing.Size(594, 277);
this.selectedResultsListViewEx.Size = new System.Drawing.Size(594, 355);
this.selectedResultsListViewEx.TabIndex = 47;
this.selectedResultsListViewEx.UseCompatibleStateImageBehavior = false;
this.selectedResultsListViewEx.View = System.Windows.Forms.View.Details;
this.selectedResultsListViewEx.SubItemClicked += new TBF.UiControls.SubItemEventHandler(this.selectedResultsListViewEx_SubItemClicked);
this.selectedResultsListViewEx.SubItemEndEditing += new TBF.UiControls.SubItemEndEditingEventHandler(this.selectedResultsListViewEx_SubItemEndEditing);
//
// upButton
//
this.upButton.Location = new System.Drawing.Point(184, 236);
this.upButton.Name = "upButton";
this.upButton.Size = new System.Drawing.Size(93, 30);
this.upButton.TabIndex = 48;
this.upButton.Text = "Up";
this.upButton.UseVisualStyleBackColor = true;
this.upButton.Click += new System.EventHandler(this.upButton_Click);
//
// downButton
//
this.downButton.Location = new System.Drawing.Point(184, 272);
this.downButton.Name = "downButton";
this.downButton.Size = new System.Drawing.Size(93, 30);
this.downButton.TabIndex = 49;
this.downButton.Text = "Down";
this.downButton.UseVisualStyleBackColor = true;
this.downButton.Click += new System.EventHandler(this.downButton_Click);
//
// ResultsConfigDlg
//
this.AcceptButton = this.okButton;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.cancelButton;
this.ClientSize = new System.Drawing.Size(893, 366);
this.ClientSize = new System.Drawing.Size(893, 445);
this.Controls.Add(this.downButton);
this.Controls.Add(this.upButton);
this.Controls.Add(this.selectedResultsListViewEx);
this.Controls.Add(this.removeAllButton);
this.Controls.Add(this.removeButton);
@@ -172,5 +196,7 @@ namespace TBF.BenchControl.Output.FileWriters.Basic
private System.Windows.Forms.Button removeButton;
private System.Windows.Forms.Button addButton;
private UiControls.ListViewEx selectedResultsListViewEx;
private System.Windows.Forms.Button upButton;
private System.Windows.Forms.Button downButton;
}
}