<Grid x:Class="HavenSoft.HexManiac.WPF.Controls.StartScreen"
             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:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:hmv="clr-namespace:HavenSoft.HexManiac.WPF.Controls"
             xmlns:hsv="clr-namespace:HavenSoft.HexManiac.WPF.Resources"
             mc:Ignorable="d" Background="{StaticResource HexBrush}"
             d:DesignHeight="450" d:DesignWidth="800">

   <DockPanel HorizontalAlignment="Center" VerticalAlignment="Center">
      <TextBlock HorizontalAlignment="Center" Margin="5" DockPanel.Dock="Bottom">
         <Hyperlink
               Foreground="{DynamicResource Accent}"
               NavigateUri="https://github.com/haven1433/HexManiacAdvance/blob/master/LICENSE"
               RequestNavigate="Navigate">
            MIT License
         </Hyperlink>
      </TextBlock>
      <TextBlock FontStyle="Italic" TextWrapping="Wrap" DockPanel.Dock="Bottom" Margin="40,5,40,0">
         Hex Maniac Advance is a non-profit open-source fan-made tool.
         Only use it with legally purchased software.
         Pokemon is the property of Nintendo and GameFreak.
         Please support the official release.
      </TextBlock>
      <Border DockPanel.Dock="Bottom" BorderThickness="1" BorderBrush="{DynamicResource Secondary}" Margin="40,20,40,5" Height="1" VerticalAlignment="Stretch"/>

      <Grid>
         <Grid.ColumnDefinitions>
            <ColumnDefinition Width="9*"/>
            <ColumnDefinition Width="10"/>
            <ColumnDefinition Width="9*"/>
         </Grid.ColumnDefinitions>
         <Grid.RowDefinitions>
            <RowDefinition Height="7*"/>
            <RowDefinition Height="10"/>
            <RowDefinition Height="3*"/>
         </Grid.RowDefinitions>

         <StackPanel Margin="40,0,0,0">
            <TextBlock Foreground="{DynamicResource Primary}" HorizontalAlignment="Center">
               Open Recent
            </TextBlock>
            <ItemsControl ItemsSource="{Binding RecentFileViewModels}">
               <ItemsControl.ItemTemplate>
                  <DataTemplate>
                     <TextBlock Margin="0,4" ToolTip="{Binding LongName}" FontSize="18">
                        <Path Data="{hsv:Icon Open}" Stretch="Uniform" Width="20" Height="20" Fill="{DynamicResource Secondary}"/>
                        <Hyperlink Command="{Binding Open}" Foreground="{DynamicResource Accent}">
                           <Run Text="{Binding ShortName, Mode=OneWay}"/>
                        </Hyperlink>
                     </TextBlock>
                  </DataTemplate>
               </ItemsControl.ItemTemplate>
            </ItemsControl>
            <TextBlock>
               <Hyperlink Command="{Binding Open}" Foreground="{DynamicResource Accent}">
                  <Run Text="Open File..." FontSize="19" />
               </Hyperlink>
            </TextBlock>
         </StackPanel>

         <Border Grid.Row="2" BorderThickness="1" CornerRadius="4" BorderBrush="{DynamicResource Secondary}" Padding="5" Margin="40,0,0,0">
            <Grid>
               <Rectangle Fill="{DynamicResource Background}" Opacity=".6"/>
               <StackPanel>
                  <TextBlock Text="About" FontSize="20" Margin="0,0,0,0"/>

                  <TextBlock LineHeight="16" Margin="10,4,0,0" TextWrapping="Wrap">
                     Version
                     <Run Text="{Binding Singletons.MetadataInfo.VersionNumber, Mode=OneWay}"/>
                     <LineBreak/>
                     <Run Name="Usage"/>
                  </TextBlock>
               </StackPanel>
            </Grid>
         </Border>

         <Border Grid.Column="2" Grid.RowSpan="3" BorderThickness="1" CornerRadius="4" BorderBrush="{DynamicResource Secondary}" Padding="5" Margin="0,0,40,0">
            <Grid>
               <Rectangle Fill="{DynamicResource Background}" Opacity=".6"/>
               <StackPanel VerticalAlignment="Center">
                  <StackPanel.Resources>
                     <Style TargetType="Border">
                        <Setter Property="BorderThickness" Value="1,0,0,1"/>
                        <Setter Property="Padding" Value="5"/>
                        <Setter Property="Margin" Value="5"/>
                        <Setter Property="BorderBrush" Value="{DynamicResource Secondary}"/>
                        <Setter Property="HorizontalAlignment" Value="Stretch"/>
                     </Style>
                  </StackPanel.Resources>

                  <DockPanel Visibility="{Binding IsNewVersionAvailable, Converter={StaticResource BoolToVisibility}}">
                     <Path Width="50" Height="50" Stretch="Uniform" Data="{hsv:Icon GitHub}" RenderTransformOrigin=".5,.5">
                        <Path.RenderTransform>
                           <ScaleTransform ScaleX="1" ScaleY="1"/>
                        </Path.RenderTransform>
                        <Path.Fill>
                           <SolidColorBrush Color="{DynamicResource SecondaryColor}"/>
                        </Path.Fill>
                        <Path.Triggers>
                           <EventTrigger RoutedEvent="Loaded">
                              <BeginStoryboard>
                                 <Storyboard Storyboard.TargetProperty="Offset" Duration="0:0:1" AutoReverse="True">
                                    <ColorAnimation Storyboard.TargetProperty="Fill.Color" To="{DynamicResource AccentColor}"/>
                                    <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleX" From="1" To="1.2"/>
                                    <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleY" From="1" To="1.2"/>
                                 </Storyboard>
                              </BeginStoryboard>
                           </EventTrigger>
                        </Path.Triggers>
                     </Path>
                     <TextBlock FontSize="20" Margin="10" VerticalAlignment="Center">
                        <Hyperlink
                              Foreground="{DynamicResource Accent}"
                              NavigateUri="https://github.com/haven1433/HexManiacAdvance/releases"
                              RequestNavigate="Navigate">
                           Update Available!
                        </Hyperlink>
                     </TextBlock>
                  </DockPanel>
                  
                  <TextBlock Text="Help" FontSize="24"/>

                  <DockPanel>
                     <Path Width="30" Height="30" Stretch="Uniform" Data="{hsv:Icon Book}" Fill="{DynamicResource Secondary}"/>
                     <Border>
                        <TextBlock TextWrapping="Wrap">
                           <Hyperlink RequestNavigate="Navigate"
                                 NavigateUri="https://github.com/haven1433/HexManiacAdvance/wiki/Tutorials"
                                 Foreground="{DynamicResource Accent}" FontSize="20">
                              Tutorials
                           </Hyperlink>
                           <LineBreak/>
                           Learn how to edit trainers, pokemon, the title screen, and more.
                        </TextBlock>
                     </Border>
                  </DockPanel>

                  <DockPanel>
                     <Path Width="30" Height="30" Stretch="Uniform" Data="{hsv:Icon Help}" Fill="{DynamicResource Secondary}"/>
                     <Border>
                        <TextBlock TextWrapping="Wrap">
                           <Hyperlink RequestNavigate="Navigate"
                                 NavigateUri="https://github.com/haven1433/HexManiacAdvance/wiki"
                                 Foreground="{DynamicResource Accent}" FontSize="20">
                              Wiki
                           </Hyperlink>
                           <LineBreak/>
                           Access documentation to learn advanced features.
                        </TextBlock>
                     </Border>
                  </DockPanel>

                  <DockPanel>
                     <Path Width="30" Height="30" Stretch="Uniform" Data="{hsv:Icon Discord}" Fill="{DynamicResource Secondary}"/>
                     <Border>
                        <TextBlock TextWrapping="Wrap">
                           <Hyperlink RequestNavigate="Navigate"
                                 NavigateUri="https://discord.gg/x9eQuBg"
                                 Foreground="{DynamicResource Accent}" FontSize="20">
                              Discord
                           </Hyperlink>
                           <LineBreak/>
                           Join the community to learn from other users and get access to new releases.
                        </TextBlock>
                     </Border>
                  </DockPanel>
               </StackPanel>
            </Grid>
         </Border>
      </Grid>
   </DockPanel>
</Grid>