private async void songsView_ItemRealized(object sender, ItemRealizationEventArgs e) { if (e.ItemKind == LongListSelectorItemKind.ListFooter) { await App.ArtistVM.LoadMoreTrackAsync(); } }
private void ControlOnItemRealized(object sender, ItemRealizationEventArgs e) { var itemContent = e.Container.Content as Cell; if (itemContent == null) throw new Exception("You have to use a Cell for the ExtendedListview.ItemTemplate DataTemplate"); var item = itemContent.BindingContext; var items = FormsControl.ItemsSource as IList; if(items == null) throw new Exception("ExtendedListview ItemsSource has to be IList"); var currentItemIndex = items.IndexOf(item); if ((items.Count - currentItemIndex <= FormsControl.Offset) && (FormsControl.LoadMoreCommand != null) && (FormsControl.LoadMoreCommand.CanExecute(null))) { _pageNumber = _pageNumber + 1; FormsControl.LoadMoreCommand.Execute(new LoadMoreQuery { PageNumber = _pageNumber, PageSize = FormsControl.PageSize }); } }
private async void TopListSelector_ItemRealized(object sender, ItemRealizationEventArgs e) { var list = (LongListSelector)sender; var group = (TopListViewModel)list.DataContext; if (!group.IsLoading && list.ItemsSource != null && list.ItemsSource.Count >= offsetKnob) { if (e.ItemKind == LongListSelectorItemKind.Item) { if ((e.Container.Content as IndexedBoardGame).Equals(list.ItemsSource[list.ItemsSource.Count - offsetKnob])) { Console.WriteLine(String.Format("Searching for {0}", offsetKnob)); try { await group.LoadPage(); } catch (Exception ex) { Console.WriteLine(ex); //var errorBox = Utility.DisplayExceptionCustomMessageBox(ex); //errorBox.Show(); } } } } }
private void LongListSelector_OnItemRealized(object sender, ItemRealizationEventArgs e) { if (((dynamic)DataContext).IsLoading) { return; } var longListSelector = (LongListSelector)sender; var multas = (ObservableCollection <Multa>)longListSelector.ItemsSource; if (multas == null) { return; } if (!realized.ContainsKey(longListSelector)) { realized.Add(longListSelector, -1); } realized[longListSelector]++; var numeroDeMultasCarregadas = multas.Count; //Debug.WriteLine("Realized: " + realized[longListSelector]); if (numeroDeMultasCarregadas < carregarQuandoFaltaremXMultas) {//se tem menos itens do que o minimo pra paginar, então acabaram os itens, retorna return; } var multaAtual = (Multa)e.Container.Content; var posicaoDaMultaCarregadaAgora = multas.IndexOf(multaAtual); Debug.WriteLine("posicao sendo carregada: {0}, numero de multas carregas: {1}", posicaoDaMultaCarregadaAgora, numeroDeMultasCarregadas); if (numeroDeMultasCarregadas - posicaoDaMultaCarregadaAgora < carregarQuandoFaltaremXMultas) { var grupoDeMultas = (GrupoDeMultas)longListSelector.DataContext; ((dynamic)DataContext).CarregarMultas(grupoDeMultas); } }
private void NewListBox_OnItemRealized(object sender, ItemRealizationEventArgs e) { var listBox = sender as LongListSelector; if (listBox == null) { return; } var items = listBox.ItemsSource as ObservableCollection <Pattern>; if (items == null) { return; } var currentItem = e.Container.Content as Pattern; if (currentItem == null) { return; } NewestViewModel viewModel = ((PatternGroupViewModel)ViewModel).Newest; if (currentItem.Equals(viewModel.Items.Last())) { int offset = viewModel.Items.Count; viewModel.Load(offset); } }
private void FadingLongListSelector_ItemRealized(object sender, ItemRealizationEventArgs e) { if (e.ItemKind == LongListSelectorItemKind.Item && ItemsSource != null && ItemsSource.Count < FadeLimit) { int index = ItemsSource.IndexOf(e.Container.DataContext); if (index < 0 || index > FadeLimit) { return; } DoubleAnimation da = new DoubleAnimation() { From = 0, To = 1, Duration = TimeSpan.FromMilliseconds(500), EasingFunction = Easing }; Storyboard.SetTargetProperty(da, new PropertyPath(FrameworkElement.OpacityProperty)); Storyboard.SetTarget(da, e.Container); Storyboard sb = new Storyboard(); sb.Children.Add(da); sb.Begin(); } }
private void LLS_EndOfList(object sender, ItemRealizationEventArgs e) { if (e.ItemKind != LongListSelectorItemKind.Item) { return; } var day = e.Container.Content as Day; if (day == null) { return; } if (App.ViewModel.IsCurrentlyLoading) { return; } const int offset = 10; if (App.ViewModel.Days.Count - App.ViewModel.Days.IndexOf(day) <= offset) { App.ViewModel.LoadIncrementalForward(7, DateTime.Now.Ticks); } }
void subbedList_ItemRealized(object sender, ItemRealizationEventArgs e) { subbedListLastItem = e.Container.Content; var linksView = sender as FixedLongListSelector; if (linksView.ItemsSource != null && linksView.ItemsSource.Count >= _offsetKnob) { if (e.ItemKind == LongListSelectorItemKind.Item) { if ((e.Container.Content).Equals(linksView.ItemsSource[linksView.ItemsSource.Count - _offsetKnob])) { var viewModel = DataContext as MainPageViewModel; if (viewModel != null && viewModel.SubscribedSubreddits.HasMoreItems) { viewModel.SubscribedSubreddits.LoadMoreItemsAsync(30); } } } } var subredditVM = subbedListLastItem as AboutSubredditViewModel; if (subredditVM != null) { var mainPageVM = this.DataContext as MainPageViewModel; var match = mainPageVM.Subreddits.FirstOrDefault<TypedThing<Subreddit>>(thing => thing.Data.DisplayName == subredditVM.Thing.Data.DisplayName); if (match != null) { subredditVM.Pinned = true; } else { subredditVM.Pinned = false; } } }
private void Photo_Loaded(object sender, ItemRealizationEventArgs e) { LongListSelector longList = sender as LongListSelector; PhotoCollectionViewModel vm = longList.DataContext as PhotoCollectionViewModel; vm.LoadMorePhotos(e.Container.Content as Photo); }
private void Feed_OnItemRealized(object sender, ItemRealizationEventArgs e) { if (FeedLongListSelector.ItemsSource != null) { App.ViewModel.LoadData(); } }
/// <summary> /// Called when an item is realized : /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void OnInnerSelectorItemRealized(object sender, ItemRealizationEventArgs e) { if (e.ItemKind == LongListSelectorItemKind.Item) { int childrenCount = VisualTreeHelper.GetChildrenCount(e.Container); if (childrenCount > 0) { LongListMultiSelectorItem llItem = VisualTreeHelper.GetChild(e.Container, 0) as LongListMultiSelectorItem; if (llItem != null) { ConfigureItem(llItem); // Check if item should be selected llItem.IsSelected = _selectedItems.Contains(llItem.Content); llItem.IsSelectedChanged += OnLongListMultiSelectorItemIsSelectedChanged; llItem.GotoState(IsSelectionEnabled ? LongListMultiSelectorItem.State.Opened : LongListMultiSelectorItem.State.Closed); _realizedItems.Add(llItem.WR); } } } if (ItemRealized != null) { ItemRealized(sender, e); } }
private void LongListSelector_ItemRealized(object sender, ItemRealizationEventArgs e) { if (this.Perfil.Historico.Any()) { txtVazio.Visibility = System.Windows.Visibility.Collapsed; } }
private async void albumListView_ItemRealized(object sender, ItemRealizationEventArgs e) { if (e.ItemKind == LongListSelectorItemKind.ListFooter) { await App.AlbumListView.LoadMore(); } }
private void ControlOnItemRealized(object sender, ItemRealizationEventArgs e) { var itemContent = e.Container.Content as Cell; if (itemContent == null) { throw new Exception("You have to use a Cell for the ExtendedListview.ItemTemplate DataTemplate"); } var item = itemContent.BindingContext; var items = FormsControl.ItemsSource as IList; if (items == null) { throw new Exception("ExtendedListview ItemsSource has to be IList"); } var currentItemIndex = items.IndexOf(item); if ((items.Count - currentItemIndex <= FormsControl.Offset) && (FormsControl.LoadMoreCommand != null) && (FormsControl.LoadMoreCommand.CanExecute(null))) { _pageNumber = _pageNumber + 1; FormsControl.LoadMoreCommand.Execute(new LoadMoreQuery { PageNumber = _pageNumber, PageSize = FormsControl.PageSize }); } }
private void llsItemList_ItemRealized(object sender, ItemRealizationEventArgs e) { if (!_viewModel.IsLoading && llsItemList.ItemsSource != null && llsItemList.ItemsSource.Count >= AppConfig.ITEM_COUNT_BEFORE_NEXT_LOADING && e.ItemKind == LongListSelectorItemKind.Item) { if ((e.Container.Content as ItemViewModel).Equals(llsItemList.ItemsSource[llsItemList.ItemsSource.Count - AppConfig.ITEM_COUNT_BEFORE_NEXT_LOADING])) { this.SetProgressIndicator(true, "tải thêm tin..."); _pageNumber++; var maxPageNumber = _viewModel.Items.GetMaxPageNumber(AppConfig.ITEM_COUNT_PER_FEED); if (_pageNumber <= maxPageNumber) { _viewModel.LoadPage(_pageNumber, AppConfig.ShowUnreadItemOnly); } else { _pageNumber = maxPageNumber; } UpdateViewTitle(); UpdateItemReadCount(); this.SetProgressIndicator(false); } } }
void ResultList_ItemRealized(object sender, ItemRealizationEventArgs e) { if (lastItem != null && items.Count > 0 && e.Container.DataContext == lastItem) { addItemsPaged(this.items, true); } }
private void HistoryList_ItemUnrealized(object sender, ItemRealizationEventArgs e) { ActivityListItemViewModel model = (ActivityListItemViewModel)e.Container.DataContext; model.ClearScreenImage(); model.hasBeenUnrealized = true; }
private void llsPerfisSaldo_ItemRealized(object sender, ItemRealizationEventArgs e) { if (App.PerfisSaldoViewModel.ListaPerfisSaldo.Any()) { txtVazio.Visibility = System.Windows.Visibility.Collapsed; } }
private void AllListBox_OnItemRealized(object sender, ItemRealizationEventArgs e) { if (App.ViewModel.IsLoading) { return; } var listBox = sender as LongListSelector; if (listBox == null) { return; } var items = listBox.ItemsSource as ObservableCollection <ItemViewModel>; if (items == null) { return; } var currentItem = e.Container.Content as ItemViewModel; if (currentItem == null) { return; } if (currentItem.Equals(App.ViewModel.Items.Last())) { App.ViewModel.LoadData(App.ViewModel.LastItem); } }
private void llsFeedList_ItemRealized(object sender, ItemRealizationEventArgs e) { if (!_viewModel.IsLoading && llsFeedList.ItemsSource != null && llsFeedList.ItemsSource.Count >= AppConfig.ITEM_COUNT_BEFORE_NEXT_LOADING && e.ItemKind == LongListSelectorItemKind.Item) { if ((e.Container.Content as FeedViewModel).Equals(llsFeedList.ItemsSource[llsFeedList.ItemsSource.Count - AppConfig.ITEM_COUNT_BEFORE_NEXT_LOADING])) { this.SetProgressIndicator(true, "tải thêm kênh..."); _pageNumber++; var maxPageNumber = _viewModel.FeedIds.GetMaxPageNumber(AppConfig.FEED_COUNT_PER_PUBLISHER); if (_pageNumber <= maxPageNumber) { _viewModel.LoadPage(_pageNumber); } else { _pageNumber = maxPageNumber; } this.SetProgressIndicator(false); } } }
/// <summary> /// Comment item realized handler /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void comment_ItemRealized(object sender, ItemRealizationEventArgs e) { if (commentNewLoad) { commentSelector.ScrollTo(e.Container.Content); commentNewLoad = false; } }
/// <summary> /// Image item realized handler /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void movie_ItemRealized(object sender, ItemRealizationEventArgs e) { if (movieNewLoad) { movieSelector.ScrollTo(e.Container.Content); movieNewLoad = false; } }
private void MainLongListSelector_ItemRealized(object sender, ItemRealizationEventArgs e) { var contact = e.Container.Content as ContactViewModel; if (contact != null && contact.ImageData == null) { App.LoadContactPhoto(contact); } }
private void LLS_ItemRealized(object sender, ItemRealizationEventArgs e) { if (e.ItemKind == LongListSelectorItemKind.Item) { object o = e.Container.DataContext; Items[o] = e.Container; } }
private void ExtendedLongListSelector_ItemRealized(object sender, ItemRealizationEventArgs e) { if (this.Link == null) { return; } this.Link((object)this, new LinkUnlinkEventArgs(e.Container)); }
/// <summary> /// Top 250 item realized handler /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void top250_ItemRealized(object sender, ItemRealizationEventArgs e) { if (isTop250NewLoad) { top250LongListSelector.ScrollTo(e.Container.Content); isTop250NewLoad = false; } }
/// <summary> /// Hot review item realized handler /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void comment_ItemRealized(object sender, ItemRealizationEventArgs e) { if (isCommentNewLoad) { hotReviewLongListSelector.ScrollTo(e.Container.Content); isCommentNewLoad = false; } }
private void SpeakerList_ItemUnrealized(object sender, ItemRealizationEventArgs e) { AirPlaySpeakerControl control = e.Container.FindVisualChild<AirPlaySpeakerControl>(); if (control == null) return; _currentSpeakerControls.Remove(control); }
/// <summary> /// Image item realized handler /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void image_ItemRealized(object sender, ItemRealizationEventArgs e) { if (imageNewLoad) { imageSelector.ScrollTo(e.Container.Content); imageNewLoad = false; } }
private void LLS_ItemUnrealized(object sender, ItemRealizationEventArgs e) { if (e.ItemKind == LongListSelectorItemKind.Item) { object o = e.Container.DataContext; _items.Remove(o); } }
//////////////////////////////////////////////////////// Item realized event handler //////////////////////////////////////////////// /// <summary> /// Top 250 item realized handler /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void shortReview_ItemRealized(object sender, ItemRealizationEventArgs e) { if (shortReviewNewLoad) { shortReviewSelector.ScrollTo(e.Container.Content); shortReviewNewLoad = false; } }
/// <summary> /// Review item realized handler /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void review_ItemRealized(object sender, ItemRealizationEventArgs e) { if (reviewNewLoad) { reviewLongListSelector.ScrollTo(e.Container.Content); reviewNewLoad = false; } }
private void LongListSelector_OnItemUnrealized(object sender, ItemRealizationEventArgs e) { var control = e.Container.Content as ImageControl; if (control != null) { control.UnloadImage(); Debug.WriteLine("unload"); } }
private void LsChannel_OnItemRealized(object sender, ItemRealizationEventArgs e) { Video content = e.get_Container().get_Content() as Video; if (content != null && !this._statusLoading && this._lsVideos.get_Count() - this._lsVideos.IndexOf(content) <= 2) { this.LoadDataNew(); } }
private void OnItemRealized(object sender, ItemRealizationEventArgs args) { if(!isLoading && ItemsSource != null && Model != null && Model.LoadMorePossible() && ItemsSource.Count > 0) { if(args.ItemKind == LongListSelectorItemKind.Item) { if(args.Container.Content == ItemsSource[0]) { isLoading = true; loadMoreScrollItem = ItemsSource[0]; Model.LoadMore().ContinueWith((res) => { isLoading = false; }); } } } }
private void FavoriteJokesMultiSelector_OnItemRealized(object sender, ItemRealizationEventArgs e) { //var currentContent = (e.Container.Content as ReleaseJokeDataModel); //if (!CanLoadMoreFavoriteJokes() || currentContent == null) return; //if (e.ItemKind != LongListSelectorItemKind.Item) return; //if (IsFavoriteJokesBufferZoneNear(currentContent)) //{ // Debug.WriteLine("Loading new..."); // var page = _viewModel.GetFavoriteJokesCurrentPage() + 1; // Dispatcher.BeginInvoke(() => _viewModel.LoadFavoriteJokes(page)); //} }
private void voiceList_ItemRealized(object sender, ItemRealizationEventArgs e) { if (searchVoiceCollection.IsLoading || voiceList.ItemsSource == null || voiceList.ItemsSource.Count < _offsetKnob) return; if (e.ItemKind != LongListSelectorItemKind.Item) return; var postEntity = e.Container.Content as PostEntity; if ( postEntity != null && postEntity.Equals( voiceList.ItemsSource[voiceList.ItemsSource.Count - _offsetKnob])) { searchVoiceCollection.LoadSearchResults(); } }
private void realized_handler(object sender, ItemRealizationEventArgs e) { int listItemsCount = (this.lls.ItemsSource as ObservableCollection<string>).Count(); int sourceCount = this.source.Count; // ItemsSourceの最後の要素がリストに表示されたら、 // データソースから次のデータを取得する。 if ((e.Container.Content as string) == (this.lls.ItemsSource as ObservableCollection<string>)[listItemsCount - 1]) { this.LoadMore(sourceCount, FetchSize); } return; }
void ThinkLonglistselector_ItemRealized(object sender, ItemRealizationEventArgs e) { if (!IsLoading && ItemsSource != null && ItemsSource.Count >= Offset) { if (e.ItemKind == LongListSelectorItemKind.Item) { object offsetItem = ItemsSource[ItemsSource.Count - Offset]; if ((e.Container.Content == offsetItem)) { OnDataRequest(); } } } }
private void OnItemRealized(object sender, ItemRealizationEventArgs itemRealizationEventArgs) { if (!IsLoading && ItemsSource != null && ItemsSource.Count >= Offset) { if (itemRealizationEventArgs.ItemKind == LongListSelectorItemKind.Item) { object offsetItem = ItemsSource[ItemsSource.Count - Offset]; if ((itemRealizationEventArgs.Container.Content == offsetItem)) { OnDataRequest(); } } } }
private void streamsList_ItemRealized(object sender, ItemRealizationEventArgs e) { if (!_viewModel.IsLoading && StreamsList.ItemsSource != null && StreamsList.ItemsSource.Count >= _offsetKnobStreams) { if (e.ItemKind == LongListSelectorItemKind.Item) { if ((e.Container.Content as Stream).Equals(StreamsList.ItemsSource[StreamsList.ItemsSource.Count - _offsetKnobStreams])) { Debug.WriteLine("Searching for {0}", _pageNumberStreams); _viewModel.SearchStreams(StreamsSearchBox.Text, _pageNumberStreams++); } } } }
private async void Challenges_ItemRealized(object sender, ItemRealizationEventArgs e) { var challengeViewModel = DataContext as ChallengeViewModel; if (Challenges.ItemsSource != null && Challenges.ItemsSource.Count >= challengeViewModel.CommentListViewModel.CurrentlyLoaded) { if (e.ItemKind == LongListSelectorItemKind.Item) { if ((e.Container.Content as ChallengeViewModel).Equals(Challenges.ItemsSource[Challenges.ItemsSource.Count])) { await challengeViewModel.CommentListViewModel.LoadData(true); } } } }
private void resultList_ItemRealized(object sender, ItemRealizationEventArgs e) { if (!_viewModel.IsLoading && TopStreamsList.ItemsSource != null && TopStreamsList.ItemsSource.Count >= _offsetKnob) { if (e.ItemKind == LongListSelectorItemKind.Item) { if ((e.Container.Content as Stream).Equals(TopStreamsList.ItemsSource[TopStreamsList.ItemsSource.Count - _offsetKnob])) { Debug.WriteLine("Searching for {0}", _pageNumber); _viewModel.LoadPage(App.ViewModel.curTopGame.game.name, _pageNumber++); } } } }
private void LongListSelector_ItemRealized(object sender, ItemRealizationEventArgs e) { //if (!_viewModel.IsLoading && resultListBox.ItemsSource != null && resultListBox.ItemsSource.Count >= _offsetKnob) //{ // if (e.ItemKind == LongListSelectorItemKind.Item) // { // if ((e.Container.Content as TwitterSearchResult).Equals(resultListBox.ItemsSource[resultListBox.ItemsSource.Count - _offsetKnob])) // { // Debug.WriteLine("Searching for {0}", _pageNumber); // _viewModel.LoadPage(_searchTerm, _pageNumber++); // } // } //} }
// Implementation of inifinite scrolling private void OnItemRealized(object sender, ItemRealizationEventArgs e) { Photo photoItem = e.Container.Content as Photo; if (photoItem == null) return; int index = PhotoCollection.IndexOf(photoItem); bool canLoad = (PhotoSetSource.Photos.Count < PhotoSetSource.PhotoCount); if (PhotoCollection.Count - index <= 2 && canLoad) { int page = PhotoSetSource.Photos.Count / Anaconda.DefaultItemsPerPage + 1; Anaconda.AnacondaCore.GetPhotoSetPhotosAsync(PhotoSetSource.ResourceId, new Dictionary<string, string> { { "page", page.ToString() }, { "per_page", Anaconda.DefaultItemsPerPage.ToString() } }); } }
private void LongListSelector_ItemRealized(object sender, ItemRealizationEventArgs e) { var lls = (LongListSelector)sender; if (!IsLoading && lls.ItemsSource != null && lls.ItemsSource.Count >= _offsetKnob) { if (e.ItemKind == LongListSelectorItemKind.Item) { if ((e.Container.Content as RedditImage).Equals(lls.ItemsSource[lls.ItemsSource.Count - _offsetKnob])) { Debug.WriteLine("Loading after {0}", VM.RedditNextPath); LoadData(); } } } }
private async void LongListSelector_ItemRealized(object sender, ItemRealizationEventArgs e) { if (!DesignerProperties.IsInDesignTool) { var challengeListViewModel = App.ViewModel.ChallengeListViewModel; if (!challengeListViewModel.IsDataLoading && Challenges.ItemsSource != null && Challenges.ItemsSource.Count >= challengeListViewModel.CurrentlyLoaded) { if (e.ItemKind == LongListSelectorItemKind.Item) { if ((e.Container.Content as ChallengeViewModel).Equals(Challenges.ItemsSource[Challenges.ItemsSource.Count - challengeListViewModel.CurrentlyLoaded])) { await challengeListViewModel.LoadData(true); } } } } }
private void secretMailTimeLine_ItemRealized(object sender, ItemRealizationEventArgs e) { if (!secretMailCollection.IsLoading && secretEmailTimeLine.ItemsSource != null && secretEmailTimeLine.ItemsSource.Count >= _offsetKnob) { if (e.ItemKind == LongListSelectorItemKind.Item) { var postEntity = e.Container.Content as PostEntity; if ( postEntity != null && postEntity.Equals( secretEmailTimeLine.ItemsSource[secretEmailTimeLine.ItemsSource.Count - _offsetKnob])) { secretMailCollection.LoadPosts(EndPoints.MENTIONS_TIMELINE); } } } }
private void gamesList_ItemRealized(object sender, ItemRealizationEventArgs e) { if (!_viewModel.IsLoading && GamesList.ItemsSource != null && GamesList.ItemsSource.Count >= _offsetKnobGames) { if (e.ItemKind == LongListSelectorItemKind.Item) { if ((e.Container.Content as Game).Equals(GamesList.ItemsSource[GamesList.ItemsSource.Count - _offsetKnobGames])) { if (GamesList.ItemsSource.Count % 8 == 0) { Debug.WriteLine("Searching for {0}", _pageNumberGames); _viewModel.SearchGames(GamesSearchBox.Text, _pageNumberGames++); } } } } }
void linksView_ItemRealized(object sender, ItemRealizationEventArgs e) { lastItem = e.Container.Content; var linksView = sender as FixedLongListSelector; if (linksView.ItemsSource != null && linksView.ItemsSource.Count >= _offsetKnob) { if (e.ItemKind == LongListSelectorItemKind.Item) { if ((e.Container.Content).Equals(linksView.ItemsSource[linksView.ItemsSource.Count - _offsetKnob])) { var viewModel = DataContext as RedditViewModel; if (viewModel != null && viewModel.Links.HasMoreItems) viewModel.Links.LoadMoreItemsAsync(30); } } } }
private void AllListBox_OnItemRealized(object sender, ItemRealizationEventArgs e) { if (App.ViewModel.IsLoading) return; var listBox = sender as LongListSelector; if (listBox == null) return; var items = listBox.ItemsSource as ObservableCollection<ItemViewModel>; if (items == null) return; var currentItem = e.Container.Content as ItemViewModel; if (currentItem == null) return; if (currentItem.Equals(App.ViewModel.Items.Last())) { App.ViewModel.LoadData(App.ViewModel.LastItem); } }
private void youTubeList_ItemRealized(object sender, ItemRealizationEventArgs e) { if (!_viewModel.IsLoading && YouTubeList.ItemsSource != null && YouTubeList.ItemsSource.Count >= OffsetKnob) { if (e.ItemKind == LongListSelectorItemKind.Item) { var twitterSearchResult = e.Container.Content as object; if ( twitterSearchResult != null && twitterSearchResult.Equals( YouTubeList.ItemsSource[YouTubeList.ItemsSource.Count - OffsetKnob])) { Debug.WriteLine("Searching for {0}", _pageNumber); _viewModel.LoadPage(_searchTerm, _pageNumber++); } } } }
void LongListSelector_ItemRealized(object sender, ItemRealizationEventArgs e) { var selector = (LongListSelector)sender; var viewModel = DataContext; if (PagingEnabled && viewModel != null && RefreshCommand!=null && (selector.ItemsSource != null && selector.ItemsSource.Count >= OffsetKnob)) { if (e.ItemKind == LongListSelectorItemKind.Item) { object element = e.Container.Content; if (element != null && element.Equals( selector.ItemsSource[selector.ItemsSource.Count - OffsetKnob])) { ((DelegateCommand<int>)RefreshCommand).Execute(_pageNumber++); } } } }
void MessageList_ItemRealized(object sender, ItemRealizationEventArgs e) { //try //{ // if (!isLoading && MessagesList.ItemsSource != null && MessagesList.ItemsSource.Count >= _offsetKnob) // { // if (e.ItemKind == LongListSelectorItemKind.Item) // { // if ((e.Container.Content as ConversationModel).Equals(MessagesList.ItemsSource[MessagesList.ItemsSource.Count - _offsetKnob])) // { // lastPagePulled += 1; // PullMessages(); // } // } // } //} //catch (Exception exception) //{ // ErrorHandler.Save(exception, MobileTypeEnum.WP8); //} }
void TopicsList_ItemRealized(object sender, ItemRealizationEventArgs e) { try { if (!isLoading && TopicsList.ItemsSource != null && TopicsList.ItemsSource.Count >= _offsetKnob) { if (e.ItemKind == LongListSelectorItemKind.Item) { if ((e.Container.Content as ForumTopicModel).Equals(TopicsList.ItemsSource[TopicsList.ItemsSource.Count - _offsetKnob])) { lastPagePulled += 1; PullGroups(); } } } } catch (Exception exception) { ErrorHandler.Save(exception, MobileTypeEnum.WP8); } }
private void LongListSelector_OnItemRealized(object sender, ItemRealizationEventArgs e) { if (((dynamic) DataContext).IsLoading) return; var longListSelector = (LongListSelector) sender; var multas = (ObservableCollection<Multa>)longListSelector.ItemsSource; if (multas == null) return; if (!realized.ContainsKey(longListSelector)) realized.Add(longListSelector, -1); realized[longListSelector]++; var numeroDeMultasCarregadas = multas.Count; //Debug.WriteLine("Realized: " + realized[longListSelector]); if (numeroDeMultasCarregadas < carregarQuandoFaltaremXMultas) {//se tem menos itens do que o minimo pra paginar, então acabaram os itens, retorna return; } var multaAtual = (Multa) e.Container.Content; var posicaoDaMultaCarregadaAgora = multas.IndexOf(multaAtual); Debug.WriteLine("posicao sendo carregada: {0}, numero de multas carregas: {1}", posicaoDaMultaCarregadaAgora, numeroDeMultasCarregadas); if (numeroDeMultasCarregadas - posicaoDaMultaCarregadaAgora < carregarQuandoFaltaremXMultas) { var grupoDeMultas = (GrupoDeMultas)longListSelector.DataContext; ((dynamic)DataContext).CarregarMultas(grupoDeMultas); } }
private void photosList_ItemRealized_1(object sender, ItemRealizationEventArgs e) { Photo photo = e.Container.Content as Photo; if (photo != null) { int offset = 2; // Only if there is no data that is currently getting loaded would be initiate the loading again if (!isCurrentlyLoading && Photos.Count - Photos.IndexOf(photo) <= offset) { LoadDataFromSource(); } } }
// Implementation of inifinite scrolling private void OnItemRealized(object sender, ItemRealizationEventArgs e) { SelectablePhoto photoItem = e.Container.Content as SelectablePhoto; if (photoItem == null) return; User currentUser = Cinderella.CinderellaCore.CurrentUser; int index = currentUser.Photos.IndexOf(photoItem.PhotoSource); bool canLoad = (!currentUser.IsLoadingPhotoStream && currentUser.Photos.Count < currentUser.PhotoCount); if (!canLoad) return; if (PhotoCollection.Count - index <= 2) { int page = currentUser.Photos.Count / 40 + 1; Anaconda.AnacondaCore.GetPhotoStreamAsync(currentUser.ResourceId, new Dictionary<string, string> { { "page", page.ToString() }, { "per_page", "40" } }); } }