public PhotoStream(string title, string url) { this.Title = title; this.PhotoStreamUrl = url; StreamPhotos = new IncrementalSource<RootObject, Photo>(PhotoStreamUrl, RootObjectResponse); DataLoaded = new ManualResetEvent(false); LoadPhotos(); }
private async void OnItemsSourceChanged(DependencyObject sender, DependencyProperty dp) { if (IncrementalSource != null && IncrementalSource.HasMoreItems && !_isAlreadyLoading) { _isAlreadyLoading = true; await IncrementalSource.LoadMoreItemsAsync(0); _isAlreadyLoading = false; } }
public PhotoStream(string title) { this.Title = title; this.PhotoStreamUrl = AppSettings.PhotosUrl + "?feature=" + AppSettings.Streams[title] + "&consumer_key=" + AppSettings.ConsumerKey + "&rpp={0}" + "&image_size[]=3&image_size[]=4" + "&exclude=Nude"; if (!string.IsNullOrEmpty( AppSettings.SelectedCategory) && AppSettings.SelectedCategory != "All") { this.PhotoStreamUrl += "&only=" + AppSettings.SelectedCategory; } StreamPhotos = new IncrementalSource<RootObject, Photo>(PhotoStreamUrl, RootObjectResponse); DataLoaded = new ManualResetEvent(false); LoadPhotos(); }
private async void OnViewChanged(object sender, ScrollViewerViewChangedEventArgs e) { if (ScrollingHost.VerticalOffset / ScrollingHost.ScrollableHeight >= 0.9) { if (IncrementalSource != null && IncrementalSource.HasMoreItems && !_isAlreadyLoading && !e.IsIntermediate) { _isAlreadyLoading = true; await IncrementalSource.LoadMoreItemsAsync(0); _isAlreadyLoading = false; } } }
private async void Panel_SizeChanged(object sender, SizeChangedEventArgs e) { if (ScrollingHost.ScrollableHeight < 120) { if (IncrementalSource != null && IncrementalSource.HasMoreItems && !_isAlreadyLoading) { _isAlreadyLoading = true; await IncrementalSource.LoadMoreItemsAsync(0); _isAlreadyLoading = false; } } }
private async void OnLoaded(object sender, RoutedEventArgs e) { var panel = ItemsPanelRoot as ItemsStackPanel; if (panel != null) { ItemsStack = panel; ItemsStack.SizeChanged += Panel_SizeChanged; } if (IncrementalSource != null && IncrementalSource.HasMoreItems && !_isAlreadyLoading) { _isAlreadyLoading = true; await IncrementalSource.LoadMoreItemsAsync(0); _isAlreadyLoading = false; } }
protected override void OnNavigatedTo(Windows.UI.Xaml.Navigation.NavigationEventArgs e) { base.OnNavigatedTo(e); ListModel = new IncrementalSource<NhapHangModel>(ViewModel); ListViewNhapHang.ItemsSource = ListModel; }
protected override void LoadDataToList() { ListModel = new IncrementalSource<BanLeModel>(ViewModel); ListViewBanLe.ItemsSource = ListModel; }
private async void LoadComments() { if (commentsDetails.Visibility == Windows.UI.Xaml.Visibility.Collapsed) { return; } if (commentsList.ItemsSource == null) { progressRing.Visibility = Visibility.Visible; progressRing.IsActive = true; var commentsUrl = AppSettings.BaseUrl + "photos/" + currentItem.id + "/comments?consumer_key=" + AppSettings.ConsumerKey; IncrementalSource<CommentDetails, Comment> paged = new IncrementalSource<CommentDetails, Comment>(commentsUrl, CommentDetailsResponse); commentsList.ItemsSource = paged; await paged.LoadMoreItemsAsync(1); progressRing.Visibility = Visibility.Collapsed; progressRing.IsActive = false; } }