<Page
    x:Class="FoxTube.Home"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:FoxTube"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:pages="using:FoxTube.Pages"
    xmlns:controls="using:FoxTube.Controls"
    mc:Ignorable="d">

    <Pivot SelectionChanged="pivot_SelectionChanged" Name="pivot">
        <PivotItem Name="recommended" Header="Recommended" x:Uid="/Home/recommended">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition/>
                    <RowDefinition Height="auto"/>
                </Grid.RowDefinitions>

                <ScrollViewer>
                    <StackPanel>
                        <pages:VideoGrid x:Name="recGrid"/>
                        <controls:ShowMore Clicked="Recommended_More" x:Name="recommendedMore"/>
                    </StackPanel>
                </ScrollViewer>

                <CommandBar Grid.Row="1">
                    <AppBarButton Icon="Refresh" Label="Refresh" x:Uid="/Home/refresh" Click="Recommended_Refresh"/>
                </CommandBar>

                <local:LoadingPage x:Name="recsLoading" Grid.RowSpan="2" RefreshPage="Recommended_Refresh"/>
            </Grid>
        </PivotItem>
        <PivotItem Name="trending" Header="Trending" x:Uid="/Home/trending">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition/>
                    <RowDefinition Height="auto"/>
                </Grid.RowDefinitions>

                <ScrollViewer>
                    <StackPanel>
                        <pages:VideoGrid x:Name="trendGrid"/>
                        <controls:ShowMore Clicked="Trending_More" x:Name="trendingMore"/>
                    </StackPanel>
                </ScrollViewer>

                <CommandBar Grid.Row="1">
                    <AppBarButton Icon="Refresh" Label="Refresh" x:Uid="/Home/refresh" Click="Trends_Refresh"/>
                </CommandBar>

                <local:LoadingPage x:Name="trendsLoading" Grid.RowSpan="2" RefreshPage="Trends_Refresh"/>
            </Grid>
        </PivotItem>
        <PivotItem Name="subscriptions" Header="Subscriptions" x:Uid="/Home/subs">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition/>
                    <RowDefinition Height="auto"/>
                </Grid.RowDefinitions>

                <ScrollViewer>
                    <StackPanel>
                        <pages:VideoGrid x:Name="subsGrid"/>
                        <controls:ShowMore Clicked="Subscriptions_More" x:Name="subscriptionsMore"/>
                    </StackPanel>
                </ScrollViewer>

                <CommandBar Grid.Row="1">
                    <AppBarButton Icon="Refresh" Label="Refresh" x:Uid="/Home/refresh" Click="Subscriptions_Refresh"/>
                </CommandBar>

                <local:LoadingPage x:Name="subsLoading" Grid.RowSpan="2" RefreshPage="Subscriptions_Refresh"/>
            </Grid>
        </PivotItem>
    </Pivot>
</Page>
