Revert "Merged 'Filter Games and Achievements' from lieberung"

This reverts commit d6015f1ed8.
This commit is contained in:
JDM170
2020-03-04 15:56:03 +07:00
parent d6015f1ed8
commit ef90eb331f
4 changed files with 14 additions and 166 deletions

View File

@@ -29,6 +29,7 @@
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Windows.Forms.ToolStripSeparator _ToolStripSeparator1;
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Manager));
this._MainToolStrip = new System.Windows.Forms.ToolStrip();
this._StoreButton = new System.Windows.Forms.ToolStripButton();
@@ -52,13 +53,7 @@
this._StatisticsTabPage = new System.Windows.Forms.TabPage();
this._EnableStatsEditingCheckBox = new System.Windows.Forms.CheckBox();
this._StatisticsDataGridView = new System.Windows.Forms.DataGridView();
this._ToolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this._DisplayLabel = new System.Windows.Forms.ToolStripLabel();
this._DisplayUnlockedOnlyButton = new System.Windows.Forms.ToolStripButton();
this._DisplayLockedOnlyButton = new System.Windows.Forms.ToolStripButton();
this._MatchingStringLabel = new System.Windows.Forms.ToolStripLabel();
this._MatchingStringTextBox = new System.Windows.Forms.ToolStripTextBox();
this._ToolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
_ToolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this._MainToolStrip.SuspendLayout();
this._MainStatusStrip.SuspendLayout();
this._MainTabControl.SuspendLayout();
@@ -224,16 +219,9 @@
// _AchievementsToolStrip
//
this._AchievementsToolStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this._LockAllButton,
this._InvertAllButton,
this._UnlockAllButton,
this._ToolStripSeparator1,
this._DisplayLabel,
this._DisplayLockedOnlyButton,
this._DisplayUnlockedOnlyButton,
this._ToolStripSeparator2,
this._MatchingStringLabel,
this._MatchingStringTextBox});
this._LockAllButton,
this._InvertAllButton,
this._UnlockAllButton});
this._AchievementsToolStrip.Location = new System.Drawing.Point(3, 3);
this._AchievementsToolStrip.Name = "_AchievementsToolStrip";
this._AchievementsToolStrip.Size = new System.Drawing.Size(602, 25);
@@ -313,54 +301,6 @@
this._StatisticsDataGridView.CellEndEdit += new System.Windows.Forms.DataGridViewCellEventHandler(this.OnStatCellEndEdit);
this._StatisticsDataGridView.DataError += new System.Windows.Forms.DataGridViewDataErrorEventHandler(this.OnStatDataError);
//
// toolStripSeparator2
//
this._ToolStripSeparator2.Name = "_ToolStripSeparator2";
this._ToolStripSeparator2.Size = new System.Drawing.Size(6, 25);
//
// DisplayLabel
//
this._DisplayLabel.Font = new System.Drawing.Font("Segoe UI", 9F);
this._DisplayLabel.Name = "_DisplayLabel";
this._DisplayLabel.Size = new System.Drawing.Size(62, 22);
this._DisplayLabel.Text = "Show only";
//
// _DisplayUnlockedOnlyButton
//
this._DisplayUnlockedOnlyButton.CheckOnClick = true;
this._DisplayUnlockedOnlyButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this._DisplayUnlockedOnlyButton.Image = ((System.Drawing.Image)(resources.GetObject("_DisplayUnlockedOnlyButton.Image")));
this._DisplayUnlockedOnlyButton.ImageTransparentColor = System.Drawing.Color.Magenta;
this._DisplayUnlockedOnlyButton.Name = "_DisplayUnlockedOnlyButton";
this._DisplayUnlockedOnlyButton.Size = new System.Drawing.Size(60, 22);
this._DisplayUnlockedOnlyButton.Text = "unlocked";
this._DisplayUnlockedOnlyButton.Click += new System.EventHandler(this._DisplayUncheckedOnlyButton_Click);
//
// _DisplayLockedOnlyButton
//
this._DisplayLockedOnlyButton.CheckOnClick = true;
this._DisplayLockedOnlyButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this._DisplayLockedOnlyButton.Image = ((System.Drawing.Image)(resources.GetObject("_DisplayLockedOnlyButton.Image")));
this._DisplayLockedOnlyButton.ImageTransparentColor = System.Drawing.Color.Magenta;
this._DisplayLockedOnlyButton.Name = "_DisplayLockedOnlyButton";
this._DisplayLockedOnlyButton.Size = new System.Drawing.Size(46, 22);
this._DisplayLockedOnlyButton.Text = "locked";
this._DisplayLockedOnlyButton.Click += new System.EventHandler(this._DisplayCheckedOnlyButton_Click);
//
// MatchingStringLabel
//
this._MatchingStringLabel.Font = new System.Drawing.Font("Segoe UI", 9F);
this._MatchingStringLabel.Name = "_MatchingStringLabel";
this._MatchingStringLabel.Size = new System.Drawing.Size(33, 22);
this._MatchingStringLabel.Text = "Filter";
//
// _MatchingStringTextBox
//
this._MatchingStringTextBox.Name = "_MatchingStringTextBox";
this._MatchingStringTextBox.Size = new System.Drawing.Size(100, 25);
this._MatchingStringTextBox.ToolTipText = "Type at least 3 characters that must appear in the name or description";
this._MatchingStringTextBox.KeyUp += new System.Windows.Forms.KeyEventHandler(this.OnFilterUpdate);
//
// Manager
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -414,12 +354,6 @@
public System.Windows.Forms.CheckBox _EnableStatsEditingCheckBox;
private System.Windows.Forms.ToolStripButton _ResetButton;
private System.Windows.Forms.ToolStripStatusLabel _DownloadStatusLabel;
private System.Windows.Forms.ToolStripSeparator _ToolStripSeparator1;
private System.Windows.Forms.ToolStripLabel _DisplayLabel;
private System.Windows.Forms.ToolStripButton _DisplayUnlockedOnlyButton;
private System.Windows.Forms.ToolStripButton _DisplayLockedOnlyButton;
private System.Windows.Forms.ToolStripLabel _MatchingStringLabel;
private System.Windows.Forms.ToolStripTextBox _MatchingStringTextBox;
private System.Windows.Forms.ToolStripSeparator _ToolStripSeparator2;
}
}
}

View File

@@ -449,10 +449,6 @@ namespace SAM.Game
continue;
}
if (!this.IsMatchingSearchAndDisplaySettings(isAchieved, def.Name, def.Description))
{
continue;
}
var info = new Stats.AchievementInfo()
{
Id = def.Id,
@@ -864,57 +860,6 @@ namespace SAM.Game
MessageBoxIcon.Error);
e.NewValue = e.CurrentValue;
}
}
private bool IsMatchingSearchAndDisplaySettings(bool isLocked, string achievementName, string achievementDesc)
{
// display locked, unlocked or both
bool lockStateMatch = (!_DisplayLockedOnlyButton.Checked && !_DisplayUnlockedOnlyButton.Checked) ||
(_DisplayLockedOnlyButton.Checked && isLocked) ||
(_DisplayUnlockedOnlyButton.Checked && !isLocked);
// text filter on name / description
bool findTxtMatch = true;
if (lockStateMatch)
{
string searchString = _MatchingStringTextBox.Text.ToLowerInvariant();
findTxtMatch = String.IsNullOrEmpty(searchString) || achievementName.ToLowerInvariant().Contains(searchString) || achievementDesc.ToLowerInvariant().Contains(searchString);
}
return lockStateMatch && findTxtMatch;
}
private void _DisplayUncheckedOnlyButton_Click(object sender, EventArgs e)
{
if ((sender as ToolStripButton).Checked)
{
_DisplayLockedOnlyButton.Checked = false;
_DisplayUnlockedOnlyButton.ForeColor = Color.Blue;
_DisplayLockedOnlyButton.ForeColor = Color.Black;
}
else
{
_DisplayUnlockedOnlyButton.ForeColor = Color.Black;
}
this.GetAchievements();
}
private void _DisplayCheckedOnlyButton_Click(object sender, EventArgs e)
{
if ((sender as ToolStripButton).Checked)
{
_DisplayUnlockedOnlyButton.Checked = false;
_DisplayLockedOnlyButton.ForeColor = Color.Blue;
_DisplayUnlockedOnlyButton.ForeColor = Color.Black;
}
else
{
_DisplayLockedOnlyButton.ForeColor = Color.Black;
}
this.GetAchievements();
}
private void OnFilterUpdate(object sender, KeyEventArgs e)
{
this.GetAchievements();
}
}
}

View File

@@ -51,9 +51,6 @@
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();
@@ -68,23 +65,6 @@
_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;
@@ -99,15 +79,12 @@
// _PickerToolStrip
//
this._PickerToolStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this._RefreshGamesButton,
this._ToolStripSeparator1,
this._AddGameTextBox,
this._AddGameButton,
this._ToolStripSeparator2,
this._FilterDropDownButton,
this._ToolStripSeparator3,
this._FindGamesLabel,
this._SearchGameTextBox});
this._RefreshGamesButton,
_ToolStripSeparator1,
this._AddGameTextBox,
this._AddGameButton,
_ToolStripSeparator2,
this._FilterDropDownButton});
this._PickerToolStrip.Location = new System.Drawing.Point(0, 0);
this._PickerToolStrip.Name = "_PickerToolStrip";
this._PickerToolStrip.Size = new System.Drawing.Size(742, 25);
@@ -283,8 +260,6 @@
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,11 +136,6 @@ 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;
@@ -460,7 +455,6 @@ 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)
}
}
}