<Page xmlns:local="clr-namespace:ForzaUI"
      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"
      x:Class="ForzaUI.A_PostRaceChampionshipComplete"
      mc:Ignorable="d"
      Style="{StaticResource A_Style_Page_Generic}"
      DataContext="{Binding RelativeSource={RelativeSource Self}}">

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

    <Page.Resources>
        <ResourceDictionary>
            <Style x:Key="A_Style_FZTextBlock_ChampionshipComplete_Text" TargetType="local:FZTextBlock" 
                   BasedOn="{StaticResource A_Style_FZTextBlock_HorizonA}">
                <Setter Property="Color" Value="#FFFFFF" />
                <Setter Property="FontSize" Value="105" />
                <Setter Property="Margin" Value="38,27" />
            </Style>

            <Style x:Key="A_Style_FZMaterial_ChampionshipComplete_Block" TargetType="local:FZMaterial" 
                   BasedOn="{StaticResource A_Style_FZMaterial_AcrylicPanel_Highlight}">
                <Setter Property="HorizontalAlignment" Value="Left" />
            </Style>

            <Style x:Key="A_Style_FrameworkElement_Animatable" TargetType="FrameworkElement">
                <Setter Property="Effect" Value="{StaticResource A_MotionBlurEffect}" />
                <Setter Property="local:MotionBlurEffect.MotionBlurPositionXControl" 
                    Value="{Binding (UIElement.RenderTransform).(TranslateTransform.X), RelativeSource={RelativeSource Self}}" />
                <Setter Property="RenderTransform">
                    <Setter.Value>
                        <TranslateTransform />
                    </Setter.Value>
                </Setter>
                <Setter Property="local:UIPageTransitionManager.TransitionIndex" Value="0" />
            </Style>

            <Style x:Key="A_Style_FrameworkElement_FlyerAnimation" TargetType="FrameworkElement"
                   BasedOn="{StaticResource A_Style_FrameworkElement_Animatable}">
                <Style.Resources>
                    <Storyboard x:Key="transition_in">
                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)"
                                                   Storyboard.TargetName="{x:Null}">
                            <DiscreteDoubleKeyFrame KeyTime="0:0:0"
                                                Value="-2000" />
                            <EasingDoubleKeyFrame KeyTime="0:0:0.3"
                                              Value="0.0">
                                <EasingDoubleKeyFrame.EasingFunction>
                                    <CubicEase EasingMode="EaseIn" />
                                </EasingDoubleKeyFrame.EasingFunction>
                            </EasingDoubleKeyFrame>
                        </DoubleAnimationUsingKeyFrames>
                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)"
                                                   Storyboard.TargetName="{x:Null}">
                            <DiscreteDoubleKeyFrame KeyTime="0:0:0.0"
                                                Value="0.0" />
                            <EasingDoubleKeyFrame KeyTime="0:0:0.3"
                                              Value="1.0" />
                        </DoubleAnimationUsingKeyFrames>
                        <StringAnimationUsingKeyFrames Storyboard.TargetProperty="(local:EventFire.EventName)"
                                                       Storyboard.TargetName="EventFire" FillBehavior="Stop">
                            <DiscreteStringKeyFrame KeyTime="0:0:0" Value=""/>
                            <DiscreteStringKeyFrame KeyTime="0:0:1.0" Value="Complete"/>
                            <DiscreteStringKeyFrame KeyTime="0:0:3.0" Value="AutoContinue"/>
                            <DiscreteStringKeyFrame KeyTime="0:0:3.5" Value=""/>
                        </StringAnimationUsingKeyFrames>
                    </Storyboard>
                    <Storyboard x:Key="transition_out_forward">
                    </Storyboard>
                    <Storyboard x:Key="transition_out_back">
                    </Storyboard>
                </Style.Resources>
            </Style>

            <Style x:Key="A_Style_FrameworkElement_TextAnimation" TargetType="FrameworkElement"
                   BasedOn="{StaticResource A_Style_FrameworkElement_Animatable}">
                <Style.Resources>
                    <Storyboard x:Key="transition_in">
                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)"
                                                   Storyboard.TargetName="{x:Null}">
                            <DiscreteDoubleKeyFrame KeyTime="0:0:0"
                                                Value="2000" />
                            <EasingDoubleKeyFrame KeyTime="0:0:0.3"
                                              Value="0.0">
                                <EasingDoubleKeyFrame.EasingFunction>
                                    <CubicEase EasingMode="EaseIn" />
                                </EasingDoubleKeyFrame.EasingFunction>
                            </EasingDoubleKeyFrame>
                        </DoubleAnimationUsingKeyFrames>
                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)"
                                                   Storyboard.TargetName="{x:Null}">
                            <DiscreteDoubleKeyFrame KeyTime="0:0:0.0"
                                                Value="0.0" />
                            <EasingDoubleKeyFrame KeyTime="0:0:0.3"
                                              Value="1.0" />
                        </DoubleAnimationUsingKeyFrames>
                    </Storyboard>
                    <Storyboard x:Key="transition_out_forward">
                    </Storyboard>
                    <Storyboard x:Key="transition_out_back">
                    </Storyboard>
                </Style.Resources>
            </Style>
        </ResourceDictionary>
    </Page.Resources>

    <Grid>
        <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}">
            <DockPanel Margin="184,122,0,0"
                     HorizontalAlignment="Left"
                     VerticalAlignment="Top">
                <Decorator x:Name="FlyerAnimationContainer" 
                         Style="{StaticResource A_Style_FrameworkElement_FlyerAnimation}"
                         DockPanel.Dock="Left">
                    <Grid>
                        <local:EventFire x:Name="EventFire" />
                        <ContentControl x:Name="PART_Flyer" 
                                      Style="{StaticResource A_Style_ContentControl_CampaignFlyerFront}"
                                      DataContext="{Binding CampaignSetup}" />
                        <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_MotionBlurExpander}" Margin="-400,0" />
                    </Grid>
                </Decorator>
                <Decorator x:Name="TextAnimationContainer" 
                         Style="{StaticResource A_Style_FrameworkElement_TextAnimation}"
                         Margin="10,90,0,0" VerticalAlignment="Top">
                    <Grid>
                        <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_MotionBlurExpander}" Margin="-300,0" />
                        <StackPanel>
                            <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_ChampionshipComplete_Block}" 
                                        Visibility="{Binding Text, ElementName=Line1Text, Converter={StaticResource A_StringVisConverter}}">
                                <local:FZTextBlock x:Name="Line1Text" Text="{local:Loc InGame.IDS_PostRace_ChampionshipCompleteLine1}" 
                                     Style="{StaticResource A_Style_FZTextBlock_ChampionshipComplete_Text}"  />
                            </local:FZMaterial>
                            <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_ChampionshipComplete_Block}" Margin="0,10,0,0" 
                                        Visibility="{Binding Text, ElementName=Line2Text, Converter={StaticResource A_StringVisConverter}}">
                                <local:FZTextBlock  x:Name="Line2Text" Text="{local:Loc InGame.IDS_PostRace_ChampionshipCompleteLine2}" 
                                         Style="{StaticResource A_Style_FZTextBlock_ChampionshipComplete_Text}" />
                            </local:FZMaterial>
                        </StackPanel>
                    </Grid>
                </Decorator>
            </DockPanel>
        </Grid>
    </Grid>
</Page>
