diff --git a/FoxTube/Controls/Cards/ChannelCard.xaml b/FoxTube/Controls/Cards/ChannelCard.xaml index a7dbe48..b8fc092 100644 --- a/FoxTube/Controls/Cards/ChannelCard.xaml +++ b/FoxTube/Controls/Cards/ChannelCard.xaml @@ -43,7 +43,10 @@ - + + + + diff --git a/FoxTube/Controls/ItemGrid.xaml b/FoxTube/Controls/ItemGrid.xaml deleted file mode 100644 index 3467722..0000000 --- a/FoxTube/Controls/ItemGrid.xaml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - diff --git a/FoxTube/Controls/ItemGrid.xaml.cs b/FoxTube/Controls/ItemGrid.xaml.cs deleted file mode 100644 index e69dba3..0000000 --- a/FoxTube/Controls/ItemGrid.xaml.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Runtime.InteropServices.WindowsRuntime; -using Windows.Foundation; -using Windows.Foundation.Collections; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Controls.Primitives; -using Windows.UI.Xaml.Data; -using Windows.UI.Xaml.Input; -using Windows.UI.Xaml.Media; -using Windows.UI.Xaml.Navigation; - -// The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236 - -namespace FoxTube.Controls -{ - public sealed partial class ItemGrid : UserControl - { - public ItemGrid() - { - this.InitializeComponent(); - } - } -} diff --git a/FoxTube/Controls/ItemsGrid.xaml b/FoxTube/Controls/ItemsGrid.xaml new file mode 100644 index 0000000..28553f7 --- /dev/null +++ b/FoxTube/Controls/ItemsGrid.xaml @@ -0,0 +1,21 @@ + + + + + + + + + + diff --git a/FoxTube/Controls/ItemsGrid.xaml.cs b/FoxTube/Controls/ItemsGrid.xaml.cs new file mode 100644 index 0000000..750ef16 --- /dev/null +++ b/FoxTube/Controls/ItemsGrid.xaml.cs @@ -0,0 +1,30 @@ +using FoxTube.Controls.Cards; +using Windows.UI.Xaml; +using Windows.UI.Xaml.Controls; + +namespace FoxTube.Controls +{ + public sealed partial class ItemsGrid : UserControl + { + UIElementCollection Items => grid.Children; + public int ItemsCount => Items.Count; + + public ItemsGrid() => + InitializeComponent(); + + public void Add(UIElement item) + { + empty.Opacity = 0; + + if (ItemsCount % 5 == 0 && ItemsCount > 0) + Items.Add(new AdvertCard()); + Items.Add(item); + } + + public void Clear() + { + Items.Clear(); + empty.Opacity = 1; + } + } +} diff --git a/FoxTube/FoxTube.csproj b/FoxTube/FoxTube.csproj index ac71e1e..0374fe1 100644 --- a/FoxTube/FoxTube.csproj +++ b/FoxTube/FoxTube.csproj @@ -120,8 +120,8 @@ VideoCard.xaml - - ItemGrid.xaml + + ItemsGrid.xaml @@ -220,7 +220,7 @@ Designer MSBuild:Compile - + Designer MSBuild:Compile diff --git a/FoxTube/Themes/Resources.xaml b/FoxTube/Themes/Resources.xaml index 3c7c04c..c038322 100644 --- a/FoxTube/Themes/Resources.xaml +++ b/FoxTube/Themes/Resources.xaml @@ -10,5 +10,9 @@ + diff --git a/FoxTube/Views/Home.xaml b/FoxTube/Views/Home.xaml index 073b803..589a61a 100644 --- a/FoxTube/Views/Home.xaml +++ b/FoxTube/Views/Home.xaml @@ -5,37 +5,55 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls" - xmlns:cards="using:FoxTube.Controls.Cards" + xmlns:toolkit="using:Microsoft.Toolkit.Uwp.UI.Controls" + xmlns:controls="using:FoxTube.Controls" mc:Ignorable="d"> - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + diff --git a/FoxTube/Views/Home.xaml.cs b/FoxTube/Views/Home.xaml.cs index 2ecca12..59ebe6b 100644 --- a/FoxTube/Views/Home.xaml.cs +++ b/FoxTube/Views/Home.xaml.cs @@ -1,16 +1,5 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Runtime.InteropServices.WindowsRuntime; -using Windows.Foundation; -using Windows.Foundation.Collections; -using Windows.UI.Xaml; +using FoxTube.Controls.Cards; using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Controls.Primitives; -using Windows.UI.Xaml.Data; -using Windows.UI.Xaml.Input; -using Windows.UI.Xaml.Media; using Windows.UI.Xaml.Navigation; // The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238 @@ -22,9 +11,17 @@ namespace FoxTube.Views /// public sealed partial class Home : Page { - public Home() + public Home() => + InitializeComponent(); + + protected override void OnNavigatedTo(NavigationEventArgs e) { - this.InitializeComponent(); + base.OnNavigatedTo(e); + + for (int i = 0; i < 25; i++) + { + recommendedItems.Add(new VideoCard()); + } } } }