Skip to content

Commit

Permalink
Don't clear possible game names before adding new entries
Browse files Browse the repository at this point in the history
Safer drop down open override
  • Loading branch information
laurencee committed Feb 11, 2017
1 parent 192789f commit c803b72
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Livestream.Monitor/ViewModels/TopStreamsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,8 @@ public void DropDownOpened(object sender)
{
var comboBox = sender as ComboBox;
if (comboBox?.Text == null) return;
TextBox textBox = (TextBox)(comboBox).Template.FindName("PART_EditableTextBox", (ComboBox)sender);
TextBox textBox = comboBox.Template.FindName("PART_EditableTextBox", comboBox) as TextBox;
if (textBox == null) return;
textBox.SelectionStart = comboBox.Text.Length;
textBox.SelectionLength = 0;
}
Expand Down Expand Up @@ -351,8 +352,9 @@ private async void UpdatePossibleGameNames()
try
{
var games = await SelectedApiClient.GetKnownGameNames(game);
PossibleGameNames.Clear();
var oldItems = PossibleGameNames.ToList();
PossibleGameNames.AddRange(games.Select(x => x.GameName));
PossibleGameNames.RemoveRange(oldItems);
ExpandPossibleGames = true;
}
catch
Expand Down

0 comments on commit c803b72

Please sign in to comment.