<?xml version="1.0" encoding="utf-8"?>
<featurebase:FeaturePage
    x:Class="was.droidtransfer.features.photos.PhotosExportPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:was.droidtransfer.features.photos"
    xmlns:export="using:was.droidtransfer.features.photos.export"
    xmlns:featurebase="using:was.droidtransfer.features"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"  d:DataContext="{d:DesignInstance Type=local:PhotosExportPage}"
    Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
    <Page.Resources>
        <ResourceDictionary>
            <CollectionViewSource x:Key="GroupsCVS" IsSourceGrouped="True" />
        </ResourceDictionary>
    </Page.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Border Style="{ThemeResource PageHeaderBorderStyle}">
            <Grid>
                <CommandBar Style="{ThemeResource PageHeaderCommandBarStyle}">
                    <featurebase:CopyProgressAppBarUserController x:Name="copyProgressUserControl" Visibility="Collapsed" OnCancelTapped="_copyProgressUserControl_OnCancelTapped" MaxWidth="350" />
                    <AppBarButton x:Name="appBarButtonSave" x:Uid="AppBarButtonExportSave" Label="XX Save to PC" Style="{ThemeResource AppBarButtonStyle}" Click="_appBarButtonSave_Click" Visibility="{Binding Visibility, ElementName=gridContent}" IsEnabled="{x:Bind IsExportAvailable, Mode=OneWay}">
                        <AppBarButton.Content>
                            <FontIcon Glyph="&#xE78C;" Foreground="{ThemeResource AccentFillColorDefaultBrush}"/>
                        </AppBarButton.Content>
                    </AppBarButton>
                    <AppBarSeparator Visibility="{Binding Visibility, ElementName=gridContent}" />
                    <AppBarButton x:Name="appBarButtonSelectAll" x:Uid="AppBarButtonExportSelectAll" Label="XX Select All" Style="{ThemeResource AppBarButtonStyle}" Click="_appBarButtonSelectAll_Click" Visibility="{Binding Visibility, ElementName=gridContent}" IsEnabled="{x:Bind IsSelectionAvailable, Mode=OneWay}">
                        <AppBarButton.Content>
                            <FontIcon Glyph="&#xE73A;" Foreground="{ThemeResource AccentFillColorDefaultBrush}"/>
                        </AppBarButton.Content>
                    </AppBarButton>
                    <AppBarButton x:Name="appBarButtonClearSelection" x:Uid="AppBarButtonExportClearSelection" Label="XX Clear Selection" Style="{ThemeResource AppBarButtonStyle}" Click="_appBarButtonClearSelection_Click" Visibility="{Binding Visibility, ElementName=gridContent}" IsEnabled="{x:Bind IsSelectionAvailable, Mode=OneWay}">
                        <AppBarButton.Content>
                            <FontIcon Glyph="&#xE739;" Foreground="{ThemeResource AccentFillColorDefaultBrush}"/>
                        </AppBarButton.Content>
                    </AppBarButton>
                    <AppBarSeparator Visibility="{Binding Visibility, ElementName=gridContent}" />
                    <AppBarButton x:Name="appBarButtonCancel" x:Uid="AppBarButtonExportCancel" Label="XX Cancel" Style="{ThemeResource AppBarButtonStyle}" Click="_appBarButtonCancel_Click">
                        <AppBarButton.Content>
                            <FontIcon Glyph="&#xE711;" Foreground="{ThemeResource AccentFillColorDefaultBrush}"/>
                        </AppBarButton.Content>
                    </AppBarButton>
                </CommandBar>
                <TextBlock Text="{Binding PageTitle}" Style="{ThemeResource PageHeaderTitleStyle}"/>
            </Grid>
        </Border>
        <Grid Grid.Row="1" BorderBrush="{ThemeResource SystemControlPageBackgroundListLowBrush}" BorderThickness="1" CornerRadius="{ThemeResource HyperlinkFocusRectCornerRadius}">
            <Grid x:Name="gridSearching">
                <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
                    <TextBlock x:Uid="TextBlockIdentifyingNewPhotos" Text="XX Identifying new photos..." Style="{ThemeResource TitleTextBlockStyle}" TextAlignment="Center" TextWrapping="Wrap"  />
                    <ProgressRing IsIndeterminate="True" Margin="0,20,0,0" />
                </StackPanel>
            </Grid>
            <Grid x:Name="gridContent">
                <GridView ItemsSource="{x:Bind ExportGroups.View, Mode=OneWay}" Padding="10" SelectionMode="None" ContainerContentChanging="_itemsGridView_ContainerContentChanging">
                    <GridView.GroupStyle>
                        <GroupStyle HidesIfEmpty="True">
                            <GroupStyle.HeaderTemplate>
                                <DataTemplate x:DataType="export:PhotosExportGroup">
                                    <CheckBox IsChecked="{x:Bind IsSelectedForExport, Mode=TwoWay}" Margin="-2,0,0,0">
                                        <TextBlock Text="{x:Bind Title}" FontWeight="SemiBold" />
                                    </CheckBox>
                                </DataTemplate>
                            </GroupStyle.HeaderTemplate>
                        </GroupStyle>
                    </GridView.GroupStyle>
                    <GridView.ItemTemplate>
                        <DataTemplate x:DataType="export:PhotosExportGroupItem">
                            <Grid Width="128" Height="128" Margin="10,10,10,10">
                                <local:PhotosThumbnailControl x:Name="thumbnailControl" Width="128" Height="128" />
                            </Grid>
                        </DataTemplate>
                    </GridView.ItemTemplate>
                    <GridView.ContextFlyout>
                        <MenuFlyout>
                            <MenuFlyoutItem x:Name="menuFlyoutItemSelectAll" x:Uid="MenuFlyoutItemSelectAll" Text="XX Select All" Click="_menuFlyoutItemSelectAll_Click">
                                <MenuFlyoutItem.Icon>
                                    <FontIcon Glyph="&#xE73A;" Foreground="{ThemeResource AccentFillColorDefaultBrush}"/>
                                </MenuFlyoutItem.Icon>
                            </MenuFlyoutItem>
                            <MenuFlyoutItem x:Name="menuFlyoutItemClearSelection" x:Uid="MenuFlyoutItemClearSelection" Text="XX Clear Selection" Click="_menuFlyoutItemClearSelection_Click">
                                <MenuFlyoutItem.Icon>
                                    <FontIcon Glyph="&#xE739;" Foreground="{ThemeResource AccentFillColorDefaultBrush}"/>
                                </MenuFlyoutItem.Icon>
                            </MenuFlyoutItem>
                        </MenuFlyout>
                    </GridView.ContextFlyout>
                </GridView>
            </Grid>
            <Grid x:Name="gridNoContentFound" Visibility="Collapsed">
                <StackPanel  HorizontalAlignment="Center" VerticalAlignment="Center">
                    <TextBlock x:Uid="TextBlockNoNewPhotosTitle" Text="XX No new photos were found!" Style="{ThemeResource TitleTextBlockStyle}" TextAlignment="Center" TextWrapping="Wrap"  />
                    <TextBlock x:Uid="TextBlockNoNewPhotosDescription" Text="XX All of your device photos are already in your chosen export folder." Style="{ThemeResource BodyTextBlockStyle}" TextAlignment="Center" TextWrapping="Wrap"  />
                    <Button x:Uid="ButtonBackToPhotos" Content="XX Back to Photos" Style="{ThemeResource AccentButtonStyle}" HorizontalAlignment="Center" Margin="0,40,0,0" Click="_buttonBackToPhotos_Click" />
                </StackPanel>
            </Grid>
            <Grid x:Name="gridExporting" Visibility="Collapsed">
                <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
                    <TextBlock x:Name="textBlockExportingNewPhotos" x:Uid="TextBlockExportingNewPhotos" Text="XX Exporting photos..." Style="{ThemeResource TitleTextBlockStyle}" TextAlignment="Center" TextWrapping="Wrap"  />
                    <ProgressRing IsIndeterminate="True" Margin="0,20,0,0" />
                </StackPanel>
            </Grid>
        </Grid>
    </Grid>
</featurebase:FeaturePage>
