<Page
      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:local="clr-namespace:ForzaUI"
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      xmlns:System="clr-namespace:System;assembly=mscorlib"
      mc:Ignorable="d"
      x:Class="ForzaUI.Scenes.Anthem.Loading"
      Style="{StaticResource A_Style_Page_Generic}"
      DataContext="{Binding RelativeSource={RelativeSource Self}}"
      >

    <Page.Resources>
        <Style x:Key="A_Style_FZMaterial_StaticLoadingBackground"
               TargetType="local:FZMaterial">
            <Style.Setters>
                <Setter Property="Stretch"
                        Value="UniformToFill" />
                <Setter Property="VerticalAlignment" Value="Center" />
                <Setter Property="HorizontalAlignment" Value="Center" />
                <Setter Property="GreedyMeasure" Value="True" />
            </Style.Setters>
            <Style.Triggers>
                <MultiDataTrigger>
                    <MultiDataTrigger.Conditions>
                        <Condition Binding="{Binding IsInitialExperienceState}" Value="True"/>
                        <Condition Binding="{Binding IsWheel}" Value="False"/>
                    </MultiDataTrigger.Conditions>
                    <Setter Property="ImageSourceNoPreload"
                            Value="/ForzaUI;component/Textures/Data_Bound/Anthem/LoadingScreensIE/controller.png" />
                </MultiDataTrigger>
                <MultiDataTrigger>
                    <MultiDataTrigger.Conditions>
                        <Condition Binding="{Binding IsInitialExperienceState}" Value="True"/>
                        <Condition Binding="{Binding IsWheel}" Value="True"/>
                    </MultiDataTrigger.Conditions>
                    <Setter Property="ImageSourceNoPreload"
                            Value="/ForzaUI;component/Textures/Data_Bound/Anthem/LoadingScreensIE/wheel.png" />
                </MultiDataTrigger>
            </Style.Triggers>
        </Style>

        <Style x:Key="A_Style_FZMaterial_E3ObjectiveLoadingForeground"
               TargetType="local:FZMaterial">
            <Setter Property="Stretch"
                    Value="UniformToFill" />
            <Setter Property="VerticalAlignment" Value="Center" />
            <Setter Property="HorizontalAlignment" Value="Center" />
            <Setter Property="GreedyMeasure" Value="True" />
            <Setter Property="ImageSourceNoPreload"
                    Value="/ForzaUI;component/Textures/Data_Bound/Anthem/LoadingScreensIE/E3Objectives.png" /> 
        </Style>

        <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_E3ObjectivesInstruction"
                 TargetType="{x:Type local:FZTextBlock}"
                 BasedOn="{StaticResource A_Style_FZTextBlock_HorizonA}">
              <Setter Property="Text"
                      Value="{local:Loc Demo.IDS_E3ObjectivesInstruction}" />
              <Setter Property="Color"
                      Value="#FFFFFF" />
              <Setter Property="CapHeight"
                      Value="28" />
              <Setter Property="VerticalAlignment"
                      Value="Top" />
              <Setter Property="HorizontalAlignment"
                      Value="Center" />
              <Setter Property="Margin"
                      Value="50,172,50,0" />
            <Style.Triggers>
                <DataTrigger Binding="{Binding AreE3PrizesAvailable}" Value="False">
                    <Setter Property="Text"
                            Value="{local:Loc Demo.IDS_E3ObjectivesInstruction_NoPrize}" />
                </DataTrigger>
            </Style.Triggers>
          </Style>

        <System:Double x:Key="A_Double_MinimumSecondsToShowE3LoadingScreen">8</System:Double>

        <KeyTime x:Key="A_KeyTime_E3_BeginControllerOutro">0:0:2.3</KeyTime>
        <KeyTime x:Key="A_KeyTime_E3_BeginObjectiveIntro">0:0:2.5</KeyTime>
        <KeyTime x:Key="A_KeyTime_E3_EndObjectiveIntro">0:0:2.8</KeyTime>

        <KeyTime x:Key="A_KeyTime_IE_BeginControllerIntro">0:0:0.33</KeyTime>
        <KeyTime x:Key="A_KeyTime_IE_EndControllerIntro">0:0:0.66</KeyTime>
    </Page.Resources>

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

    <Grid x:Name="LayoutRoot">
        <VisualStateManager.VisualStateGroups>
            <VisualStateGroup x:Name="VisualStateGroup">
                <VisualStateGroup.Transitions>
                    <VisualTransition GeneratedDuration="0:0:0.5"/>
                </VisualStateGroup.Transitions>
                <VisualState x:Name="InitialExperience">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="A_Spinner">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}"/>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="A_StaticLoadingBackground">
                          <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}"/>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="A_ControllerLoadingForeground">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}"/>
                        </ObjectAnimationUsingKeyFrames>
                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="A_StaticLoadingBackground">
                            <DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="0"/>
                            <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_IE_BeginControllerIntro}" Value="0"/>
                            <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_IE_EndControllerIntro}" Value="1"/>
                        </DoubleAnimationUsingKeyFrames>
                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="A_ControllerLoadingForeground">
                            <DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="0"/>
                            <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_IE_BeginControllerIntro}" Value="0"/>
                            <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_IE_EndControllerIntro}" Value="1"/>
                        </DoubleAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
                <VisualState x:Name="E3Showfloor">
                  <Storyboard>
                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Height" Storyboard.TargetName="TopBar">
                      <DiscreteDoubleKeyFrame KeyTime="0" Value="132"/>
                    </DoubleAnimationUsingKeyFrames>
                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Height" Storyboard.TargetName="BottomBar">
                      <DiscreteDoubleKeyFrame KeyTime="0" Value="132"/>
                    </DoubleAnimationUsingKeyFrames>
                    <ThicknessAnimationUsingKeyFrames Storyboard.TargetProperty="Margin" Storyboard.TargetName="A_Spinner">
                      <DiscreteThicknessKeyFrame KeyTime="0" Value="50,30"/>
                    </ThicknessAnimationUsingKeyFrames>
                    <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="A_Spinner">
                      <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}"/>
                    </ObjectAnimationUsingKeyFrames>
                    <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="A_StaticLoadingBackground">
                      <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}"/>
                    </ObjectAnimationUsingKeyFrames>
                    <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="A_ControllerLoadingForeground">
                      <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}"/>
                      <DiscreteObjectKeyFrame KeyTime="{StaticResource A_KeyTime_E3_BeginObjectiveIntro}" Value="{x:Static Visibility.Collapsed}"/>
                    </ObjectAnimationUsingKeyFrames>
                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="A_ControllerLoadingForeground">
                      <DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="1"/>
                      <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_E3_BeginControllerOutro}" Value="1"/>
                      <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_E3_BeginObjectiveIntro}" Value="0"/>
                    </DoubleAnimationUsingKeyFrames>
                    <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="A_E3ObjectiveLoadingForeground">
                      <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Collapsed}"/>
                      <DiscreteObjectKeyFrame KeyTime="{StaticResource A_KeyTime_E3_BeginObjectiveIntro}" Value="{x:Static Visibility.Visible}"/>
                    </ObjectAnimationUsingKeyFrames>
                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="A_E3ObjectiveLoadingForeground">
                      <DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="0"/>
                      <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_E3_BeginObjectiveIntro}" Value="0"/>
                      <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_E3_EndObjectiveIntro}" Value="1"/>
                    </DoubleAnimationUsingKeyFrames>
                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(local:ZPanel.ZOffset)" Storyboard.TargetName="A_E3ObjectiveLoadingForeground">
                      <DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="{StaticResource A_Double_TransitionZOffset_Inwards}"/>
                      <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_E3_BeginObjectiveIntro}" Value="{StaticResource A_Double_TransitionZOffset_Inwards}"/>
                      <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_E3_EndObjectiveIntro}" Value="0" EasingFunction="{local:QuarticEasing EasingMode=EaseOut}"/>
                    </DoubleAnimationUsingKeyFrames>
                    <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="A_E3ObjectivesInstruction">
                      <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Collapsed}"/>
                      <DiscreteObjectKeyFrame KeyTime="{StaticResource A_KeyTime_E3_BeginObjectiveIntro}" Value="{x:Static Visibility.Visible}"/>
                    </ObjectAnimationUsingKeyFrames>
                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="A_E3ObjectivesInstruction">
                      <DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="0"/>
                      <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_E3_BeginObjectiveIntro}" Value="0"/>
                      <LinearDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_E3_EndObjectiveIntro}" Value="1"/>
                    </DoubleAnimationUsingKeyFrames>
                  </Storyboard>
                </VisualState>
                <VisualState x:Name="Continue">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="A_Stats">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}"/>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="A_Spinner">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}"/>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="A_CyclingLoadingBackgrounds">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}"/>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>

                <VisualState x:Name="Install">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="A_InstallProgress">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}"/>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="A_CyclingLoadingBackgrounds">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}"/>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="A_Spinner">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}"/>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>

                <VisualState x:Name="LoadingWithMessage">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="A_InstallProgress">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}"/>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="A_CyclingLoadingBackgrounds">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}"/>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="A_Spinner">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}"/>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>

        <Control x:Name="A_CyclingLoadingBackgrounds" Style="{StaticResource A_Style_Control_CyclingLoadingBackground}" Visibility="Collapsed"/>

        <local:FZMaterial x:Name="A_StaticLoadingBackground" Style="{StaticResource A_Style_FZMaterial_StaticLoadingBackground}" Visibility="Collapsed" />

        <Grid x:Name="A_ControllerLoadingForeground" Visibility="Collapsed">
            <local:FZMaterialGlassCapture />
            <Control Style="{StaticResource A_Style_Control_Loading_ControllerMappingIE}"/>
        </Grid>
        <local:FZMaterial x:Name="A_E3ObjectiveLoadingForeground" Style="{StaticResource A_Style_FZMaterial_E3ObjectiveLoadingForeground}" Visibility="Collapsed"/>

        <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>

        <Decorator Style="{StaticResource A_Style_FrameworkElement_LayoutRoot}">
            <Decorator x:Name="A_E3ObjectivesInstruction" VerticalAlignment="Top" Visibility="Collapsed">
              <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_E3ObjectivesInstruction}" />
            </Decorator>
        </Decorator>
        
        <Grid Style="{StaticResource A_Style_FrameworkElement_LayoutRoot}"
              VerticalAlignment="Bottom">
            <Control x:Name="A_Stats" Style="{StaticResource A_Style_Control_Loading_StatsDisplay}" Visibility="Collapsed" DataContext="{Binding Stats}"/>
            <ProgressBar x:Name="A_Spinner" Style="{StaticResource A_Style_Progressbar_Loading_SmallSpinner}" Visibility="Collapsed"/>
            <Control x:Name="A_InstallProgress" Style="{StaticResource A_Style_Control_Loading_InstallProgress}" Visibility="Collapsed"/>
        </Grid>
    </Grid>
</Page>