Skip to content

Commit b34ff53

Browse files
committed
Save filtered column
1 parent fb8fde3 commit b34ff53

File tree

3 files changed

+43
-9
lines changed

3 files changed

+43
-9
lines changed

NX_Game_Info/Common.cs

+8
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,14 @@ public Size WindowSize
8888
set { this["WindowSize"] = value; }
8989
}
9090

91+
[UserScopedSetting()]
92+
[DefaultSettingValue("")]
93+
public List<string> Columns
94+
{
95+
get { return (List<string>)this["Columns"]; }
96+
set { this["Columns"] = value; }
97+
}
98+
9199
[UserScopedSetting()]
92100
[DefaultSettingValue("")]
93101
public List<int> ColumnWidth

Windows/Main.Designer.cs

+7-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Windows/Main.cs

+28-6
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,6 @@ public Main()
5959
{
6060
Environment.Exit(-1);
6161
}
62-
63-
titles = Process.processHistory();
64-
65-
reloadData();
66-
67-
toolStripStatusLabel.Text = String.Format("{0} files", titles.Count);
6862
}
6963

7064
public void reloadData()
@@ -119,6 +113,8 @@ public void saveWindowState()
119113
Common.Settings.Default.WindowSize = RestoreBounds.Size;
120114
}
121115

116+
Common.Settings.Default.Columns = objectListView.ColumnsInDisplayOrder.Select(x => x.AspectName).ToList();
117+
122118
List<int> columnWidth = new List<int>();
123119
foreach (ColumnHeader column in objectListView.Columns)
124120
{
@@ -134,10 +130,28 @@ private void Main_Load(object sender, EventArgs e)
134130
Location = Common.Settings.Default.WindowLocation;
135131
Size = Common.Settings.Default.WindowSize;
136132

133+
if (Common.Settings.Default.Columns.Any())
134+
{
135+
foreach (var column in objectListView.AllColumns)
136+
{
137+
if (!Common.Settings.Default.Columns.Union(new List<string> { "titleID", "titleName", "error" }).ToList().Contains(column.AspectName))
138+
{
139+
column.IsVisible = false;
140+
}
141+
}
142+
objectListView.RebuildColumns();
143+
}
144+
137145
foreach (var column in objectListView.Columns.Cast<ColumnHeader>().Zip(Common.Settings.Default.ColumnWidth, Tuple.Create))
138146
{
139147
column.Item1.Width = column.Item2;
140148
}
149+
150+
titles = Process.processHistory();
151+
152+
reloadData();
153+
154+
toolStripStatusLabel.Text = String.Format("{0} files", titles.Count);
141155
}
142156

143157
private void Main_FormClosing(object sender, FormClosingEventArgs e)
@@ -402,6 +416,14 @@ private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
402416
aboutBox.Show();
403417
}
404418

419+
private void objectListView_Freezing(object sender, FreezeEventArgs e)
420+
{
421+
if (e.FreezeLevel == 0)
422+
{
423+
reloadData();
424+
}
425+
}
426+
405427
private void backgroundWorkerProcess_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
406428
{
407429
BackgroundWorker worker = sender as BackgroundWorker;

0 commit comments

Comments
 (0)