Skip to content
Permalink
Browse files

Improve item selection and logo downloading when filtering

Fixes #107
  • Loading branch information...
xPaw committed May 25, 2019
1 parent 5953dd3 commit 73339439bc015758d697338a7627e7cebcce280e
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 7333943

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