コード例 #1
0
ファイル: ArtistView.xaml.cs プロジェクト: thongbkvn/NCT
 private async void songsView_ItemRealized(object sender, ItemRealizationEventArgs e)
 {
     if (e.ItemKind == LongListSelectorItemKind.ListFooter)
     {
         await App.ArtistVM.LoadMoreTrackAsync();
     }
 }
コード例 #2
0
    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 
        });
      }
    }
コード例 #3
0
        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();
                        }
                    }
                }
            }
        }
コード例 #4
0
        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);
            }
        }
コード例 #5
0
        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);
            }
        }
コード例 #6
0
        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();
            }
        }
コード例 #7
0
        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);
            }
        }
コード例 #8
0
		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;
				}
			}
		}
コード例 #9
0
ファイル: MainPage.xaml.cs プロジェクト: nyghtrocker/Blog
        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);
        }
コード例 #10
0
 private void Feed_OnItemRealized(object sender, ItemRealizationEventArgs e)
 {
     if (FeedLongListSelector.ItemsSource != null)
     {
         App.ViewModel.LoadData();
     }
 }
コード例 #11
0
ファイル: MainPage.xaml.cs プロジェクト: WooodHead/Blog-3
        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);
        }
コード例 #12
0
        /// <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);
            }
        }
コード例 #13
0
        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();
            }
        }
コード例 #14
0
 private void LongListSelector_ItemRealized(object sender, ItemRealizationEventArgs e)
 {
     if (this.Perfil.Historico.Any())
     {
         txtVazio.Visibility = System.Windows.Visibility.Collapsed;
     }
 }
コード例 #15
0
ファイル: GenreView.xaml.cs プロジェクト: thongbkvn/NCT
 private async void albumListView_ItemRealized(object sender, ItemRealizationEventArgs e)
 {
     if (e.ItemKind == LongListSelectorItemKind.ListFooter)
     {
         await App.AlbumListView.LoadMore();
     }
 }
コード例 #16
0
        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
                });
            }
        }
コード例 #17
0
        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);
                }
            }
        }
コード例 #18
0
 void ResultList_ItemRealized(object sender, ItemRealizationEventArgs e)
 {
     if (lastItem != null && items.Count > 0 && e.Container.DataContext == lastItem)
     {
         addItemsPaged(this.items, true);
     }
 }
コード例 #19
0
ファイル: MainPage.xaml.cs プロジェクト: taurgis/WPTrakt
        private void HistoryList_ItemUnrealized(object sender, ItemRealizationEventArgs e)
        {
            ActivityListItemViewModel model = (ActivityListItemViewModel)e.Container.DataContext;

            model.ClearScreenImage();
            model.hasBeenUnrealized = true;
        }
コード例 #20
0
 private void llsPerfisSaldo_ItemRealized(object sender, ItemRealizationEventArgs e)
 {
     if (App.PerfisSaldoViewModel.ListaPerfisSaldo.Any())
     {
         txtVazio.Visibility = System.Windows.Visibility.Collapsed;
     }
 }
コード例 #21
0
        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);
            }
        }
コード例 #22
0
ファイル: PublisherPage.xaml.cs プロジェクト: tukhoi/DocBao
        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);
                }
            }
        }
コード例 #23
0
 /// <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;
     }
 }
コード例 #24
0
 /// <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;
     }
 }
コード例 #25
0
 private void MainLongListSelector_ItemRealized(object sender, ItemRealizationEventArgs e)
 {
     var contact = e.Container.Content as ContactViewModel;
     if (contact != null && contact.ImageData == null)
     {
         App.LoadContactPhoto(contact);
     }
 }
コード例 #26
0
 private void LLS_ItemRealized(object sender, ItemRealizationEventArgs e)
 {
     if (e.ItemKind == LongListSelectorItemKind.Item)
     {
         object o = e.Container.DataContext;
         Items[o] = e.Container;
     }
 }
コード例 #27
0
 private void ExtendedLongListSelector_ItemRealized(object sender, ItemRealizationEventArgs e)
 {
     if (this.Link == null)
     {
         return;
     }
     this.Link((object)this, new LinkUnlinkEventArgs(e.Container));
 }
コード例 #28
0
 /// <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;
     }
 }
コード例 #29
0
 /// <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;
     }
 }
コード例 #30
0
        private void SpeakerList_ItemUnrealized(object sender, ItemRealizationEventArgs e)
        {
            AirPlaySpeakerControl control = e.Container.FindVisualChild<AirPlaySpeakerControl>();
            if (control == null)
                return;

            _currentSpeakerControls.Remove(control);
        }
コード例 #31
0
 /// <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;
     }
 }
コード例 #32
0
 private void LLS_ItemUnrealized(object sender, ItemRealizationEventArgs e)
 {
     if (e.ItemKind == LongListSelectorItemKind.Item)
     {
         object o = e.Container.DataContext;
         _items.Remove(o);
     }
 }
コード例 #33
0
 //////////////////////////////////////////////////////// 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;
     }
 }
コード例 #34
0
 /// <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;
     }
 }
コード例 #35
0
 private void LongListSelector_OnItemUnrealized(object sender, ItemRealizationEventArgs e)
 {
     var control = e.Container.Content as ImageControl;
     if (control != null)
     {
         control.UnloadImage();
         Debug.WriteLine("unload");
     }
 }
コード例 #36
0
ファイル: TimKiem.cs プロジェクト: thangk48cc/VietTV
        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();
            }
        }
コード例 #37
0
 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; });
             }
         }
     }
 }
コード例 #38
0
        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));
            //}
        }
コード例 #39
0
 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();
     }
 }
コード例 #40
0
        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;
        }
コード例 #41
0
 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();
             }
         }
     }
 }
コード例 #42
0
 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();
             }
         }
     }
 }
コード例 #43
0
ファイル: SearchPage.xaml.cs プロジェクト: Rwprice/Twitchy
 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++);
             }
         }
     }
 }
コード例 #44
0
 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);
             }
         }
     }
 }
コード例 #45
0
ファイル: TopGamePage.xaml.cs プロジェクト: Rwprice/Twitchy
 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++);
             }
         }
     }
 }
コード例 #46
0
 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++);
     //        }
     //    }
     //}
 }
コード例 #47
0
        // 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() } });
            }
        }
コード例 #48
0
ファイル: MainPage.xaml.cs プロジェクト: sinhpham/PhotoGlider
 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();
             }
         }
     }
 }
コード例 #49
0
 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);
                 }
             }
         }
     }
 }
コード例 #50
0
 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);
             }
         }
     }
 }
コード例 #51
0
ファイル: SearchPage.xaml.cs プロジェクト: Rwprice/Twitchy
 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++);
                 }
             }
         }
     }
 }
コード例 #52
0
		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);
					}
				}
			}
		}
コード例 #53
0
        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);
            }
        }
コード例 #54
0
 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++);
             }
         }
     }
 }
コード例 #55
0
ファイル: LongListSelector.cs プロジェクト: ledgarl/Samples
        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++);
                    }
                }
            }
        }
コード例 #56
0
 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);
     //}
 }
コード例 #57
0
 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);
     }
 }
コード例 #58
0
 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);
     }
 }
コード例 #59
0
 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();
         }
     }
 }
コード例 #60
0
        // 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" } });
            }
        }