Exemplo n.º 1
0
        private CategoryMoreFooter CreateFooter()
        {
            if (this.IsHorizontal || (this.IsVerticalCompact || this._videoCategory.items.Count <= 3) && (!this.IsVerticalCompact || this._videoCategory.items.Count <= 6))
            {
                return((CategoryMoreFooter)null);
            }
            CategoryMoreFooter categoryMoreFooter = new CategoryMoreFooter();

            categoryMoreFooter.ShowMoreVisibility = Visibility.Visible;
            categoryMoreFooter.ShowAllVisibility  = Visibility.Collapsed;
            Action action = (Action)(() =>
            {
                if (!this._handledShowMore)
                {
                    if (!this.IsVerticalCompact)
                    {
                        foreach (VideoCatalogItem videoCatalogItem in this._videoCategory.items.Skip <VideoCatalogItem>(3).Take <VideoCatalogItem>(5))
                        {
                            this._catalogItems.Add(this.CreateCatalogItemViewModel(videoCatalogItem));
                        }
                    }
                    else
                    {
                        foreach (IEnumerable <VideoCatalogItem> source in this._videoCategory.items.Skip <VideoCatalogItem>(6).Take <VideoCatalogItem>(10).Partition <VideoCatalogItem>(2))
                        {
                            CatalogItemTwoInARowViewModel twoInArowViewModel = new CatalogItemTwoInARowViewModel();
                            twoInArowViewModel.Item1 = this.CreateCatalogItemViewModel(source.First <VideoCatalogItem>());
                            if (source.Count <VideoCatalogItem>() > 1)
                            {
                                twoInArowViewModel.Item2 = this.CreateCatalogItemViewModel(source.Skip <VideoCatalogItem>(1).First <VideoCatalogItem>());
                            }
                            this._catalogItemsTwoInARow.Add(twoInArowViewModel);
                        }
                    }
                    this.Footer.Data.ShowAllVisibility = Visibility.Visible;
                    this.Footer.Data.ShowMoreVisibility = Visibility.Collapsed;
                    this._handledShowMore = true;
                }
                else
                {
                    this.HandleShowAllAction();
                }
            });

            categoryMoreFooter.HandleTap = action;
            return(categoryMoreFooter);
        }
Exemplo n.º 2
0
 private void Initialize()
 {
     this.Header.Data = this.CreateHeader();
     this._itemsWithHeaderAndFooter.Merge((INotifyCollectionChanged)this._coHeader.Coll);
     if (!this.IsHorizontal)
     {
         if (!this.IsVerticalCompact)
         {
             foreach (VideoCatalogItem videoCatalogItem in this._videoCategory.items.Take <VideoCatalogItem>(3))
             {
                 this._catalogItems.Add(this.CreateCatalogItemViewModel(videoCatalogItem));
             }
             this._itemsWithHeaderAndFooter.Merge((INotifyCollectionChanged)this._catalogItems);
         }
         else
         {
             foreach (IEnumerable <VideoCatalogItem> source in this._videoCategory.items.Take <VideoCatalogItem>(6).Partition <VideoCatalogItem>(2))
             {
                 CatalogItemTwoInARowViewModel twoInArowViewModel = new CatalogItemTwoInARowViewModel();
                 twoInArowViewModel.Item1 = this.CreateCatalogItemViewModel(source.First <VideoCatalogItem>());
                 if (source.Count <VideoCatalogItem>() > 1)
                 {
                     twoInArowViewModel.Item2 = this.CreateCatalogItemViewModel(source.Skip <VideoCatalogItem>(1).First <VideoCatalogItem>());
                 }
                 this._catalogItemsTwoInARow.Add(twoInArowViewModel);
             }
             this._itemsWithHeaderAndFooter.Merge((INotifyCollectionChanged)this._catalogItemsTwoInARow);
         }
         this._itemsWithHeaderAndFooter.Merge((INotifyCollectionChanged)CollectionObject <DividerSpaceDownViewModel> .CreateCollectionObject <DividerSpaceDownViewModel>(new DividerSpaceDownViewModel()).Coll);
     }
     else
     {
         this.CatalogItemsHorizontalVM.Data = new CatalogItemsHorizontalViewModel(this._videoCategory, this._knownUsers, this._knownGroups);
         this._itemsWithHeaderAndFooter.Merge((INotifyCollectionChanged)this.CatalogItemsHorizontalVM.Coll);
     }
     this.Footer.Data = this.CreateFooter();
     this._itemsWithHeaderAndFooter.Merge((INotifyCollectionChanged)this._coFooter.Coll);
 }