<?xml version="1.0" encoding="utf-8"?>

<!--
This is the master template for all screens:
A header text, player controls and a client area.
Below the client area, the navigation bar is visible.

Usage:

  <Include
      xmlns="www.team-mediaportal.com/2008/mpf/directx"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      Source="screens\master_bare.xaml">
    <Include.Resources>
      <ResourceWrapper x:Key="Header_Text">
        [Header text]
      </ResourceWrapper>
      <ControlTemplate x:Key="Client_Template">
        [UI element to be displayed in the client area]
      </ControlTemplate>
    </Include.Resources>
  </Include>

Parameters which have to be accessible by a DynamicResource lookup:
 - Header_Text (String): The text to be displayed as header
 - Client_Template (ConrolTemplate): Template for element to be shown in the client area.
-->
<Screen
    xmlns="www.team-mediaportal.com/2008/mpf/directx"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mp_special_workflow="clr-namespace:MediaPortal.UI.SkinEngine.SpecialElements.Workflow"
    xmlns:mp_special_controls="clr-namespace:MediaPortal.UI.SkinEngine.SpecialElements.Controls"
    mp_special_workflow:WorkflowContext.StateSlot="Root"
    x:Name="Screen"
    >
  <Canvas Width="1920" Height="1080">
    <Canvas.Resources>
      <Model x:Key="MouseModel" Id="CA6428A7-A6E2-4dd3-9661-F89CEBAF8E62"/>
      <Model x:Key="TimeModel" Id="E821B1C8-0666-4339-8027-AA45A4F6F107"/>
      <Model x:Key="CurrentWeatherModel" Id="FC57FF5C-F72F-47E9-B973-338E31FF7FF1"/>
    </Canvas.Resources>
    <Grid x:Name="HeaderPanel" Canvas.Top="0" Canvas.Left="0" Width="1920" Background="{ThemeResource HeaderPanelBackgroundBrush}">
      <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="Auto"/>
      </Grid.RowDefinitions>
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="*"/> <!-- NavBar -->
        <ColumnDefinition Width="Auto"/> <!-- Weather -->
        <ColumnDefinition Width="Auto"/> <!-- Time -->
      </Grid.ColumnDefinitions>

      <mp_special_controls:WorkflowNavigationBar Grid.Column="0" Grid.Row="0" Style="{ThemeResource NewWorkflowNavigationBarStyle}"
            VerticalAlignment="Center" Margin="40,0,0,0"/>

      <Image Grid.Row="0" Grid.Column="1" x:Name="SmallIcon" Source="{Binding Source={StaticResource CurrentWeatherModel}, Path=CurrentLocation.Condition.SmallIconProperty}" 
                 IsVisible="{Binding UseInHome}" HorizontalAlignment="Right" Margin="0,0,20,0"/>

      <Label x:Name="TimeLabel" Content="{Binding Source={StaticResource TimeModel}, Path=CurrentTime}" Grid.Column="2" Grid.Row="0" Margin="0,10,40,0"
             FontSize="{ThemeResource HeaderFontSize}" FontFamily="TitanBold"
             Color="{ThemeResource TextColor}" VerticalAlignment="Center" HorizontalAlignment="Right"/>

      <StackPanel Orientation="Horizontal" Grid.Column="1" Grid.Row="1" Grid.ColumnSpan="2" Margin="0,0,40,0">
        <Label x:Name="DateLabel" Content="{Binding Source={StaticResource TimeModel}, Path=CurrentDate}" FontFamily="TitanBold"
               Color="{ThemeResource TextColor}" VerticalAlignment="Center" HorizontalAlignment="Right"/>
        <Label x:Name="PlaceHolder" Content=" / " FontFamily="TitanBold" Color="{ThemeResource TextColor}" 
               VerticalAlignment="Center" HorizontalAlignment="Right"/>
        <Label x:Name="Temp" Content="{Binding Source={StaticResource CurrentWeatherModel}, Path=CurrentLocation.Condition.Temperature}"
               FontFamily="TitanBold" Color="{ThemeResource TextColor}" IsVisible="{Binding UseInHome}"
               VerticalAlignment="Center" HorizontalAlignment="Right"/>
      </StackPanel>

    </Grid>    <!-- HeaderPanel -->

    <Path x:Name="Shape_57_copy_7" Canvas.Left="50" Canvas.Top="950" Width="1824" Height="91" 
        Data="F1M2,663.984C2,680.552 15.431,693.984 32,693.984 32,693.984 1792.01,693.984 1792.01,693.984 1808.578,693.984 1822.01,680.552 1822.01,663.984L1822.01,670.315C1822.01,700.647 1822.01,718.961 1822.01,718.961 1822.01,735.529 1808.578,748.961 1792.01,748.961 1792.01,748.961 32,748.961 32,748.961 15.431,748.961 2,735.529 2,718.961 2,718.961 2,700.647 2,670.315z" 
        Stretch="Fill">
      <Path.Fill>
        <SolidColorBrush Color="{ThemeResource FooterShapeFillColor}" Opacity="0.2"/>
      </Path.Fill>
    </Path>

    <Grid Canvas.Left="50" Canvas.Top="980" Width="1824">
      <Grid.RowDefinitions>
        <RowDefinition Height="100"/>
      </Grid.RowDefinitions>
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="*"/>
      </Grid.ColumnDefinitions>
      
      <Label x:Name="HeaderLabel" Margin="0,6,0,0"  VerticalAlignment="Top" HorizontalAlignment="Center"
            FontSize="{ThemeResource BigFontSize}" Color="{ThemeResource WindowHeaderColor}"
            Content="{Binding Source={DynamicResource Header_Text},Path=Resource}" />


      <Control x:Name="AlternativeHeaderControl" 
             VerticalAlignment="Stretch" HorizontalAlignment="Stretch"
             Template="{DynamicResource ResourceKey=Alternative_Header_Template}"
             IsVisible="{Binding RelativeSource={RelativeSource Self},Path=Template,Converter={StaticResource ReferenceToBoolConverter}}"/>

    </Grid>


    <Control x:Name="ClientArea" Height="840" Width="1840" Canvas.Left="40" Canvas.Top="120"
             DockPanel.Dock="Center" Template="{DynamicResource ResourceKey=Client_Template}"/>

    <!-- Player controls, located on top but drawn as last item so it overlays other content, if present-->

    <Grid Canvas.Left="350" Canvas.Top="120" Width="1220">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="*"/>
      </Grid.ColumnDefinitions>

      <StackPanel x:Name="PlayerControls" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Top">

        <mp_special_controls:PlayerControl x:Name="PrimaryPC" Margin="0,0,10,0" Style="{ThemeResource NewNavigationScreenPlayerControlStyle}" Width="570"
                HorizontalAlignment="Center" VerticalAlignment="Top"
                AutoVisibility="True" PlayerContext="PrimaryPlayer"/>

        <mp_special_controls:PlayerControl x:Name="SecondaryPC" Margin="10,0,0,0" Style="{ThemeResource NewNavigationScreenPlayerControlStyle}" Width="570"
                HorizontalAlignment="Center" VerticalAlignment="Top" 
                AutoVisibility="True" PlayerContext="SecondaryPlayer"/>
      </StackPanel>
    </Grid>

    <!-- Notification icon needs also be placed after the main content area, so it will be on top and can be clicked -->
    <Control Canvas.Left="1800" Canvas.Top="130" Style="{ThemeResource NotificationControlStyle}"
            HorizontalAlignment="Right" VerticalAlignment="Center"/>

  </Canvas>
</Screen>