<Page x:Class="ForzaUI.Scenes.Anthem.A_FileOptions"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      xmlns:System="clr-namespace:System;assembly=mscorlib"
      mc:Ignorable="d"
      xmlns:local="clr-namespace:ForzaUI"
      Style="{StaticResource A_Style_Page_Generic}"
      DataContext="{Binding RelativeSource={RelativeSource Self}}">

    <local:UIPageTransitionManager.TransitionManager>
        <local:UIPageTransitionManager Preset="{StaticResource A_UIPageTransitionManagerPreset_Popup}"/>
    </local:UIPageTransitionManager.TransitionManager>

    <Page.Resources>
        <ResourceDictionary>
            <Color x:Key="A_Color_Element">#FFFFFFFF</Color>
            <Color x:Key="A_Color_Divider">#FF969696</Color>
            <Color x:Key="A_Color_FileName">#FFFFFFFF</Color>

            <Style x:Key="A_Style_FZTextBlock_TitleElement" TargetType="{x:Type local:FZTextBlock}" BasedOn="{StaticResource A_Style_FZTextBlock_Heading_ExtraSmallInactive}">
                <Setter Property="Margin" Value="0" />
                <Setter Property="HorizontalAlignment"
                        Value="Left" />
                <Setter Property="VerticalAlignment"
                        Value="Top" />
                <Setter Property="CapHeight"
                        Value="15" />
                <Setter Property="Color"
                        Value="{StaticResource A_Color_Element}" />
            </Style>

            <Style x:Key="A_Style_FZTextBlock_InfoElement"
                   TargetType="{x:Type local:FZTextBlock}"
                   BasedOn="{StaticResource A_Style_FZTextBlock_HorizonB}">
                <Setter Property="Margin" Value="0" />
                <Setter Property="HorizontalAlignment"
                        Value="Left" />
                <Setter Property="VerticalAlignment"
                        Value="Top" />
                <Setter Property="Color"
                        Value="{StaticResource A_Color_Element}" />
                <Setter Property="CapHeight"
                        Value="25" />
            </Style>

            <Style x:Key="A_Style_FZTextBlock_FileNameElement" TargetType="{x:Type local:FZTextBlock}" BasedOn="{StaticResource A_Style_FZTextBlock_HorizonB}">
                <Setter Property="HorizontalAlignment" Value="Left" />
                <Setter Property="VerticalAlignment"
                        Value="Top" />
                <Setter Property="Color"
                        Value="{StaticResource A_Color_FileName}" />
                <Setter Property="TextWrapping"
                        Value="Wrap" />
                <Setter Property="CapHeight"
                        Value="25" />
            </Style>

            <Style x:Key="A_Style_FZMaterial_Divider"
                   TargetType="{x:Type local:FZMaterial}">
                <Setter Property="Color"
                        Value="{StaticResource A_Color_Divider}" />
                <Setter Property="Margin" 
                        Value="-10,0,10,0" />
            </Style>

            <Style x:Key="A_Style_FZMaterial_PopularityBacking"
                   TargetType="{x:Type local:FZMaterial}">
                <Setter Property="Color"
                        Value="#33000000" />
                <Style.Triggers>
                    <DataTrigger Binding="{Binding FileType}" Value="7"> <!-- Photo -->
                        <Setter Property="Color"
                        Value="#66000000" />
                    </DataTrigger>
                </Style.Triggers>
            </Style>

            <Style x:Key="A_Style_DockPanel_ShareStats"
                   TargetType="{x:Type DockPanel}">
                <Setter Property="LastChildFill"
                        Value="False" />
                <Setter Property="Margin"
                        Value="0,25,0,0" />
            </Style>

            <Style x:Key="A_Style_DockPanel_DownloadStats"
                   BasedOn="{StaticResource A_Style_DockPanel_ShareStats}"
                   TargetType="{x:Type DockPanel}">
                <Style.Triggers>
                    <DataTrigger Binding="{Binding ShowShareStats}" Value="False">
                        <Setter Property="Visibility" Value="Collapsed"/>
                    </DataTrigger>
                </Style.Triggers>
            </Style>

            <Style x:Key="A_Style_DockPanel_UsageStats"
                   BasedOn="{StaticResource A_Style_DockPanel_ShareStats}"
                   TargetType="{x:Type DockPanel}">
                <Style.Triggers>
                    <DataTrigger Binding="{Binding ShowShareStats}" Value="False">
                        <Setter Property="Visibility" Value="Collapsed"/>
                    </DataTrigger>
                    <DataTrigger Binding="{Binding ShowUsageStats}" Value="False">
                        <Setter Property="Visibility" Value="Collapsed"/>
                    </DataTrigger>
                </Style.Triggers>
            </Style>

            <Style x:Key="A_Style_DockPanel_LikeStats"
                   BasedOn="{StaticResource A_Style_DockPanel_ShareStats}"
                   TargetType="{x:Type DockPanel}">
                <Style.Triggers>
                    <DataTrigger Binding="{Binding ShowShareStats}" Value="False">
                        <Setter Property="Visibility" Value="Collapsed"/>
                    </DataTrigger>
                    <DataTrigger Binding="{Binding ShowLikeStats}" Value="False">
                        <Setter Property="Visibility" Value="Collapsed"/>
                    </DataTrigger>
                </Style.Triggers>
            </Style>

            <Style x:Key="A_Style_FZMaterial_Thumbnail"
                   TargetType="{x:Type local:FZMaterial}">
                <Setter Property="Stretch" Value="UniformToFill"/>
                <Setter Property="StretchDirection" Value="Both"/>
                <Setter Property="GreedyMeasure" Value="True"/>
                <Setter Property="HorizontalAlignment" Value="Center"/>
                <Setter Property="Visibility" Value="{Binding ShouldShowThumbnail, Converter={StaticResource A_FZBooleanToVisibilityConverter}}"/>
                <Setter Property="Height" Value="330"/>
                <Style.Triggers>
                    <DataTrigger Binding="{Binding FileType}" Value="2"> <!-- LayerGroup -->
                        <Setter Property="Height" Value="170"/>
                        <Setter Property="Width" Value="170"/>
                        <Setter Property="Width" Value="170"/>
                        <Setter Property="GreedyMeasure" Value="False"/>
                        <Setter Property="VerticalAlignment" Value="Top"/>
                        <Setter Property="Margin" Value="0,28,0,86"/>
                    </DataTrigger>
                    <MultiDataTrigger>
                        <MultiDataTrigger.Conditions>
                            <Condition Binding="{Binding FileType}" Value="2"/> <!-- LayerGroup -->
                            <Condition Binding="{Binding ShowShareStats}" Value="True"/>
                        </MultiDataTrigger.Conditions>
                        <Setter Property="Margin" Value="0,28,0,130"/>
                    </MultiDataTrigger>
                    <DataTrigger Binding="{Binding FileType}" Value="3"> <!-- Livery -->
                        <Setter Property="Height" Value="300"/>
                        <Setter Property="Stretch" Value="Uniform"/>
                        <Setter Property="Margin" Value="-10,0,0,40"/>
                    </DataTrigger>
                    <MultiDataTrigger>
                        <MultiDataTrigger.Conditions>
                            <Condition Binding="{Binding FileType}" Value="3"/> <!-- Livery -->
                            <Condition Binding="{Binding ShowShareStats}" Value="True"/>
                        </MultiDataTrigger.Conditions>
                        <Setter Property="Margin" Value="-10,0,0,90"/>
                    </MultiDataTrigger>
                    <DataTrigger Binding="{Binding FileType}" Value="4"> <!-- BaseLivery -->
                        <Setter Property="Height" Value="300"/>
                        <Setter Property="Stretch" Value="Uniform"/>
                        <Setter Property="Margin" Value="-10,0,0,40"/>
                    </DataTrigger>
                    <MultiDataTrigger>
                        <MultiDataTrigger.Conditions>
                            <Condition Binding="{Binding FileType}" Value="4"/> <!-- BaseLivery -->
                            <Condition Binding="{Binding ShowShareStats}" Value="True"/>
                        </MultiDataTrigger.Conditions>
                        <Setter Property="Margin" Value="-10,0,0,90"/>
                    </MultiDataTrigger>
                    <DataTrigger Binding="{Binding FileType}" Value="5"> <!-- SoulboundLivery -->
                        <Setter Property="Height" Value="300"/>
                        <Setter Property="Stretch" Value="Uniform"/>
                        <Setter Property="Margin" Value="-10,0,0,40"/>
                    </DataTrigger>
                    <MultiDataTrigger>
                        <MultiDataTrigger.Conditions>
                            <Condition Binding="{Binding FileType}" Value="5"/> <!-- SoulboundLivery -->
                            <Condition Binding="{Binding ShowShareStats}" Value="True"/>
                        </MultiDataTrigger.Conditions>
                        <Setter Property="Margin" Value="-10,0,0,90"/>
                    </MultiDataTrigger>
                </Style.Triggers>
            </Style>

            <DataTemplate x:Key="A_DataTemplate_TextMenu_FileOption">
                <Grid IsHitTestVisible="False" Height="{StaticResource A_Double_TextMenu_Height_Default}">
                    <local:FZTextBlock Text="{Binding Text, Converter={StaticResource A_StringToUpper}}" Style="{StaticResource A_Style_FZTextBlock_OptionText}" TextAlignment="Center" />
                </Grid>
            </DataTemplate>

            <System:Double x:Key="A_Double_Privacy_Separator">8</System:Double>
            <System:Double x:Key="A_Double_Privacy_Separator_CHS">14</System:Double>
            <System:Double x:Key="A_Double_Privacy_Separator_CHT">14</System:Double>

        </ResourceDictionary>
    </Page.Resources>

    <Grid x:Name="LayoutRoot">
        <!-- Background Blur -->
        <local:FZMaterialGlassCapture />
        <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_Popup_Background}"/>

        <!-- Bars -->
        <local:PlayerBarControl x:Name="TopBar" Style="{StaticResource A_Style_PlayerBarControl}" />
        <ContentControl x:Name="BottomBar" Style="{StaticResource A_Style_ButtonBar}">
            <ContentControl x:Name="DefaultHelpPanel"
                            Style="{StaticResource A_Style_ContentControl_DefaultButtonBar}" />
        </ContentControl>

        <Grid Style="{StaticResource A_Style_FrameworkElement_LayoutRoot}">
            <StackPanel x:Name="MainContent"
                        HorizontalAlignment="Center"
                        VerticalAlignment="Center"
                        Width="{StaticResource A_Double_MessageBox_Width}"
                        Style="{StaticResource A_Style_FrameworkElement_DefaultTransition_0}">

                <ContentControl Style="{StaticResource A_Style_ContentControl_PopupTitleBlock}"
                                Content="{local:Loc Main.IDS_LoadSave_FileOptions}" />

                <ContentControl Style="{StaticResource A_Style_ContentControl_PopupContentBlock_IconFront}"
                                Tag="/ForzaUI;component/Textures/Anthem/Icons/Titles/PopupSettings.png">
                    <Decorator Height="Auto"
                           Width="Auto">
                        <DockPanel LastChildFill="False">
                            <local:CommonListBox x:Name="Menu"
                                                 DockPanel.Dock="Bottom"
                                                 Style="{StaticResource A_Style_ListBox_TextMenu_Default}"
                                                 ItemTemplate="{StaticResource A_DataTemplate_TextMenu_FileOption}"
                                                 ItemsSource="{Binding Options}" Margin="-8,0,-8,-8"/>

                            <StackPanel DockPanel.Dock="Bottom" Visibility="{Binding ShowDescription, Converter={StaticResource A_FZBooleanToVisibilityConverter}}">
                                <local:FZTextBlock Text="{local:Loc Storefront.IDS_LabelDescription}"
                                                   Style="{StaticResource A_Style_FZTextBlock_TitleElement}" />
                                <local:FZTextBlock Text="{Binding Description}"
                                                   Style="{StaticResource A_Style_FZTextBlock_Body}"
                                                   Color="{StaticResource A_Color_Body_Text}"
                                                   CapHeight="15"
                                                   Margin="0,8,0,20"
                                                   TextWrapping="Wrap"
                                                   MaxHeight="200"/>
                            </StackPanel>

                            <StackPanel DockPanel.Dock="Bottom">
                                <Grid>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="*" />
                                        <ColumnDefinition Width="*" />
                                        <ColumnDefinition Width="*" />
                                    </Grid.ColumnDefinitions>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="*"/>
                                        <RowDefinition Height="*"/>
                                    </Grid.RowDefinitions>
                                    <StackPanel Grid.Column="0" Grid.Row="0" >
                                        <local:FZTextBlock Text="{local:Loc Storefront.IDS_LabelCreator}"
                                                           Style="{StaticResource A_Style_FZTextBlock_TitleElement}"/>
                                        <Decorator Height="8" />
                                        <local:FZTextBlock Text="{Binding Creator.FormattedGamertag}"
                                                           Style="{StaticResource A_Style_FZTextBlock_InfoElement}"/>
                                    </StackPanel>

                                    <DockPanel Grid.Column="2" Grid.Row="0" LastChildFill="False" Visibility="{Binding ShowPrivacy, Converter={StaticResource A_FZBooleanToVisibilityConverter}}">
                                        <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_Divider}"
                                                          Width="1.5"
                                                          DockPanel.Dock="Left"/>
                                        <local:FZTextBlock Text="{local:Loc Storefront.IDS_PrivacyTitle}"
                                                          Style="{StaticResource A_Style_FZTextBlock_TitleElement}"
                                                          DockPanel.Dock="Top"/>
                                        <Decorator Height="{local:LocalizedResource A_Double_Privacy_Separator}" DockPanel.Dock="Top"/>
                                        <local:FZTextBlock Text="{Binding ShareStatus, Converter={StaticResource A_StringToUpper}}"
                                                           Style="{StaticResource A_Style_FZTextBlock_InfoElement}"
                                                           DockPanel.Dock="Top"/>
                                    </DockPanel>
                                    <DockPanel Grid.Column="0" Grid.Row="2" Style="{StaticResource A_Style_DockPanel_DownloadStats}">
                                        <local:FZTextBlock Text="{local:Loc Storefront.IDS_NumberDownloads}"
                                                           Style="{StaticResource A_Style_FZTextBlock_TitleElement}"
                                                           DockPanel.Dock="Top"/>
                                        <Decorator Height="8" DockPanel.Dock="Top"/>
                                        <local:FZTextBlock Text="{Binding DownloadCount}"
                                                           Style="{StaticResource A_Style_FZTextBlock_InfoElement}"
                                                           DockPanel.Dock="Top"/>
                                    </DockPanel>
                                    <DockPanel Grid.Column="1" Grid.Row="2" Style="{StaticResource A_Style_DockPanel_UsageStats}">
                                        <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_Divider}"
                                                          Width="1.5"
                                                          DockPanel.Dock="Left"/>
                                        <local:FZTextBlock Text="{local:Loc Storefront.IDS_NumberUses}"
                                                           Style="{StaticResource A_Style_FZTextBlock_TitleElement}"
                                                           DockPanel.Dock="Top"/>
                                        <Decorator Height="8" DockPanel.Dock="Top"/>
                                        <local:FZTextBlock Text="{Binding UseCount}"
                                                           Style="{StaticResource A_Style_FZTextBlock_InfoElement}"
                                                           DockPanel.Dock="Top"/>
                                    </DockPanel>
                                    <DockPanel Grid.Column="2" Grid.Row="2" Style="{StaticResource A_Style_DockPanel_LikeStats}">
                                        <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_Divider}"
                                                          Width="1.5"
                                                          DockPanel.Dock="Left"/>
                                        <local:FZTextBlock Text="{local:Loc Storefront.IDS_NumberLikes}"
                                                           Style="{StaticResource A_Style_FZTextBlock_TitleElement}"
                                                           DockPanel.Dock="Top"/>
                                        <Decorator Height="8" DockPanel.Dock="Top"/>
                                        <local:FZTextBlock Text="{Binding LikeCount}"
                                                           Style="{StaticResource A_Style_FZTextBlock_InfoElement}"
                                                           DockPanel.Dock="Top"/>
                                    </DockPanel>
                                </Grid>
                                <Decorator Height="26" />
                            </StackPanel>

                            <Grid DockPanel.Dock="Top" VerticalAlignment="Top" Margin="-24,-36,-24,0">
                                <Grid ClipToBounds="True">
                                    <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_Thumbnail}" ImageSource="{Binding Thumbnail}"/>
                                </Grid>

                                <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_PopularityBacking}" VerticalAlignment="Bottom">
                                    <StackPanel Margin="18">
                                        <local:FZTextBlock DockPanel.Dock="Top"
                                                Text="{Binding Filename, Converter={StaticResource A_StringToUpper}}"
                                                Style="{StaticResource A_Style_FZTextBlock_FileNameElement}"
                                                HorizontalAlignment="Center"/>
                                        <local:DeltaProgressBar x:Name="Value_Popularity"
                                                            BaseValue="{Binding Popularity}"
                                                            NewValue="{Binding Popularity}"
                                                            Style="{StaticResource A_Style_DeltaProgressBar_Popularity}"
                                                            local:BindingProxy.A="#40FFFFFF"
                                                            Visibility="{Binding ShowShareStats, Converter={StaticResource A_Converter_BoolToVis}}"
                                                            Margin="-4,10,0,0" 
                                                            HorizontalAlignment="Center"/>
                                    </StackPanel>
                                </local:FZMaterial>
                            </Grid>

                            <StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal" Margin="0,26,0,0" Width="Auto">
                                <Grid>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="358" />
                                        <ColumnDefinition Width="120" />
                                    </Grid.ColumnDefinitions>
                                </Grid>
                            </StackPanel>
                        </DockPanel>
                    </Decorator>

                </ContentControl>
            </StackPanel>
        </Grid>
    </Grid>
</Page>
