Implemented Name on Quick Filters.
This commit is contained in:
parent
71b8e9e51c
commit
f92b2b65b2
10 changed files with 309 additions and 151 deletions
|
|
@ -28,116 +28,127 @@
|
|||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.cancelBtn = new System.Windows.Forms.Button();
|
||||
this.saveBtn = new System.Windows.Forms.Button();
|
||||
this.dataGridView1 = new System.Windows.Forms.DataGridView();
|
||||
this.Original = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Delete = new DisableButtonColumn();
|
||||
this.Filter = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.MoveUp = new DisableButtonColumn();
|
||||
this.MoveDown = new DisableButtonColumn();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
cancelBtn = new System.Windows.Forms.Button();
|
||||
saveBtn = new System.Windows.Forms.Button();
|
||||
dataGridView1 = new System.Windows.Forms.DataGridView();
|
||||
Original = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
Delete = new DisableButtonColumn();
|
||||
FilterName = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
Filter = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
MoveUp = new DisableButtonColumn();
|
||||
MoveDown = new DisableButtonColumn();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView1).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// cancelBtn
|
||||
//
|
||||
this.cancelBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.cancelBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.cancelBtn.Location = new System.Drawing.Point(713, 415);
|
||||
this.cancelBtn.Name = "cancelBtn";
|
||||
this.cancelBtn.Size = new System.Drawing.Size(75, 23);
|
||||
this.cancelBtn.TabIndex = 2;
|
||||
this.cancelBtn.Text = "Cancel";
|
||||
this.cancelBtn.UseVisualStyleBackColor = true;
|
||||
this.cancelBtn.Click += new System.EventHandler(this.cancelBtn_Click);
|
||||
cancelBtn.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right;
|
||||
cancelBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
cancelBtn.Location = new System.Drawing.Point(1248, 726);
|
||||
cancelBtn.Margin = new System.Windows.Forms.Padding(5);
|
||||
cancelBtn.Name = "cancelBtn";
|
||||
cancelBtn.Size = new System.Drawing.Size(131, 40);
|
||||
cancelBtn.TabIndex = 2;
|
||||
cancelBtn.Text = "Cancel";
|
||||
cancelBtn.UseVisualStyleBackColor = true;
|
||||
cancelBtn.Click += cancelBtn_Click;
|
||||
//
|
||||
// saveBtn
|
||||
//
|
||||
this.saveBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.saveBtn.Location = new System.Drawing.Point(612, 415);
|
||||
this.saveBtn.Name = "saveBtn";
|
||||
this.saveBtn.Size = new System.Drawing.Size(75, 23);
|
||||
this.saveBtn.TabIndex = 1;
|
||||
this.saveBtn.Text = "Save";
|
||||
this.saveBtn.UseVisualStyleBackColor = true;
|
||||
this.saveBtn.Click += new System.EventHandler(this.saveBtn_Click);
|
||||
saveBtn.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right;
|
||||
saveBtn.Location = new System.Drawing.Point(1071, 726);
|
||||
saveBtn.Margin = new System.Windows.Forms.Padding(5);
|
||||
saveBtn.Name = "saveBtn";
|
||||
saveBtn.Size = new System.Drawing.Size(131, 40);
|
||||
saveBtn.TabIndex = 1;
|
||||
saveBtn.Text = "Save";
|
||||
saveBtn.UseVisualStyleBackColor = true;
|
||||
saveBtn.Click += saveBtn_Click;
|
||||
//
|
||||
// dataGridView1
|
||||
//
|
||||
this.dataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.dataGridView1.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.AllCells;
|
||||
this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||
this.Original,
|
||||
this.Delete,
|
||||
this.Filter,
|
||||
this.MoveUp,
|
||||
this.MoveDown});
|
||||
this.dataGridView1.Location = new System.Drawing.Point(12, 12);
|
||||
this.dataGridView1.MultiSelect = false;
|
||||
this.dataGridView1.Name = "dataGridView1";
|
||||
this.dataGridView1.Size = new System.Drawing.Size(776, 397);
|
||||
this.dataGridView1.TabIndex = 0;
|
||||
this.dataGridView1.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.DataGridView1_CellContentClick);
|
||||
this.dataGridView1.DefaultValuesNeeded += new System.Windows.Forms.DataGridViewRowEventHandler(this.dataGridView1_DefaultValuesNeeded);
|
||||
dataGridView1.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
|
||||
dataGridView1.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.AllCells;
|
||||
dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { Original, Delete, FilterName, Filter, MoveUp, MoveDown });
|
||||
dataGridView1.Location = new System.Drawing.Point(21, 21);
|
||||
dataGridView1.Margin = new System.Windows.Forms.Padding(5);
|
||||
dataGridView1.MultiSelect = false;
|
||||
dataGridView1.Name = "dataGridView1";
|
||||
dataGridView1.RowHeadersWidth = 72;
|
||||
dataGridView1.Size = new System.Drawing.Size(1358, 695);
|
||||
dataGridView1.TabIndex = 0;
|
||||
dataGridView1.CellContentClick += DataGridView1_CellContentClick;
|
||||
dataGridView1.DefaultValuesNeeded += dataGridView1_DefaultValuesNeeded;
|
||||
//
|
||||
// Original
|
||||
//
|
||||
this.Original.HeaderText = "Original";
|
||||
this.Original.Name = "Original";
|
||||
this.Original.ReadOnly = true;
|
||||
this.Original.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
|
||||
this.Original.Visible = false;
|
||||
this.Original.Width = 48;
|
||||
Original.HeaderText = "Original";
|
||||
Original.MinimumWidth = 9;
|
||||
Original.Name = "Original";
|
||||
Original.ReadOnly = true;
|
||||
Original.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
|
||||
Original.Visible = false;
|
||||
Original.Width = 150;
|
||||
//
|
||||
// Delete
|
||||
//
|
||||
this.Delete.HeaderText = "Delete";
|
||||
this.Delete.Name = "Delete";
|
||||
this.Delete.ReadOnly = true;
|
||||
this.Delete.Text = "x";
|
||||
this.Delete.Width = 44;
|
||||
Delete.HeaderText = "Delete";
|
||||
Delete.MinimumWidth = 9;
|
||||
Delete.Name = "Delete";
|
||||
Delete.ReadOnly = true;
|
||||
Delete.Text = "x";
|
||||
Delete.Width = 127;
|
||||
//
|
||||
// FilterName
|
||||
//
|
||||
FilterName.HeaderText = "Name";
|
||||
FilterName.MinimumWidth = 300;
|
||||
FilterName.Name = "FilterName";
|
||||
FilterName.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
|
||||
FilterName.Width = 300;
|
||||
//
|
||||
// Filter
|
||||
//
|
||||
this.Filter.HeaderText = "Filter";
|
||||
this.Filter.Name = "Filter";
|
||||
this.Filter.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
|
||||
this.Filter.Width = 35;
|
||||
Filter.HeaderText = "Filter";
|
||||
Filter.MinimumWidth = 400;
|
||||
Filter.Name = "Filter";
|
||||
Filter.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
|
||||
Filter.Width = 400;
|
||||
//
|
||||
// MoveUp
|
||||
//
|
||||
this.MoveUp.HeaderText = "Move Up";
|
||||
this.MoveUp.Name = "MoveUp";
|
||||
this.MoveUp.ReadOnly = true;
|
||||
this.MoveUp.Text = "^";
|
||||
this.MoveUp.Width = 57;
|
||||
MoveUp.HeaderText = "Move Up";
|
||||
MoveUp.MinimumWidth = 9;
|
||||
MoveUp.Name = "MoveUp";
|
||||
MoveUp.ReadOnly = true;
|
||||
MoveUp.Text = "^";
|
||||
MoveUp.Width = 169;
|
||||
//
|
||||
// MoveDown
|
||||
//
|
||||
this.MoveDown.HeaderText = "Move Down";
|
||||
this.MoveDown.Name = "MoveDown";
|
||||
this.MoveDown.ReadOnly = true;
|
||||
this.MoveDown.Text = "v";
|
||||
this.MoveDown.Width = 71;
|
||||
MoveDown.HeaderText = "Move Down";
|
||||
MoveDown.MinimumWidth = 9;
|
||||
MoveDown.Name = "MoveDown";
|
||||
MoveDown.ReadOnly = true;
|
||||
MoveDown.Text = "v";
|
||||
MoveDown.Width = 215;
|
||||
//
|
||||
// EditQuickFilters
|
||||
//
|
||||
this.AcceptButton = this.saveBtn;
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
|
||||
this.CancelButton = this.cancelBtn;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Controls.Add(this.dataGridView1);
|
||||
this.Controls.Add(this.cancelBtn);
|
||||
this.Controls.Add(this.saveBtn);
|
||||
this.Name = "EditQuickFilters";
|
||||
this.Text = "Edit Quick Filters";
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
AcceptButton = saveBtn;
|
||||
AutoScaleDimensions = new System.Drawing.SizeF(168F, 168F);
|
||||
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
|
||||
CancelButton = cancelBtn;
|
||||
ClientSize = new System.Drawing.Size(1400, 788);
|
||||
Controls.Add(dataGridView1);
|
||||
Controls.Add(cancelBtn);
|
||||
Controls.Add(saveBtn);
|
||||
Margin = new System.Windows.Forms.Padding(5);
|
||||
Name = "EditQuickFilters";
|
||||
Text = "Edit Quick Filters";
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
@ -146,6 +157,7 @@
|
|||
private System.Windows.Forms.DataGridView dataGridView1;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Original;
|
||||
private DisableButtonColumn Delete;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn FilterName;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Filter;
|
||||
private DisableButtonColumn MoveUp;
|
||||
private DisableButtonColumn MoveDown;
|
||||
|
|
|
|||
|
|
@ -6,14 +6,6 @@ using LibationFileManager;
|
|||
|
||||
namespace LibationWinForms.Dialogs
|
||||
{
|
||||
public class DisableButtonColumn : DataGridViewButtonColumn
|
||||
{
|
||||
public DisableButtonColumn()
|
||||
{
|
||||
CellTemplate = new EditQuickFilters.DisableButtonCell();
|
||||
}
|
||||
}
|
||||
|
||||
public partial class EditQuickFilters : Form
|
||||
{
|
||||
private const string BLACK_UP_POINTING_TRIANGLE = "\u25B2";
|
||||
|
|
@ -21,7 +13,8 @@ namespace LibationWinForms.Dialogs
|
|||
private const string COL_Original = nameof(Original);
|
||||
private const string COL_Delete = nameof(Delete);
|
||||
private const string COL_Filter = nameof(Filter);
|
||||
private const string COL_MoveUp = nameof(MoveUp);
|
||||
private const string COL_FilterName = nameof(FilterName);
|
||||
private const string COL_MoveUp = nameof(MoveUp);
|
||||
private const string COL_MoveDown = nameof(MoveDown);
|
||||
|
||||
internal class DisableButtonCell : AccessibleDataGridViewButtonCell
|
||||
|
|
@ -76,10 +69,11 @@ namespace LibationWinForms.Dialogs
|
|||
return;
|
||||
|
||||
foreach (var filter in filters)
|
||||
dataGridView1.Rows.Add(filter, "X", filter, BLACK_UP_POINTING_TRIANGLE, BLACK_DOWN_POINTING_TRIANGLE);
|
||||
}
|
||||
dataGridView1.Rows.Add(filter.Filter, "X", filter.Name, filter.Filter, BLACK_UP_POINTING_TRIANGLE, BLACK_DOWN_POINTING_TRIANGLE);
|
||||
//dataGridView1.Rows.Add(filter, "X", filter, BLACK_UP_POINTING_TRIANGLE, BLACK_DOWN_POINTING_TRIANGLE);
|
||||
}
|
||||
|
||||
private void dataGridView1_DefaultValuesNeeded(object sender, DataGridViewRowEventArgs e)
|
||||
private void dataGridView1_DefaultValuesNeeded(object sender, DataGridViewRowEventArgs e)
|
||||
{
|
||||
e.Row.Cells[COL_Delete].Value = "X";
|
||||
e.Row.Cells[COL_MoveUp].Value = BLACK_UP_POINTING_TRIANGLE;
|
||||
|
|
@ -90,7 +84,9 @@ namespace LibationWinForms.Dialogs
|
|||
{
|
||||
var list = dataGridView1.Rows
|
||||
.OfType<DataGridViewRow>()
|
||||
.Select(r => r.Cells[COL_Filter].Value?.ToString())
|
||||
.Select(r => new QuickFilters.NamedFilter(
|
||||
r.Cells[COL_Filter].Value?.ToString(),
|
||||
r.Cells[COL_FilterName].Value?.ToString()))
|
||||
.ToList();
|
||||
QuickFilters.ReplaceAll(list);
|
||||
|
||||
|
|
@ -137,4 +133,12 @@ namespace LibationWinForms.Dialogs
|
|||
}
|
||||
}
|
||||
}
|
||||
public class DisableButtonColumn : DataGridViewButtonColumn
|
||||
{
|
||||
public DisableButtonColumn()
|
||||
{
|
||||
CellTemplate = new EditQuickFilters.DisableButtonCell();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,64 @@
|
|||
<?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">
|
||||
|
|
@ -61,16 +120,10 @@
|
|||
<metadata name="Original.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="Delete.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<metadata name="FilterName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="Filter.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="MoveUp.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="MoveDown.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
</root>
|
||||
Loading…
Add table
Add a link
Reference in a new issue