<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:local="clr-namespace:ForzaUI"
      xmlns:System="clr-namespace:System;assembly=mscorlib"
      x:Class="ForzaUI.A_FMVLoading"
      Style="{StaticResource A_Style_Page_Generic}"
      DataContext="{Binding RelativeSource={RelativeSource Self}}">

    <Page.Resources>
        <Style x:Key="A_Style_FZMaterial_Watermark_Default" TargetType="{x:Type local:FZMaterial}">
            <Setter Property="VerticalAlignment" Value="Top" />
            <Setter Property="HorizontalAlignment" Value="Right" />
            <Setter Property="Width" Value="277" />
            <Setter Property="Height" Value="90" />
            <Setter Property="Visibility" Value="Collapsed" />
            <Setter Property="Opacity" Value="0" />
            <Style.Triggers>
                <DataTrigger Binding="{Binding Visibility, RelativeSource={RelativeSource Self}}" Value="{x:Static Visibility.Visible}">
                    <Trigger.EnterActions>
                        <BeginStoryboard>
                            <Storyboard>
                                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="{x:Null}">
                                    <DiscreteDoubleKeyFrame KeyTime="0:0:0.0" Value="0"/>
                                    <DiscreteDoubleKeyFrame KeyTime="0:0:0.1" Value="0"/>
                                    <LinearDoubleKeyFrame KeyTime="0:0:0.5" Value="1"/>
                                </DoubleAnimationUsingKeyFrames>
                            </Storyboard>
                        </BeginStoryboard>
                    </Trigger.EnterActions>
                </DataTrigger>
            </Style.Triggers>
        </Style>

        <Style x:Key="A_Style_FZMaterial_Watermark_ExpansionOne"
               TargetType="{x:Type local:FZMaterial}"
               BasedOn="{StaticResource A_Style_FZMaterial_Watermark_Default}">
            <Setter Property="Margin" Value="0,59,85,0" />
            <Setter Property="Width" Value="277" />
            <Setter Property="Height" Value="90" />
            <Setter Property="Visibility" Value="Visible" />
            <Setter Property="ImageSourceNoPreload" Value="/ForzaUI;component/Textures/Data_Bound/PDLC1/Logo.png" />
        </Style>

        <Style x:Key="A_Style_FZMaterial_Watermark_ExpansionTwo"
               TargetType="{x:Type local:FZMaterial}"
               BasedOn="{StaticResource A_Style_FZMaterial_Watermark_Default}">
            <Setter Property="Margin" Value="0,60,85,0" />
            <Setter Property="Width" Value="500" />
            <Setter Property="Height" Value="90" />
            <Setter Property="Visibility" Value="Visible" />
            <Setter Property="ImageSourceNoPreload" Value="/ForzaUI;component/Textures/Data_Bound/PDLC2/Logo.png" />
        </Style>

        <local:MappingConverter x:Key="A_Converter_TrackToWatermarkStyle"
                                Default="{StaticResource A_Style_FZMaterial_Watermark_Default}">
            <local:MappingConverterEntry Key="{x:Static local:XAMLTrack.ExpansionOne}" Value="{StaticResource A_Style_FZMaterial_Watermark_ExpansionOne}" />
            <local:MappingConverterEntry Key="{x:Static local:XAMLTrack.ExpansionTwo}" Value="{StaticResource A_Style_FZMaterial_Watermark_ExpansionTwo}" />
        </local:MappingConverter>

        <Style x:Key="A_Style_FrameworkElement_BlackBarStyle"
               TargetType="FrameworkElement">
            <Setter Property="LayoutTransform">
                <Setter.Value>
                    <ScaleTransform ScaleX="1"
                                    ScaleY="{Binding Path=ScaleValue, Source={StaticResource PART_UIResolutionScaler}}" />
                </Setter.Value>
            </Setter>
        </Style>

        <Style x:Key="A_Style_FZTextBlock_TransitionTitle"
                   TargetType="{x:Type local:FZTextBlock}">
            <Setter Property="FontFamily" Value="Horizon_E"/>
            <Setter Property="LineAdjust" Value="0"/>
            <Setter Property="Color" Value="#E5E5E5" />
            <Setter Property="CapHeight" Value="52" />
            <Setter Property="VerticalAlignment" Value="Center" />
            <Setter Property="HorizontalAlignment" Value="Center" />
            <Setter Property="TextAlignment" Value="Center" />
            <Setter Property="MaxWidth" Value="1700" />
            <Setter Property="Opacity" Value="0" />
            <Setter Property="TrackingAdjust" Value="0.273" />
        </Style>

        <KeyTime x:Key="A_KeyTime_Autumn_Start">0:0:3.2</KeyTime>
        <KeyTime x:Key="A_KeyTime_Autumn_Keyframe_1">0:0:3.7</KeyTime>
        <KeyTime x:Key="A_KeyTime_Autumn_Keyframe_2">0:0:6.2</KeyTime>
        <KeyTime x:Key="A_KeyTime_Autumn_End">0:0:6.7</KeyTime>

        <KeyTime x:Key="A_KeyTime_Winter_Start">0:0:3.2</KeyTime>
        <KeyTime x:Key="A_KeyTime_Winter_Keyframe_1">0:0:3.7</KeyTime>
        <KeyTime x:Key="A_KeyTime_Winter_Keyframe_2">0:0:6.2</KeyTime>
        <KeyTime x:Key="A_KeyTime_Winter_End">0:0:6.7</KeyTime>

        <KeyTime x:Key="A_KeyTime_Spring_Start">0:0:3.2</KeyTime>
        <KeyTime x:Key="A_KeyTime_Spring_Keyframe_1">0:0:3.7</KeyTime>
        <KeyTime x:Key="A_KeyTime_Spring_Keyframe_2">0:0:6.2</KeyTime>
        <KeyTime x:Key="A_KeyTime_Spring_End">0:0:6.7</KeyTime>

        <KeyTime x:Key="A_KeyTime_Summer_Start">0:0:3.2</KeyTime>
        <KeyTime x:Key="A_KeyTime_Summer_Keyframe_1">0:0:3.7</KeyTime>
        <KeyTime x:Key="A_KeyTime_Summer_Keyframe_2">0:0:6.2</KeyTime>
        <KeyTime x:Key="A_KeyTime_Summer_End">0:0:6.7</KeyTime>
    </Page.Resources>

    <local:UIPageTransitionManager.TransitionManager>
        <local:UIPageTransitionManager />
    </local:UIPageTransitionManager.TransitionManager>

    <Grid x:Name="LayoutRoot"
          Background="Black">
        <VisualStateManager.VisualStateGroups>
            <VisualStateGroup x:Name="TitleState">
                <VisualState x:Name="Autumn">
                    <Storyboard>
                        <StringAnimationUsingKeyFrames Storyboard.TargetProperty="Text" Storyboard.TargetName="TitleText">
                            <DiscreteStringKeyFrame KeyTime="0" Value="{local:Loc InGame.IDS_InitialDriveTransitionAutumn_Title1}"/>
                        </StringAnimationUsingKeyFrames>
                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="TitleText">
                            <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Autumn_Start}" Value="0"/>
                            <LinearDoubleKeyFrame   KeyTime="{StaticResource A_KeyTime_Autumn_Keyframe_1}" Value="0.9"/>
                            <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Autumn_Keyframe_2}" Value="0.9"/>
                            <LinearDoubleKeyFrame   KeyTime="{StaticResource A_KeyTime_Autumn_End}" Value="0"/>
                        </DoubleAnimationUsingKeyFrames>
                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="TrackingAdjust" Storyboard.TargetName="TitleText">
                            <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Autumn_Start}" Value="0.8"/>
                            <LinearDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Autumn_End}" Value="1.05"/>
                        </DoubleAnimationUsingKeyFrames>
                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="ScaleX" Storyboard.TargetName="TitleTextScaler">
                            <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Autumn_Start}" Value="1"/>
                            <LinearDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Autumn_End}" Value="1.08"/>
                        </DoubleAnimationUsingKeyFrames>
                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="ScaleY" Storyboard.TargetName="TitleTextScaler">
                            <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Autumn_Start}" Value="1"/>
                            <LinearDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Autumn_End}" Value="1.08"/>
                        </DoubleAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
                <VisualState x:Name="Winter">
                    <Storyboard>
                        <StringAnimationUsingKeyFrames Storyboard.TargetProperty="Text" Storyboard.TargetName="TitleText">
                            <DiscreteStringKeyFrame KeyTime="0" Value="{local:Loc InGame.IDS_InitialDriveTransitionWinter_Title1}"/>
                        </StringAnimationUsingKeyFrames>
                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="TitleText">
                            <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Winter_Start}" Value="0"/>
                            <LinearDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Winter_Keyframe_1}" Value="0.9"/>
                            <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Winter_Keyframe_2}" Value="0.9"/>
                            <LinearDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Winter_End}" Value="0"/>
                        </DoubleAnimationUsingKeyFrames>
                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="TrackingAdjust" Storyboard.TargetName="TitleText">
                            <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Winter_Start}" Value="0.8"/>
                            <LinearDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Winter_End}" Value="1.0"/>
                        </DoubleAnimationUsingKeyFrames>
                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="ScaleX" Storyboard.TargetName="TitleTextScaler">
                            <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Winter_Start}" Value="1"/>
                            <LinearDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Winter_End}" Value="1.08"/>
                        </DoubleAnimationUsingKeyFrames>
                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="ScaleY" Storyboard.TargetName="TitleTextScaler">
                            <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Winter_Start}" Value="1"/>
                            <LinearDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Winter_End}" Value="1.08"/>
                        </DoubleAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
                <VisualState x:Name="Spring">
                    <Storyboard>
                        <StringAnimationUsingKeyFrames Storyboard.TargetProperty="Text" Storyboard.TargetName="TitleText">
                            <DiscreteStringKeyFrame KeyTime="0" Value="{local:Loc InGame.IDS_InitialDriveTransitionSpring_Title1}"/>
                        </StringAnimationUsingKeyFrames>
                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="TitleText">
                            <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Spring_Start}" Value="0"/>
                            <LinearDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Spring_Keyframe_1}" Value="0.9"/>
                            <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Spring_Keyframe_2}" Value="0.9"/>
                            <LinearDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Spring_End}" Value="0"/>
                        </DoubleAnimationUsingKeyFrames>
                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="TrackingAdjust" Storyboard.TargetName="TitleText">
                            <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Spring_Start}" Value="0.8"/>
                            <LinearDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Spring_End}" Value="1.0"/>
                        </DoubleAnimationUsingKeyFrames>
                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="ScaleX" Storyboard.TargetName="TitleTextScaler">
                            <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Spring_Start}" Value="1"/>
                            <LinearDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Spring_End}" Value="1.08"/>
                        </DoubleAnimationUsingKeyFrames>
                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="ScaleY" Storyboard.TargetName="TitleTextScaler">
                            <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Spring_Start}" Value="1"/>
                            <LinearDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Spring_End}" Value="1.08"/>
                        </DoubleAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
                <VisualState x:Name="Summer">
                    <Storyboard>
                        <StringAnimationUsingKeyFrames Storyboard.TargetProperty="Text" Storyboard.TargetName="TitleText">
                            <DiscreteStringKeyFrame KeyTime="0" Value="{local:Loc InGame.IDS_InitialDriveTransitionSummer_Title1}"/>
                        </StringAnimationUsingKeyFrames>
                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="TitleText">
                            <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Summer_Start}" Value="0"/>
                            <LinearDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Summer_Keyframe_1}" Value="0.9"/>
                            <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Summer_Keyframe_2}" Value="0.9"/>
                            <LinearDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Summer_End}" Value="0"/>
                        </DoubleAnimationUsingKeyFrames>
                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="TrackingAdjust" Storyboard.TargetName="TitleText">
                            <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Summer_Start}" Value="0.9"/>
                            <LinearDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Summer_End}" Value="1.05"/>
                        </DoubleAnimationUsingKeyFrames>
                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="ScaleX" Storyboard.TargetName="TitleTextScaler">
                            <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Summer_Start}" Value="1"/>
                            <LinearDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Summer_End}" Value="1.08"/>
                        </DoubleAnimationUsingKeyFrames>
                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="ScaleY" Storyboard.TargetName="TitleTextScaler">
                            <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Summer_Start}" Value="1"/>
                            <LinearDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Summer_End}" Value="1.08"/>
                        </DoubleAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>

        <Viewbox Stretch="Uniform">
            <MediaElement x:Name="Video" Style="{StaticResource A_Style_ScreenSize}"/>
        </Viewbox>

        <Grid Style="{StaticResource A_Style_FrameworkElement_BlackBarStyle}"
              VerticalAlignment="Top">
            <local:FZMaterial x:Name="TopBar" Color="Black" Height="194" VerticalAlignment="Top" Style="{StaticResource A_Style_Transition_BlackBar}"/>
        </Grid>

        <Grid Style="{StaticResource A_Style_FrameworkElement_BlackBarStyle}"
              VerticalAlignment="Bottom">
            <local:FZMaterial x:Name="BottomBar" Color="Black" Height="194" VerticalAlignment="Bottom" Style="{StaticResource A_Style_Transition_BlackBar}"/>
        </Grid>

        <Grid Style="{StaticResource A_Style_FrameworkElement_LayoutRoot}"
              VerticalAlignment="Bottom">            
            <Control Style="{StaticResource A_Style_Control_Loading_StatsDisplay}" DataContext="{Binding Stats}"/>
            <ContentControl Style="{StaticResource A_Style_ContentControl_LoadingSpinnerWithMessage}"
                Content="{Binding LoadingReason}"/>
            <local:FZMaterial Style="{Binding CurrentVideoTrack, Converter={StaticResource A_Converter_TrackToWatermarkStyle}}" />

            <Decorator RenderTransformOrigin="0.5,0.5">
                <Decorator.RenderTransform>
                    <TransformGroup>
                        <ScaleTransform x:Name="TitleTextScaler" />
                        <ScaleTransform ScaleX="1.25" ScaleY="1.0" />
                    </TransformGroup>
                </Decorator.RenderTransform>
                <local:FZTextBlock x:Name="TitleText" Style="{StaticResource A_Style_FZTextBlock_TransitionTitle}" />
            </Decorator>
        </Grid>
    </Grid>
</Page>