<Page HorizontalAlignment="Center"
      RenderTransformOrigin="0.5,0.5"
      VerticalAlignment="Center"
      mc:Ignorable="d"
      x:Class="ForzaUI.Scenes.Anthem.AR_Activation"
      x:Name="page"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:ForzaUI="clr-namespace:ForzaUI;assembly="
      xmlns:System="clr-namespace:System;assembly=mscorlib"
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      xmlns:local="clr-namespace:ForzaUI;assembly="
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      Style="{StaticResource A_PageStyle_AR_Activation}">
    <Page.Resources>
        <Color x:Key="A_Color_ActivationPreNameText">#FF00FFEF</Color>
        <Color x:Key="A_Color_ActivationNameText">#FFFFFFFF</Color>
        <Style TargetType="{x:Type local:FZTextBlock}"
               x:Key="A_Style_ActivationNameTextTop" 
               BasedOn="{StaticResource A_Style_FZTextBlock_HorizonC}">
            <Setter Property="Color"
                    Value="{StaticResource A_Color_ActivationNameText}"/>
            <Setter Property="FontSize"
                    Value="48" />
        </Style>
        <Style TargetType="{x:Type local:FZTextBlock}"
               x:Key="A_Style_ActivationNameTextBottom" 
               BasedOn="{StaticResource A_Style_FZTextBlock_HorizonA}">
            <Setter Property="Color"
                    Value="{StaticResource A_Color_ActivationNameText}"/>
            <Setter Property="FontSize"
                    Value="88" />
        </Style>
        <Style BasedOn="{StaticResource A_Style_FZTextBlock_HorizonB}"
               TargetType="{x:Type local:FZTextBlock}"
               x:Key="A_Style_ActivationPreNameText">
            <Setter Property="FontSize"
                    Value="48" />
            <Setter Property="Color"
                    Value="{StaticResource A_Color_ActivationPreNameText}"/>
        </Style>
        <Style TargetType="{x:Type local:FZMaterial}"
               x:Key="A_Style_ARUITetherLine">
            <Setter Property="Width"
                    Value="4" />
            <Setter Property="Color"
                    Value="{StaticResource A_Color_Tile_Background}" />
        </Style>
        <Style TargetType="{x:Type local:FZRun}"
               x:Key="A_Style_Run_ActivationName_0">
            <Setter Property="FontFamily"
                    Value="Horizon_B"/>
        </Style>
        <QuarticEase x:Key="A_EasingFunction_EaseInOut" EasingMode="EaseInOut" />
        <QuarticEase x:Key="A_EasingFunction_EaseOut" EasingMode="EaseOut" />
        <QuarticEase x:Key="A_EasingFunction_EaseIn" EasingMode="EaseIn" />
        <local:UIStoryboard DurationOverride="0:0:2.5"
                            x:Key="A_Storyboard_AR_Appear">
            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="LongStalk"
                                           Storyboard.TargetProperty="Tag">
                <DiscreteDoubleKeyFrame KeyTime="0"
                                      Value="1"/>
                <DiscreteDoubleKeyFrame KeyTime="0:0:0.6"
                                      Value="1"/>
                <EasingDoubleKeyFrame KeyTime="0:0:1.8"
                                      Value="0"
                                      EasingFunction="{StaticResource A_EasingFunction_EaseOut}"/>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="TopValue"
                                           Storyboard.TargetProperty="Tag"
                                           FillBehavior="Stop">
                <DiscreteDoubleKeyFrame KeyTime="0:0:0"
                                        Value="1" />
                <EasingDoubleKeyFrame KeyTime="0:0:0.4"
                                      Value="1"
                                      EasingFunction="{StaticResource A_EasingFunction_EaseInOut}"/>
                <EasingDoubleKeyFrame KeyTime="0:0:1.1"
                                      Value="0"
                                      EasingFunction="{StaticResource A_EasingFunction_EaseInOut}"/>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="TopValue2"
                                           Storyboard.TargetProperty="Tag"
                                           FillBehavior="Stop">
                <DiscreteDoubleKeyFrame KeyTime="0:0:0"
                                        Value="1" />
                <EasingDoubleKeyFrame KeyTime="0:0:0.5"
                                      Value="1"
                                      EasingFunction="{StaticResource A_EasingFunction_EaseInOut}"/>
                <EasingDoubleKeyFrame KeyTime="0:0:1.2"
                                      Value="0"
                                      EasingFunction="{StaticResource A_EasingFunction_EaseInOut}"/>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="TopValueUndiscovered"
                                           Storyboard.TargetProperty="Tag">
                <DiscreteDoubleKeyFrame KeyTime="0:0:0"
                                        Value="1" />
                <EasingDoubleKeyFrame KeyTime="0:0:0.4"
                                      Value="1"
                                      EasingFunction="{StaticResource A_EasingFunction_EaseInOut}"/>
                <EasingDoubleKeyFrame KeyTime="0:0:1.1"
                                      Value="0"
                                      EasingFunction="{StaticResource A_EasingFunction_EaseInOut}"/>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="TopValueUndiscovered2"
                                           Storyboard.TargetProperty="Tag">
                <DiscreteDoubleKeyFrame KeyTime="0:0:0"
                                        Value="1" />
                <EasingDoubleKeyFrame KeyTime="0:0:0.5"
                                      Value="1"
                                      EasingFunction="{StaticResource A_EasingFunction_EaseInOut}"/>
                <EasingDoubleKeyFrame KeyTime="0:0:1.2"
                                      Value="0"
                                      EasingFunction="{StaticResource A_EasingFunction_EaseInOut}"/>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="Header"
                                           Storyboard.TargetProperty="Tag">
                <DiscreteDoubleKeyFrame KeyTime="0:0:0"
                                        Value="1" />
                <EasingDoubleKeyFrame KeyTime="0:0:0.6"
                                      Value="1"
                                      EasingFunction="{StaticResource A_EasingFunction_EaseInOut}"/>
                <EasingDoubleKeyFrame KeyTime="0:0:1.3"
                                      Value="0"
                                      EasingFunction="{StaticResource A_EasingFunction_EaseInOut}"/>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="TopIconContainer"
                                           Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">
                <EasingDoubleKeyFrame KeyTime="0"
                                      Value="0.01" />
                <EasingDoubleKeyFrame KeyTime="0:0:0.5"
                                      Value="0.01"
                                      EasingFunction="{StaticResource A_EasingFunction_EaseInOut}"/>
                <EasingDoubleKeyFrame KeyTime="0:0:1.2"
                                      Value="1"
                                      EasingFunction="{StaticResource A_EasingFunction_EaseInOut}"/>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="TopIconContainer"
                                           Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)">
                <EasingDoubleKeyFrame KeyTime="0"
                                      Value="0.01" />
                <EasingDoubleKeyFrame KeyTime="0:0:0.5"
                                      Value="0.01"
                                      EasingFunction="{StaticResource A_EasingFunction_EaseInOut}"/>
                <EasingDoubleKeyFrame KeyTime="0:0:1.2"
                                      Value="1"
                                      EasingFunction="{StaticResource A_EasingFunction_EaseInOut}"/>
            </DoubleAnimationUsingKeyFrames>
        </local:UIStoryboard>
        <local:UIStoryboard x:Key="A_Storyboard_AR_Abandon"
                            DurationOverride="0:0:0.3">
            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="page"
                                           Storyboard.TargetProperty="(UIElement.Opacity)">
                <EasingDoubleKeyFrame KeyTime="0:0:1"
                                      Value="0" />
            </DoubleAnimationUsingKeyFrames>
            <BooleanAnimationUsingKeyFrames Storyboard.TargetName="page"
                                            Storyboard.TargetProperty="DataContext.Complete">
                <DiscreteBooleanKeyFrame KeyTime="0:0:1"
                                         Value="True" />
            </BooleanAnimationUsingKeyFrames>
        </local:UIStoryboard>
        <Storyboard x:Key="A_Storyboard_AR_Discover">
            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="TopValue"
                                           Storyboard.TargetProperty="Tag">
                <DiscreteDoubleKeyFrame KeyTime="0:0:0.0"
                                        Value="1" />
                <DiscreteDoubleKeyFrame KeyTime="0:0:0.2"
                                        Value="1" />
                <EasingDoubleKeyFrame KeyTime="0:0:0.9"
                                      Value="0"
                                      EasingFunction="{StaticResource A_EasingFunction_EaseInOut}"/>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="TopValue"
                                           Storyboard.TargetProperty="Opacity">
                <DiscreteDoubleKeyFrame KeyTime="0:0:0.0"
                                        Value="0" />
                <DiscreteDoubleKeyFrame KeyTime="0:0:0.2"
                                        Value="1" />
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="TopValue2"
                                           Storyboard.TargetProperty="Tag">
                <DiscreteDoubleKeyFrame KeyTime="0:0:0.0"
                                        Value="1" />
                <DiscreteDoubleKeyFrame KeyTime="0:0:0.3"
                                        Value="1" />
                <EasingDoubleKeyFrame KeyTime="0:0:1.1"
                                      Value="0"
                                      EasingFunction="{StaticResource A_EasingFunction_EaseInOut}"/>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="TopValue2"
                                           Storyboard.TargetProperty="Opacity">
                <DiscreteDoubleKeyFrame KeyTime="0:0:0.0"
                                        Value="0" />
                <DiscreteDoubleKeyFrame KeyTime="0:0:0.3"
                                        Value="1" />
            </DoubleAnimationUsingKeyFrames>
            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="TopValueUndiscovered"
                                           Storyboard.TargetProperty="(UIElement.Visibility)"
                                           FillBehavior="Stop">
                <DiscreteObjectKeyFrame KeyTime="0:0:0.0"
                                        Value="{x:Static Visibility.Visible}" />
                <DiscreteObjectKeyFrame KeyTime="0:0:0.15"
                                        Value="{x:Static Visibility.Collapsed}" />
            </ObjectAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="TopValueUndiscovered"
                                           Storyboard.TargetProperty="Opacity"
                                           FillBehavior="Stop">
                <DiscreteDoubleKeyFrame KeyTime="0:0:0.0"
                                        Value="1" />
                <LinearDoubleKeyFrame KeyTime="0:0:0.15"
                                        Value="0" />
            </DoubleAnimationUsingKeyFrames>
            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="TopValueUndiscovered2"
                                           Storyboard.TargetProperty="(UIElement.Visibility)"
                                           FillBehavior="Stop">
                <DiscreteObjectKeyFrame KeyTime="0:0:0.0"
                                        Value="{x:Static Visibility.Visible}" />
                <DiscreteObjectKeyFrame KeyTime="0:0:0.15"
                                        Value="{x:Static Visibility.Collapsed}" />
            </ObjectAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="TopValueUndiscovered2"
                                           Storyboard.TargetProperty="Opacity"
                                           FillBehavior="Stop">
                <DiscreteDoubleKeyFrame KeyTime="0:0:0.0"
                                        Value="1" />
                <LinearDoubleKeyFrame KeyTime="0:0:0.15"
                                        Value="0" />
            </DoubleAnimationUsingKeyFrames>
        </Storyboard>

        <Style x:Key="A_Style_EventFire_PlayStoryboard"
            TargetType="{x:Type local:EventFire}">
            <Style.Triggers>
                <DataTrigger Binding="{Binding AugmentedRealityData.IsDiscovered, FallbackValue=True}"
                    Value="False">
                    <DataTrigger.ExitActions>
                        <BeginStoryboard>
                            <BeginStoryboard.Storyboard>
                                <Storyboard>
                                    <StringAnimationUsingKeyFrames Storyboard.TargetProperty="(local:EventFire.EventName)"
                                        Storyboard.TargetName="{x:Null}"
                                        FillBehavior="Stop">
                                        <DiscreteStringKeyFrame KeyTime="0:0:0.0" Value="PlayStoryboardDiscover" />
                                        <DiscreteStringKeyFrame KeyTime="0:0:0.1" Value="" />
                                    </StringAnimationUsingKeyFrames>
                                </Storyboard>
                            </BeginStoryboard.Storyboard>
                        </BeginStoryboard>
                    </DataTrigger.ExitActions>
                </DataTrigger>
            </Style.Triggers>
        </Style>

        <GridLength x:Key="A_GridLength_SpatialLineSpacing">16</GridLength>
        <GridLength x:Key="A_GridLength_SpatialLineSpacing_CHS">24</GridLength>
        <GridLength x:Key="A_GridLength_SpatialLineSpacing_CHT">24</GridLength>
        <GridLength x:Key="A_GridLength_SpatialLineSpacing_JP">24</GridLength>
        <GridLength x:Key="A_GridLength_SpatialLineSpacing_KO">24</GridLength>

        <local:FZMaterialPresetRoundtangle BasedOn="{StaticResource A_FZMaterialPreset_FlatPanel_Base}"
                                           CornerRadius="7"
                                           x:Key="A_FZMaterialPresetRoundtangle_ActivationDot" />

        <!-- Any position overrides for the spatial icons need to live in here. -->
        <local:MappingConverter x:Key="A_MappingConverter_FZMaterial_Margin_FromDataType" Default="0,0,0,0">
            <local:MappingConverterEntry Key="{x:Type local:DeprecatedAugmentedRealityDataSource}" Value="0,0,0,0" />
        </local:MappingConverter>

    </Page.Resources>
    <Page.LayoutTransform>
        <TransformGroup>
            <ScaleTransform />
            <SkewTransform />
            <RotateTransform />
            <TranslateTransform />
        </TransformGroup>
    </Page.LayoutTransform>
    <Grid HorizontalAlignment="Center"
          VerticalAlignment="Center"
          Height="1080">

        <Grid.RenderTransform>
            <TranslateTransform Y="540"/>
        </Grid.RenderTransform>

        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="2000"/>
            <ColumnDefinition Width="30"/>
            <ColumnDefinition Width="2000"/>
        </Grid.ColumnDefinitions>

        <Grid.RowDefinitions>
            <RowDefinition Height="35"/>
            <RowDefinition Height="{local:LocalizedResource A_GridLength_SpatialLineSpacing}"/>
            <RowDefinition Height="65"/>
            <RowDefinition Height="{local:LocalizedResource A_GridLength_SpatialLineSpacing}"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <Decorator HorizontalAlignment="Right" 
                   VerticalAlignment="Center" 
                   Grid.RowSpan="3" 
                   RenderTransformOrigin="0.5,0.5"
                   Margin="{Binding AugmentedRealityData.ObjectType, Converter={StaticResource A_MappingConverter_FZMaterial_Margin_FromDataType}}"
                   x:Name="TopIconContainer">
            <Decorator.RenderTransform>
                <TransformGroup>
                    <ScaleTransform/>
                    <SkewTransform/>
                    <TranslateTransform/>
                    <RotateTransform/>
                </TransformGroup>
            </Decorator.RenderTransform> 
            <ContentControl x:Name="PART_TopIcon"
                        Content="{Binding AugmentedRealityData}"
                        Style="{StaticResource A_Style_ContentControl_SpatialIcon_ForAR}"
                        RenderTransformOrigin="0.5,0.5"
                        Visibility="{Binding ShownOnHUD, Converter={StaticResource A_FZBooleanToVisibilityConverter_UseHidden_Inverse}}">
                <ContentControl.RenderTransform>
                    <TransformGroup>
                        <ScaleTransform/>
                        <SkewTransform/>
                        <TranslateTransform/>
                        <RotateTransform/>
                    </TransformGroup>
                </ContentControl.RenderTransform>
            </ContentControl>
        </Decorator>

        <Grid Grid.Column="1"
              Grid.RowSpan="5">
            <local:FZMaterial Height="14"
                              Width="14"
                              VerticalAlignment="Top"
                              Preset="{StaticResource A_FZMaterialPresetRoundtangle_ActivationDot}" />
            <ContentControl x:Name="LongStalk"
                            Style="{StaticResource A_Style_ContentControl_AnimatedTagSlideFromTop}"
                            VerticalAlignment="Top"
                            Margin="0,7,0,0">
                    <local:FZMaterial ImageSource="/ForzaUI;component/Textures\Anthem\Gradients\SpatialStalk.png"
                                      Height="{Binding Height}"
                                      Margin="0,0,0,0"
                                      Width="8" />
            </ContentControl>
        </Grid>

        <ContentControl x:Name="TopValue"
                        Grid.Column="2"
                        Visibility="{Binding Path=AugmentedRealityData.IsDiscovered, Converter={StaticResource A_FZBooleanToVisibilityConverter}, FallbackValue=Visible}"
                        Style="{StaticResource A_Style_ContentControl_AnimatedTagSlideFromLeft_HUD}">
            <Decorator LayoutTransform="{StaticResource A_Transform_Italic}">
                <local:FZTextBlock Style="{StaticResource A_Style_ActivationNameTextTop}"
                                   Visibility="{Binding ARNameLine1Text, Converter={StaticResource A_StringVisConverter}}"
                                   Text="{Binding ARNameLine1Text, Converter={StaticResource A_StringToUpper}}"/>
            </Decorator>
        </ContentControl>

        <ContentControl x:Name="TopValue2"
                        Grid.Column="2"
                        Grid.Row="2"
                        Visibility="{Binding Path=AugmentedRealityData.IsDiscovered, Converter={StaticResource A_FZBooleanToVisibilityConverter}, FallbackValue=Visible}"
                        Style="{StaticResource A_Style_ContentControl_AnimatedTagSlideFromLeft_HUD}">
            <Decorator LayoutTransform="{StaticResource A_Transform_Italic}">
                <local:FZTextBlock Style="{StaticResource A_Style_ActivationNameTextBottom}"
                                   Visibility="{Binding ARNameLine2Text, Converter={StaticResource A_StringVisConverter}}"
                                   local:TextBlockInlineMarkup.Markup="{Binding ARNameLine2Text, Converter={StaticResource A_StringToUpper}}"
                                   local:TextBlockInlineMarkup.ResourceBaseName="A_Style_Run_ActivationName_"/>
            </Decorator>
        </ContentControl>

        <ContentControl x:Name="TopValueUndiscovered"
                        Grid.Column="2"
                        Visibility="{Binding Path=AugmentedRealityData.IsDiscovered, Converter={StaticResource A_FZBooleanToVisibilityConverter_Inverse}, FallbackValue=Collapsed}"
                        Style="{StaticResource A_Style_ContentControl_AnimatedTagSlideFromLeft_HUD}">
            <Decorator LayoutTransform="{StaticResource A_Transform_Italic}">
                <local:FZTextBlock Style="{StaticResource A_Style_ActivationNameTextTop}"
                                   Visibility="{Binding AugmentedRealityData.UndiscoveredLine1Text, Converter={StaticResource A_StringVisConverter}, FallbackValue=Collapsed}"
                                   Text="{Binding AugmentedRealityData.UndiscoveredLine1Text, FallbackValue={x:Null}}"/>
            </Decorator>
        </ContentControl>

        <ContentControl x:Name="TopValueUndiscovered2"
                        Grid.Column="2"
                        Grid.Row="2"
                        Style="{StaticResource A_Style_ContentControl_AnimatedTagSlideFromLeft_HUD}"
                        Visibility="{Binding Path=AugmentedRealityData.IsDiscovered, Converter={StaticResource A_FZBooleanToVisibilityConverter_Inverse}, FallbackValue=Collapsed}">
            <Decorator LayoutTransform="{StaticResource A_Transform_Italic}">
                <local:FZTextBlock Style="{StaticResource A_Style_ActivationNameTextBottom}"
                                   Visibility="{Binding AugmentedRealityData.UndiscoveredLine2Text, Converter={StaticResource A_StringVisConverter}, FallbackValue=Collapsed}"
                                   local:TextBlockInlineMarkup.Markup="{Binding AugmentedRealityData.UndiscoveredLine2Text, FallbackValue={x:Null}}"
                                   local:TextBlockInlineMarkup.ResourceBaseName="A_Style_Run_ActivationName_"/>
            </Decorator>
        </ContentControl>

        <ContentControl x:Name="Header"
                        Grid.Column="2"
                        Grid.Row="4"
                        Margin="3,0,0,0"
                        Style="{StaticResource A_Style_ContentControl_AnimatedTagSlideFromLeft_HUD}"
                        VerticalAlignment="Top"
                        Visibility="{Binding ARHeaderText, Converter={StaticResource A_StringVisConverter}}">
            <Decorator LayoutTransform="{StaticResource A_Transform_Italic}">
                <local:FZTextBlock Text="{Binding ARHeaderText}"
                                   Style="{StaticResource A_Style_ActivationPreNameText}"/>
            </Decorator>
        </ContentControl>

        <local:EventFire x:Name="PlayStoryboardEventFire"
            Style="{StaticResource A_Style_EventFire_PlayStoryboard}"/>
    </Grid>
</Page>
