<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:System="clr-namespace:System;assembly=mscorlib"
                    xmlns:local="clr-namespace:ForzaUI">

    <!--Images intentionally always loaded as the control could be used in multiple location and the images need to be loaded so they can change rapidly -->
    <ImageSource x:Key="A_BitmapImage_Lobby_Drivatar">/ForzaUI;component/Textures/Anthem/Icons/Lobby/drivatar.png</ImageSource>
    <ImageSource x:Key="A_BitmapImage_Lobby_PartyMember">/ForzaUI;component/Textures/Anthem/Icons/ConvoyMember.png</ImageSource>

    <Style x:Key="A_Style_FZMaterial_PartyIcon"
           TargetType="{x:Type local:FZMaterial}">
        <Setter Property="ImageSource"
                Value="{StaticResource A_BitmapImage_Lobby_PartyMember}" />
        <Setter Property="Width"
                Value="26" />
        <Setter Property="Height"
                Value="26" />
        <Setter Property="Visibility"
                Value="{Binding InPartyWithLocalPlayer, Converter={StaticResource A_Converter_BoolToVis}}" />
        <Setter Property="Margin"
                Value="-2,0,0,0" />
        <Setter Property="Color" Value="{StaticResource H_Color_Primary_Black}" />
        <Setter Property="Margin" Value="0" />
        <Style.Triggers>
            <DataTrigger Binding="{Binding IsLocalPlayer}" Value="True">
                <Setter Property="Color"
                        Value="{StaticResource A_Color_LocalPlayer_Text}" />
            </DataTrigger>
            <DataTrigger Binding="{Binding IsKeyboardFocusWithin, RelativeSource={RelativeSource FindAncestor, AncestorType=ListBoxItem}}" Value="True">
                <Setter Property="Color"
                        Value="{StaticResource A_Color_HighlightText}" />
            </DataTrigger>

            <DataTrigger Binding="{Binding IsPartyLeader}"
                         Value="True">
                <Setter Property="Visibility"
                        Value="Collapsed" />
            </DataTrigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="A_Style_DockPanel_MultiplayerGrid_InstructionalPanel"
           TargetType="{x:Type DockPanel}">
        <Setter Property="Margin"
                Value="5,0,0,0" />
        <Setter Property="Width"
                Value="356" />
    </Style>

    <Style x:Key="A_Style_FrameworkElement_MultiplayerGrid_InstructionalPanel"
           TargetType="FrameworkElement">
        <Setter Property="Visibility"
                Value="Collapsed" />
        <Style.Triggers>
            <DataTrigger Binding="{Binding Instruction1, Converter={StaticResource A_StringVisConverter}}"
                         Value="{x:Static Visibility.Visible}">
                <Setter Property="Visibility"
                        Value="Visible" />
            </DataTrigger>
            <DataTrigger Binding="{Binding Instruction2, Converter={StaticResource A_StringVisConverter}}"
                         Value="{x:Static Visibility.Visible}">
                <Setter Property="Visibility"
                        Value="Visible" />
            </DataTrigger>
            <DataTrigger Binding="{Binding Instruction3, Converter={StaticResource A_StringVisConverter}}"
                         Value="{x:Static Visibility.Visible}">
                <Setter Property="Visibility"
                        Value="Visible" />
            </DataTrigger>
        </Style.Triggers>
    </Style>

    <ControlTemplate x:Key="A_ControlTemplate_MultiplayerCountdown" TargetType="Control">
        <ControlTemplate.Resources>
            <Double x:Key="A_Double_MultiplayerCountdown_Text_CapHeight">16</Double>
        </ControlTemplate.Resources>
        <DockPanel x:Name="Container"
                   Width="329">
            <FZMaterial DockPanel.Dock="Left" 
                        Width="40" 
                        Height="40" 
                        ImageSource="/ForzaUI;component/Textures/Anthem/Icons/Timer_Countdown.png" 
                        Color="{StaticResource A_Color_Network_CountdownText}"/>

            <StackPanel Orientation="Horizontal">
                <FZTextBlock Color="{StaticResource A_Color_Network_CountdownText}"
                             Style="{StaticResource A_Style_FZTextBlock_Heading_Large}"
                             CapHeight="{StaticResource A_Double_MultiplayerCountdown_Text_CapHeight}"
                             VerticalAlignment="Center"
                             HorizontalAlignment="Left"
                             Text="{Binding TimerDisplayName, RelativeSource={RelativeSource AncestorType={x:Type local:NetworkCountdownControl}}}"/>
                <Decorator Width="5"/>
                <FZTextBlock Text="{Binding TimeRemaining, RelativeSource={RelativeSource AncestorType={x:Type local:NetworkCountdownControl}}}"
                             Style="{StaticResource A_Style_FZTextBlock_Heading_Large}"
                             CapHeight="{StaticResource A_Double_MultiplayerCountdown_Text_CapHeight}"
                             MinWidth="34"
                             VerticalAlignment="Center" HorizontalAlignment="Left"
                             Color="{StaticResource A_Color_Network_CountdownTimeText}"/>
            </StackPanel>
        </DockPanel>
    </ControlTemplate>

    <ControlTemplate x:Key="A_ControlTemplate_MultiplayerCountdown_Absolute"
                     TargetType="{x:Type local:NetworkCountdownControl}">
        <Grid RenderTransformOrigin="0.5,1.0" VerticalAlignment="Bottom" Style="{StaticResource A_Style_FrameworkElement_LayoutRoot}">
            <Decorator Margin="{StaticResource A_Thickness_Margin_ButtonBar}" MaxWidth="329" MaxHeight="60" VerticalAlignment="Bottom" HorizontalAlignment="Right">
                <Control Template="{StaticResource A_ControlTemplate_MultiplayerCountdown}"/>
            </Decorator>
        </Grid>
    </ControlTemplate>

    <Style x:Key="A_Style_NetworkCountdownControl_Base"
           TargetType="{x:Type local:NetworkCountdownControl}"
           BasedOn="{StaticResource A_Style_FrameworkElement_FadeOnlyTransition_0}">
        <Setter Property="Template"
                Value="{StaticResource A_ControlTemplate_MultiplayerCountdown_Absolute}" />
        <Setter Property="HorizontalAlignment"
                Value="Right" />
        <Setter Property="VerticalAlignment"
                Value="Bottom" />
        <Setter Property="Visibility"
                Value="Collapsed" />
        <Setter Property="local:DialogueControl.DialoguePosition"
                Value="{x:Static local:DialogueSubtitlePosition.NetworkCountdown}"/>
        <Setter Property="local:UIPageTransitionManager.TransitionTags"
                Value="NetworkCountdown" />
        <Setter Property="ScreenReader.LineType" Value="{Static ScreenReaderLineType.NetworkCountdown}"/>
        <Setter Property="ScreenReader.Event" Value="{Static ScreenReaderEvent.OnChange}"/>
        <Setter Property="ScreenReader.InterruptBehavior" Value="WaitForNonePlaying"/>
        <Style.Triggers>
            <Trigger Property="Visibility" Value="{x:Static Visibility.Collapsed}">
                <Setter Property="local:DialogueControl.DialoguePosition" Value="{x:Static local:DialogueSubtitlePosition.Normal}"/>
            </Trigger>
            <Trigger Property="Opacity" Value="0">
                <Setter Property="local:DialogueControl.DialoguePosition" Value="{x:Static local:DialogueSubtitlePosition.Normal}"/>
            </Trigger>
            <MultiDataTrigger>
                <MultiDataTrigger.Conditions>
                    <Condition Binding="{Binding IsNetworkConnected, RelativeSource={RelativeSource Self}}" Value="True"/>
                    <Condition Binding="{Binding SecondsRemaining, RelativeSource={RelativeSource Self}, Converter={StaticResource A_CompareConverter}, ConverterParameter=0}" Value="1"/>
                </MultiDataTrigger.Conditions>
                <Setter Property="Visibility" Value="Visible"/>
            </MultiDataTrigger>
            <Trigger Property="IsVisible" Value="True">
                <Setter Property="MultiStringFormatter.Format" Value="{}{0} {1}"/>
                <Setter Property="MultiStringFormatter.Param0" Value="{Binding TimerDisplayName, RelativeSource={RelativeSource Self}}"/>
                <Setter Property="MultiStringFormatter.Param1" Value="{Binding TimeRemaining, RelativeSource={RelativeSource Self}}"/>
                <Setter Property="ScreenReader.Line" Value="{Binding (MultiStringFormatter.Output), RelativeSource={RelativeSource Self}}"/>
            </Trigger>
        </Style.Triggers>
    </Style>
    
    <Style x:Key="A_Style_NetworkCountdownControl_BucketListSetup"
           TargetType="{x:Type local:NetworkCountdownControl}"
           BasedOn="{StaticResource A_Style_NetworkCountdownControl_Base}">
        <Setter Property="TimerDisplayName"
                Value="{local:Loc Lobby.IDS_Bucket_List_Options_Countdown}" />
    </Style>

    <Style x:Key="A_Style_NetworkCountdownControl_EventSetup"
           TargetType="{x:Type local:NetworkCountdownControl}"
           BasedOn="{StaticResource A_Style_NetworkCountdownControl_Base}">
        <Setter Property="TimerDisplayName"
                Value="{local:Loc Lobby.IDS_Event_Options_Countdown}" />
    </Style>

    <Style x:Key="A_Style_NetworkCountdownControl_TimeRemaining"
       TargetType="{x:Type local:NetworkCountdownControl}"
       BasedOn="{StaticResource A_Style_NetworkCountdownControl_Base}">
        <Setter Property="TimerDisplayName"
                Value="{local:Loc Scoreboard.IDS_TimeRemaining}" />
    </Style>

    <ControlTemplate x:Key="A_ControlTemplate_CountdownSeriesEnds"
                     TargetType="{x:Type local:NetworkCountdownControl}">
        <Grid RenderTransformOrigin="0.5,1.0" VerticalAlignment="Bottom" Style="{StaticResource A_Style_FrameworkElement_LayoutRoot}">
            <Decorator Margin="{StaticResource A_Thickness_Margin_ButtonBar}" MaxHeight="60" VerticalAlignment="Bottom" HorizontalAlignment="Right">
                <StackPanel Orientation="Horizontal">
                    <local:FZMaterial Width="40"
                                      Height="40"
                                      x:Name="TimerIcon"
                                      VerticalAlignment="Center"
                                      Margin="0,-20"
                                      ImageSource="/ForzaUI;component/Textures/Data_Bound/Anthem/Icons/Timer.png"/>
                    <local:FZTextBlock x:Name="TimerDefinitionText"
                                       Text="{Binding TimerDisplayName, RelativeSource={RelativeSource AncestorType={x:Type local:NetworkCountdownControl}}}"
                                       VerticalAlignment="Center"
                                       CapHeight="23"
                                       Color="{StaticResource H_Color_Primary_White}"/>
                    <Decorator RenderTransform="{StaticResource A_Transform_Italic}"
                               RenderTransformOrigin="0.5,0.5">
                        <local:FZTextBlock x:Name="TimerValueText"
                                           Text="{Binding TimeRemaining, RelativeSource={RelativeSource AncestorType={x:Type local:NetworkCountdownControl}}}"
                                           CapHeight="23"
                                           Color="{StaticResource H_Color_Primary_Yellow}"
                                           VerticalAlignment="Center"
                                           Margin="20,0,0,0"
                                           FontFamily="Horizon_A_tf"/>
                    </Decorator>
                </StackPanel>
            </Decorator>
        </Grid>
    </ControlTemplate>
    
    <Style x:Key="A_Style_NetworkCountdownControl_SeriesEnd"
           TargetType="{x:Type local:NetworkCountdownControl}"
           BasedOn="{StaticResource A_Style_NetworkCountdownControl_Base}">
        <Setter Property="Template"
                Value="{StaticResource A_ControlTemplate_CountdownSeriesEnds}" />
        <Setter Property="TimerDisplayName"
                Value="{Loc DestinationMenu.IDS_Series_EndingIn}" />
        <Setter Property="CountdownType" 
                Value="SeriesTimeRemaining"/>
        <Setter Property="GenerateFormattedString"
                Value="True"/>
    </Style>
</ResourceDictionary>