<!--
  Copyright (c) MediaArea.net SARL. All Rights Reserved.

      Use of this source code is governed by a BSD-style license that can
      be found in the License.html file in the root of the source tree.
-->
<Page x:Class="MediaInfo.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:MediaInfo" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" NavigationCacheMode="Enabled" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
    <Page.Transitions>
        <TransitionCollection>
            <NavigationThemeTransition />
        </TransitionCollection>
    </Page.Transitions>
    <Page.Resources>
        <DataTemplate x:Key="ReportListTemplate" x:DataType="local:Report">
            <Grid Margin="0,0,0,0" Padding="0,0,0,0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <TextBlock Grid.Column="0" Text="{x:Bind FileName}" Style="{ThemeResource BaseTextBlockStyle}" />
                <Button Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Right" Background="#00000000" Foreground="Silver" Tag="{x:Bind Id}" Click="ListViewItem_Delete_Click">
                    <FontIcon FontFamily="Segoe MDL2 Assets" Glyph="&#xedae;"/>
                </Button>
            </Grid>
        </DataTemplate>
    </Page.Resources>
    <Grid x:Name="LayoutRoot" Loaded="LayoutRoot_Loaded" AllowDrop="True" DragOver="On_File_DragOver" DragLeave="On_File_DragLeave" Drop="On_File_Drop" SizeChanged="LayoutRoot_SizeChanged">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition x:Name="MasterColumn" Width="320"  />
            <ColumnDefinition x:Name="SeparatorColumn" Width="11" />
            <ColumnDefinition x:Name="DetailColumn" Width="*" />
        </Grid.ColumnDefinitions>
        <Grid x:Name="TitleBar" Grid.Row="0" Grid.ColumnSpan="3">
            <Rectangle x:Name="BackgroundElement" Fill="Transparent" />
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                <Image Height="32" Margin="5,0" Source="Assets/Square44x44Logo.targetsize-32.png" />
                <TextBlock x:Name="TitleText" Grid.Column="1" VerticalAlignment="Center" Text="MediaInfo" TextTrimming="CharacterEllipsis" />
            </Grid>
        </Grid>
        <CommandBar x:Name="AppBar" Grid.Row="1"  Grid.ColumnSpan="3">
            <CommandBar.PrimaryCommands>
                <AppBarButton x:Name="OpenFiles" Icon="OpenFile" Label="Open file" Click="OpenFiles_Click" />
                <AppBarButton x:Name="OpenFolder" Label="Open folder" Click="OpenFolder_Click">
                    <AppBarButton.Icon>
                        <FontIcon FontFamily="Segoe MDL2 Assets" Glyph="&#xe838;" />
                    </AppBarButton.Icon>
                </AppBarButton>
                <AppBarSeparator x:Name="SectionSeparator" />
                <AppBarButton x:Name="ViewListButton" Label="Views" IsEnabled="false">
                    <AppBarButton.Icon>
                        <FontIcon FontFamily="Segoe MDL2 Assets" Glyph="&#xe7b3;" />
                    </AppBarButton.Icon>
                    <Button.Flyout>
                        <MenuFlyout x:Name="ViewListMenu" Opening="ViewListMenu_Opening" Closing="ViewListMenu_Closing"/>
                    </Button.Flyout>
                </AppBarButton>
                <AppBarButton x:Name="ExportButton" Label="Export" IsEnabled="false" Click="ExportButton_Click">
                    <AppBarButton.Icon>
                        <FontIcon FontFamily="Segoe MDL2 Assets" Glyph="&#xE1FD;" />
                    </AppBarButton.Icon>
                </AppBarButton>
            </CommandBar.PrimaryCommands>
            <CommandBar.SecondaryCommands>
                <AppBarButton x:Name="AboutButton" Label="About MediaInfo..." Click="AboutButton_Click" />
            </CommandBar.SecondaryCommands>
        </CommandBar>
        <ListView x:Name="MasterListView" Grid.Column="0" Grid.Row="2" ItemContainerTransitions="{x:Null}" ItemTemplate="{StaticResource ReportListTemplate}" IsItemClickEnabled="True" ItemClick="MasterListView_ItemClick" ContainerContentChanging="MasterListView_ContainerContentChanging">
            <ListView.ItemContainerStyle>
                <Style TargetType="ListViewItem">
                    <Setter Property="HorizontalContentAlignment" Value="Stretch" />
                </Style>
            </ListView.ItemContainerStyle>
        </ListView>
        <RelativePanel x:Name="ResizePanel" Grid.Row="2" Grid.Column="1" Background="#44000000" PointerPressed="ResizePanel_PointerPressed" PointerReleased="ResizePanel_PointerReleased" PointerMoved="ResizePanel_PointerMoved" PointerEntered="ResizePanel_PointerEntered" PointerExited="ResizePanel_PointerExited" >
            <TextBlock RelativePanel.AlignVerticalCenterWithPanel="True" RelativePanel.AlignHorizontalCenterWithPanel="True" Foreground="White" FontSize="24" TextWrapping="WrapWholeWords">
                <Span  FontFamily="Segoe MDL2 Assets" FontSize="12">&#xE769;</Span>
            </TextBlock>
        </RelativePanel>
            <ContentPresenter x:Name="DetailContentPresenter" Grid.Column="2" Grid.Row="2" BorderThickness="1,0,0,0" BorderBrush="{ThemeResource SystemControlForegroundBaseLowBrush}">
            <ContentPresenter.ContentTransitions>
                <TransitionCollection />
            </ContentPresenter.ContentTransitions>
        </ContentPresenter>
        <RelativePanel x:Name="AddFilePanel" Grid.Row="1" Grid.Column="0" Grid.RowSpan="2" Grid.ColumnSpan="3" Background="#44000000" Visibility="Collapsed">
            <SymbolIcon x:Name="AddSymbol" Symbol="Add" RelativePanel.AlignVerticalCenterWithPanel="True" RelativePanel.AlignHorizontalCenterWithPanel="True" Foreground="White" RenderTransformOrigin="0.5,0.5">
                <SymbolIcon.RenderTransform>
                    <CompositeTransform ScaleX="1.5" ScaleY="1.5"/>
                </SymbolIcon.RenderTransform>
            </SymbolIcon>
            <TextBlock RelativePanel.Below="AddSymbol" RelativePanel.AlignHorizontalCenterWithPanel="True" Margin="0,12,0,0" Text="Add file(s)" Foreground="White" FontSize="24"></TextBlock>
        </RelativePanel>
        <RelativePanel x:Name="WelcomePanel" Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="3" Background="#44000000" Visibility="Collapsed">
            <TextBlock RelativePanel.AlignVerticalCenterWithPanel="True" RelativePanel.AlignHorizontalCenterWithPanel="True" Margin="10,10,10,10" Foreground="White" FontSize="24" TextWrapping="WrapWholeWords">
                You must at least open (
                <Span  FontFamily="Segoe MDL2 Assets">&#xe1a5;</Span>
                ) one file, or simply drag n drop files in the window.
            </TextBlock>
        </RelativePanel>
        <RelativePanel x:Name="WaitPanel" Grid.Row="1" Grid.Column="0" Grid.RowSpan="2" Grid.ColumnSpan="3" Background="#FFFFFFFF" Visibility="Collapsed">
            <ProgressRing x:Name="SpinnerRing"  RelativePanel.AlignVerticalCenterWithPanel="True" RelativePanel.AlignHorizontalCenterWithPanel="True" />
        </RelativePanel>
    </Grid>
</Page>
