public async void LoadImages() { Wallpapers = WallaperApi.GetRandomWalls().wallpapers; foreach (var z in Wallpapers) { Listv.Items.Add(z); } }
private void search() { Listv.Items.Clear(); GC.Collect(); if (SearchDatatTextBox.Text.Trim().Length > 0) { try { var SearchData = WallaperApi.GetSeach(term: SearchDatatTextBox.Text, page, int.Parse(widthTextbox.Text), int.Parse(HeightTextBox.Text)); if (SearchData.wallpapers != null) { PageCounter.Text = page.ToString(); foreach (var z in SearchData.wallpapers) { Listv.Items.Add(z); } var tempTcheck = WallaperApi.GetSeach(term: SearchDatatTextBox.Text, page + 1, int.Parse(widthTextbox.Text), int.Parse(HeightTextBox.Text)); PageCounter.Visibility = Visibility.Visible; if (page == 1) { PrevPageButton.Visibility = Visibility.Collapsed; } if (tempTcheck.wallpapers == null) { NextPageButton.Visibility = Visibility.Collapsed; } if (tempTcheck.wallpapers != null & page > 1) { PrevPageButton.Visibility = Visibility.Visible; } if (tempTcheck.wallpapers != null & page == 1) { NextPageButton.Visibility = Visibility.Visible; } if (tempTcheck.wallpapers == null & page == 1) { PageCounter.Visibility = Visibility.Collapsed; } } else { Console.WriteLine("null count"); if (page == 1) { NextPageButton.Visibility = Visibility.Collapsed; PrevPageButton.Visibility = Visibility.Collapsed; PageCounter.Visibility = Visibility.Collapsed; } } } catch (Exception ex) { } } }