private async void SearchBox_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args) { if (HomeViewModel.BrowsePosts == null) { var s = new ImageWallRows <Post>(); try { this.HomeViewModel.Posts = await Posts.DownloadPostsAsync(1, $"https://yande.re/post.xml?tags={WebUtility.UrlEncode(SearchBox.Text)}"); } catch (Exception ex) { } s.ItemsSource = new FilteredCollection <Post, Posts>(this.HomeViewModel.Posts, this.HomeViewModel.SearchPostFilter); HomeViewModel.BrowsePosts = s; } else { try { this.HomeViewModel.Posts = await Posts.DownloadPostsAsync(1, $"https://yande.re/post.xml?tags={WebUtility.UrlEncode(SearchBox.Text)}"); } catch (Exception ex) { } HomeViewModel.BrowsePosts.ItemsSource = new FilteredCollection <Post, Posts>(this.HomeViewModel.Posts, this.HomeViewModel.SearchPostFilter); } }
public async Task Load() { var gList = await ExGalleryList.DownloadGalleryListAsync(0, $"http://exhentai.org/?f_search={ WebUtility.UrlEncode(Key)}&{SearchConfig.ToString()}"); //(this.GalleryList as ImageWallRows<ExGallery>).RowWidth = BrowseWall.ActualWidth - BrowseWall.Padding.Left - BrowseWall.Padding.Right; //(this.GalleryList as ImageWallRows<ExGallery>).RowHeight = BrowseWall.ActualWidth > 500 ? 300 : 150; var s = new ImageWallRows <ExGallery>(); s.ItemsSource = new FilteredCollection <ExGallery, ExGalleryList>(gList, this.GalleryFilter); this.GalleryList = s; }
private async void FavoriteRefreshButton_Click(object sender, RoutedEventArgs e) { if (YandeSettings.Current.UserName != "") { Posts favoritePost = null; try { favoritePost = await Posts.DownloadPostsAsync(1, $"https://yande.re/post.xml?tags=vote:3:{YandeSettings.Current.UserName}+order:vote"); } catch (Exception ex) { return; } var f = new ImageWallRows <Post>(); f.ItemsSource = new FilteredCollection <Post, Posts>(favoritePost, this.HomeViewModel.SearchPostFilter); FavoriteWall.DataContext = f; } }
private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e) { try { if (GalleryViewModel.Gallery == null || GalleryViewModel.Gallery.Count == 0 || (e.NavigationParameter as string) != GalleryViewModel.Gallery?.Link) { this.GalleryViewModel.Gallery = await ExGallery.DownloadGalleryAsync(e.NavigationParameter as string, 1, 3); var f = new ImageWallRows <ExGalleryImageListItem>(); f.ItemsSource = this.GalleryViewModel.Gallery; this.GalleryViewModel.GalleryImages = f; //GalleryWall.DataContext = f; } } catch (Exception ex) { var x = ex.GetType(); } }
private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e) { bool ResumingExistingPage = e.PageState != null && e.PageState.ContainsKey("Tags"); if (ResumingExistingPage) { // Re-search the tags if needed if (SearchBox.Text != e.PageState["Tags"] as string) { SearchBox.Text = e.PageState["Tags"] as string; FlipView.SelectedIndex = (int)(e.PageState["Tab"]); try { this.HomeViewModel.Posts = await Posts.DownloadPostsAsync(1, $"https://yande.re/post.xml?tags={WebUtility.UrlEncode(SearchBox.Text)}"); } catch (Exception ex) { this.HomeViewModel.Posts = new Posts(); } if (HomeViewModel.BrowsePosts == null) { var s = new ImageWallRows <Post>(); s.ItemsSource = new FilteredCollection <Post, Posts>(this.HomeViewModel.Posts, this.HomeViewModel.SearchPostFilter); HomeViewModel.BrowsePosts = s; } else { HomeViewModel.BrowsePosts.ItemsSource = new FilteredCollection <Post, Posts>(this.HomeViewModel.Posts, this.HomeViewModel.SearchPostFilter); } } } else // Newly entered a page { if (!String.IsNullOrEmpty(e.NavigationParameter as string)) { // Turn to the searching selection this.HomeViewModel.SelectedViewIndex = 1; } SearchBox.Text = e.NavigationParameter as string; try { this.HomeViewModel.Posts = await Posts.DownloadPostsAsync(1, $"https://yande.re/post.xml?tags={WebUtility.UrlEncode(SearchBox.Text)}"); } catch (Exception ex) { this.HomeViewModel.Posts = new Posts(); } var s = new ImageWallRows <Post>(); s.ItemsSource = new FilteredCollection <Post, Posts>(this.HomeViewModel.Posts, this.HomeViewModel.SearchPostFilter); HomeViewModel.BrowsePosts = s; } if (YandeSettings.Current.IsLoggedIn) { Posts favoritePost = new Posts(); try { favoritePost = await Posts.DownloadPostsAsync(1, $"https://yande.re/post.xml?tags=vote:3:{YandeSettings.Current.UserName}+order:vote"); } catch (Exception ex) { } var f = new ImageWallRows <Post>(); f.ItemsSource = new FilteredCollection <Post, Posts>(favoritePost, this.HomeViewModel.SearchPostFilter); FavoriteWall.DataContext = f; } }