Skip to content
Permalink
Browse files

Merge pull request #111 from xPaw/patch-2

Improve item selection and logo downloading when filtering.
  • Loading branch information...
gibbed committed May 27, 2019
2 parents 5953dd3 + 7333943 commit 41cb108b1a3df02012f1cf427726acd332665682
Showing with 15 additions and 13 deletions.
  1. +15 −13 SAM.Picker/GamePicker.cs
@@ -134,6 +134,7 @@ private void OnDownloadList(object sender, RunWorkerCompletedEventArgs e)

private void RefreshGames()
{
this._SelectedGameIndex = -1;
this._FilteredGames.Clear();
foreach (var info in this._Games.Values.OrderBy(gi => gi.Name))
{
@@ -163,6 +164,12 @@ private void RefreshGames()
"Displaying {0} games. Total {1} games.",
this._GameListView.Items.Count,
this._Games.Count);

if (this._GameListView.Items.Count > 0)
{
this._GameListView.Items[0].Selected = true;
this._GameListView.Select();
}
}

private void OnGameListViewRetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e)
@@ -360,23 +367,11 @@ private void OnTimer(object sender, EventArgs e)

private void OnSelectGame(object sender, ListViewItemSelectionChangedEventArgs e)
{
if (e.IsSelected == true && e.ItemIndex != this._SelectedGameIndex)
{
this._SelectedGameIndex = e.ItemIndex;
}
else if (e.IsSelected == true && e.ItemIndex == this._SelectedGameIndex)
{
this._SelectedGameIndex = -1;
}
this._SelectedGameIndex = e.ItemIndex;
}

private void OnActivateGame(object sender, EventArgs e)
{
if (this._SelectedGameIndex < 0)
{
return;
}

var index = this._SelectedGameIndex;
if (index < 0 || index >= this._FilteredGames.Count)
{
@@ -431,6 +426,13 @@ private void OnAddGame(object sender, EventArgs e)
return;
}

while (this._LogoQueue.TryDequeue(out var logo))
{
// clear the download queue because we will be showing only one app
// TODO: https://github.com/gibbed/SteamAchievementManager/issues/106
this._LogosAttempted.Remove(logo.Logo);
}

this._AddGameTextBox.Text = "";
this._Games.Clear();
this.AddGame(id, "normal");

0 comments on commit 41cb108

Please sign in to comment.
You can’t perform that action at this time.