<?xml version="1.0" encoding="utf-8"?>
<Include
    xmlns="www.team-mediaportal.com/2008/mpf/directx"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Source="screens\master_homemenu.xaml"
    xmlns:mp_special_controls="clr-namespace:MediaPortal.UI.SkinEngine.SpecialElements.Controls;assembly=SkinEngine"
    xmlns:fanart="clr-namespace:MediaPortal.Extensions.UserServices.FanArtService.Client;assembly=FanArtService.Client"
    >
  <Include.Resources>

    <!-- Header -->
    <!--ResourceWrapper x:Key="Header_Text" Resource="[SlimTvClient.Schedules]"/-->

    <!-- SlimTvScheduleManagement model -->
    <Model x:Key="SlimTvScheduleManagement" Id="7610403A-4488-47A4-8C27-FD1FE833E52B"/>

    <!-- Contents -->
    <ControlTemplate x:Key="Client_Template">
      <Grid x:Name="MainGrid" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,-108,0,-30"
              DataContext="{Binding Source={StaticResource SlimTvScheduleManagement}}">
        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="530"/>
          <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
          <RowDefinition Height="Auto"/>
          <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <Image Stretch="Fill" Source="panel_tv_guide_large.png" Grid.Row="0" Grid.RowSpan="2"
               Grid.Column="0" Grid.ColumnSpan="2" Margin="-45,0,-43,-60"/> 

        <StackPanel Orientation="Horizontal" Grid.Row="0">
          <CheckBox x:Name="EnableSeriesModeCheckbox" Margin="10,10,0,5" Style="{ThemeResource DefaultCheckBoxStyle}"
              IsChecked="{Binding Path=ScheduleSeriesMode,Mode=TwoWay}" VerticalAlignment="Center"
              Content="{Binding}" />
          <Label Content="[SlimTvClient.ScheduleModeSeries]" Color="Black" Margin="0,0,5,0" VerticalAlignment="Center"/>
        </StackPanel>
        
        <ListView Grid.Row="1" Grid.Column="1"
                  Margin="10,25,-35,-10" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
                  Style="{ThemeResource ScheduleListViewStyle}"
                  ItemsSource="{Binding Path=SchedulesList}"
                  SelectionChanged="{CommandStencil UpdateSchedule}">
          <ListView.Resources>
            <CommandBridge x:Key="Menu_Command" Command="{Binding Path=Command,Mode=OneTime}"/>
          </ListView.Resources>
        </ListView>

        <Grid Grid.Row="1" Grid.Column="0" Margin="30,30,20,0" x:Name="Description_details"
                        HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
            <Grid.RowDefinitions>
              <RowDefinition Height="Auto"/>
              <RowDefinition Height="Auto"/>
              <RowDefinition Height="Auto"/>
              <RowDefinition Height="Auto"/>
              <RowDefinition Height="Auto"/>
              <RowDefinition Height="Auto"/>
              <RowDefinition Height="Auto"/>
              <RowDefinition Height="Auto"/>
              <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="{ThemeResource ProgramInfoHeaderWidth}"/>
              <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>

            <Image x:Name="ChannelLogo" Width="{ThemeResource ChannelLogoLarge}" Grid.Row="0" Grid.Column="0"
                   Stretch="Uniform" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,-5,0,0">
              <Image.Source>
                <fanart:FanArtImageSource fanart:FanArtMediaType="ChannelTv" fanart:FanArtType="Banner"
                                          fanart:FanArtName="{Binding ChannelName}" fanart:MaxWidth="0" fanart:MaxHeight="0"/>
              </Image.Source>
            </Image>

            <Label x:Name="ChannelLabel" Grid.Row="1" Grid.Column="0" Content="[SlimTvClient.ChannelLabel]" Color="{ThemeResource EmphasisTextColor}"/>
            <Label x:Name="Channel" Grid.Row="1" Grid.Column="1"  Scroll="Auto" Content="{Binding ChannelName}" Color="{ThemeResource TextColor}"/>

            <Label x:Name="ProgramLabel" Grid.Row="2" Grid.Column="0" Content="[SlimTvClient.ProgramLabel]" Color="{ThemeResource EmphasisTextColor}"/>
            <Label x:Name="Program" Grid.Row="2" Grid.Column="1"  Scroll="Auto" Content="{Binding Path=CurrentProgram.Title}" Color="{ThemeResource TextColor}"/>

            <Label x:Name="ProgramStartLabel" Grid.Row="3" Grid.Column="0" Content="[SlimTvClient.ProgramStartLabel]" Color="{ThemeResource EmphasisTextColor}"/>
            <Label x:Name="ProgramStart" Grid.Row="3" Grid.Column="1" Scroll="Auto"
                Content="{Binding Path=StartTime, Converter={StaticResource SlimTvDateFormatConverter}}"
                Color="{ThemeResource TextColor}"/>

            <Label x:Name="ProgramEndLabel" Grid.Row="4" Grid.Column="0" Content="[SlimTvClient.ProgramEndLabel]" Color="{ThemeResource EmphasisTextColor}" />
            <Label x:Name="ProgramEnd" Grid.Row="4" Grid.Column="1" Scroll="Auto"
                Content="{Binding Path=EndTime, Converter={StaticResource SlimTvDateFormatConverter}}"
                Color="{ThemeResource TextColor}"/>

            <Label x:Name="GenreLabel" Grid.Row="5" Grid.Column="0" Content="[SlimTvClient.GenreLabel]" Color="{ThemeResource EmphasisTextColor}"/>
            <Label x:Name="Genre" Grid.Row="5" Grid.Column="1"  Content="{Binding Path=CurrentProgram.Genre}" Color="{ThemeResource TextColor}" Scroll="Auto"/>

            <!-- TODO: add all related episode information -->
            <Label x:Name="EpisodeLabel" Grid.Row="6" Grid.Column="0" Content="[SlimTvClient.EpisodeLabel]" Color="{ThemeResource EmphasisTextColor}"/>
            <Label x:Name="Episode" Grid.Row="6" Grid.Column="1"  Content="{Binding [Series]}" Color="{ThemeResource TextColor}" Scroll="Auto"/>

            <Label x:Name="DescriptionLabel" Grid.Row="7" Grid.Column="0" Grid.ColumnSpan="2" Content="[SlimTvClient.DescriptionLabel]" Color="{ThemeResource EmphasisTextColor}"/>
            <Label x:Name="Description" Grid.Row="8" Grid.Column="0" Grid.ColumnSpan="2" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
                Wrap="True" Scroll="Auto" Content="{Binding Path=CurrentProgram.Description}" Color="{ThemeResource TextColor}"/>
          </Grid>
        
       </Grid>
    </ControlTemplate>
  </Include.Resources>
</Include>
