protected async override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); if (e.Parameter != null) { string lcGenreName = e.Parameter.ToString(); _Genre = await ServiceClient.GetGenreAsync(lcGenreName); updateDisplay(); } else { Frame.GoBack(); } }
private async void updateDisplay() { _Genre = await ServiceClient.GetGenreAsync(_Genre.genreName); int lcSelectedIndex = 0; if (lstBooks.SelectedIndex != -1) { lcSelectedIndex = lstBooks.SelectedIndex; } lstBooks.ItemsSource = null; if (_Genre.BooksList.Count != 0) { _Genre.BooksList.Sort(_Comparer); lstBooks.ItemsSource = _Genre.BooksList; } else { lstBooks.Items.Add("No Books Avaliable."); } txtbGenre.Text = _Genre.genreName; if (lcSelectedIndex != 0) { try { lstBooks.SelectedIndex = lcSelectedIndex; } catch { lstBooks.SelectedIndex = 0; } } else { lstBooks.SelectedIndex = 0; } }