Merged 'Filter Games and Achievements' from lieberung

https://github.com/gibbed/SteamAchievementManager/pull/133
This commit is contained in:
JDM170
2020-03-04 15:33:59 +07:00
parent 4fc57c7bcc
commit d6015f1ed8
4 changed files with 166 additions and 14 deletions

View File

@@ -51,6 +51,9 @@
this._ListWorker = new System.ComponentModel.BackgroundWorker();
_ToolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
_ToolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this._ToolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
this._FindGamesLabel = new System.Windows.Forms.ToolStripLabel();
this._SearchGameTextBox = new System.Windows.Forms.ToolStripTextBox();
this._PickerToolStrip.SuspendLayout();
this._PickerStatusStrip.SuspendLayout();
this.SuspendLayout();
@@ -65,6 +68,23 @@
_ToolStripSeparator2.Name = "_ToolStripSeparator2";
_ToolStripSeparator2.Size = new System.Drawing.Size(6, 25);
//
// _ToolStripSeparator3
//
this._ToolStripSeparator3.Name = "_ToolStripSeparator3";
this._ToolStripSeparator3.Size = new System.Drawing.Size(6, 25);
//
// _FindGamesLabel
//
this._FindGamesLabel.Name = "_FindGamesLabel";
this._FindGamesLabel.Size = new System.Drawing.Size(33, 22);
this._FindGamesLabel.Text = "Filter";
//
// _SearchGameTextBox
//
this._SearchGameTextBox.Name = "_SearchGameTextBox";
this._SearchGameTextBox.Size = new System.Drawing.Size(100, 25);
this._SearchGameTextBox.KeyUp += new System.Windows.Forms.KeyEventHandler(this.OnFilterUpdate);
//
// _LogoImageList
//
this._LogoImageList.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;
@@ -79,12 +99,15 @@
// _PickerToolStrip
//
this._PickerToolStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this._RefreshGamesButton,
_ToolStripSeparator1,
this._AddGameTextBox,
this._AddGameButton,
_ToolStripSeparator2,
this._FilterDropDownButton});
this._RefreshGamesButton,
this._ToolStripSeparator1,
this._AddGameTextBox,
this._AddGameButton,
this._ToolStripSeparator2,
this._FilterDropDownButton,
this._ToolStripSeparator3,
this._FindGamesLabel,
this._SearchGameTextBox});
this._PickerToolStrip.Location = new System.Drawing.Point(0, 0);
this._PickerToolStrip.Name = "_PickerToolStrip";
this._PickerToolStrip.Size = new System.Drawing.Size(742, 25);
@@ -260,6 +283,8 @@
private System.Windows.Forms.ToolStripStatusLabel _PickerStatusLabel;
private System.ComponentModel.BackgroundWorker _LogoWorker;
private System.ComponentModel.BackgroundWorker _ListWorker;
private System.Windows.Forms.ToolStripTextBox _SearchGameTextBox;
private System.Windows.Forms.ToolStripLabel _FindGamesLabel;
private System.Windows.Forms.ToolStripSeparator _ToolStripSeparator3;
}
}

View File

@@ -136,6 +136,11 @@ namespace SAM.Picker
this._FilteredGames.Clear();
foreach (var info in this._Games.Values.OrderBy(gi => gi.Name))
{
if (_SearchGameTextBox.Text.Length != 0 &&
!info.Name.ToLowerInvariant().Contains(_SearchGameTextBox.Text.ToLowerInvariant()))
{
continue;
}
if (info.Type == "normal" && _FilterGamesMenuItem.Checked == false)
{
continue;
@@ -455,6 +460,7 @@ namespace SAM.Picker
private void OnFilterUpdate(object sender, EventArgs e)
{
this.RefreshGames();
this._SearchGameTextBox.Focus(); // Compatibility with _GameListView SearchForVirtualItemEventHandler (otherwise _SearchGameTextBox loose focus on KeyUp)
}
}
}