<Window xmlns="https://github.com/avaloniaui"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:PS2_Manager.Core"
        mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
        x:Class="PS2_Manager.MainWindow"
        Title="PS2 Games Manager"
        Background="#201c29"
        Width="990"
        Height="520"
        MinHeight="490"
        MinWidth="875"
        WindowStartupLocation="CenterScreen"
        Loaded="Control_OnLoaded"
        Foreground="White">
    <Grid ColumnDefinitions="*, 10, *, 10, 320" Background="Transparent">
        <Grid Grid.Column="0">
            <Border CornerRadius="0,0,10,10">
                <Border CornerRadius="10" Margin="5">
                    <ListBox Name="GamesList" Background="Transparent"
                                     SelectionChanged="GamesList_OnSelectionChanged">
                        <ListBox.ItemTemplate>
                            <DataTemplate x:DataType="local:Game">
                                <Border Background="Transparent" Padding="10">
                                    <Border.ContextMenu>
                                        <ContextMenu>
                                            <MenuItem Header="Add New Game" Click="OpenFileButton_Clicked"/>
                                            <MenuItem Header="Remove Game" Click="DeleteButton"/>
                                            <MenuItem Header="Show Details"/>
                                        </ContextMenu>
                                    </Border.ContextMenu>
                                    <Grid ColumnDefinitions="30, 5,*">
                                        <Image IsVisible="{Binding Icon.ShowDVD}" Grid.Column="0" RenderOptions.BitmapInterpolationMode="HighQuality" Source="Assets/dvd.png"/>
                                        <Image IsVisible="{Binding Icon.ShowCD}" Grid.Column="0" RenderOptions.BitmapInterpolationMode="HighQuality" Source="Assets/cd.png"/>
                                        <TextBlock Grid.Column="2" Foreground="White" Text="{Binding Name}" VerticalAlignment="Center"/>
                                    </Grid>
                                </Border>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                        <ListBox.ContextMenu>
                            <ContextMenu x:Name="EmptyAreaContextMenu">
                                <MenuItem Header="Add New Game" Click="OpenFileButton_Clicked"/>
                                <MenuItem Header="Refresh List" Click="Context_RefreshGames"/>
                            </ContextMenu>
                        </ListBox.ContextMenu>
                        <ListBox.Styles>
                            <Style Selector="ListBoxItem:selected /template/ ContentPresenter">
                                <Setter Property="Background" Value="#35313d"/>
                            </Style>
                            <Style Selector="ListBoxItem">
                                <Setter Property="Padding" Value="0"/>
                                <Setter Property="CornerRadius" Value="10"/>
                            </Style>
                        </ListBox.Styles>
                    </ListBox>
                </Border>
            </Border>
        </Grid>
        <Border Grid.Column="1">
            <Border Width="1" Background="#35313d" Margin="2,10"/>
        </Border> 
        
        <Border Grid.Column="2">
            <Border Margin="2,0,0,0">
                <Grid>
                    <StackPanel Name="WelcomePanel"
                                Orientation="Vertical" 
                                HorizontalAlignment="Stretch" 
                                VerticalAlignment="Center" 
                                Spacing="10">
                        <TextBlock Text=""
                                   Name="WelcomeTextTop"
                                   HorizontalAlignment="Center"
                                   TextAlignment="Center"
                                   FontSize="18"
                                   FontWeight="Bold"
                                   TextWrapping="Wrap"/>
                        <Separator HorizontalAlignment="Center"/>
                        <TextBlock Text="by WeeXnes"
                                   HorizontalAlignment="Center"
                                   TextAlignment="Center"
                                   FontStyle="Italic"
                                   TextWrapping="Wrap"/>
                        <Separator HorizontalAlignment="Center"/>
                        <TextBlock Text="Check out the source code and contribute at:"
                                   HorizontalAlignment="Center"
                                   TextAlignment="Center"
                                   Margin="10"
                                   TextWrapping="Wrap"/>
                        <Button Content="PS2 Manager Repository"
                                HorizontalAlignment="Center"
                                Click="OnRepositoryLinkClicked"/>
                    </StackPanel>

                    <Grid RowDefinitions="*, 40, 10" Name="GameEdit" IsVisible="False">
                        <ScrollViewer Grid.Row="0">
                            <StackPanel Orientation="Vertical" Margin="10">
                                <TextBlock Foreground="White" Text="Display Name:" HorizontalAlignment="Center" Padding="0,10"/>
                                <TextBox Foreground="White" Name="NameTextBox_Edit"/>
                                <Separator Margin="0,10"/>
                                <Grid Grid.ColumnDefinitions="*,120,*,120,*">
                                    <Border Grid.Column="1" Background="#35313d" Padding="0,5" CornerRadius="5">
                                        <StackPanel>
                                            <Image RenderOptions.BitmapInterpolationMode="HighQuality" Source="Assets/vmc.png"/>
                                            <ComboBox Name="VMC_1" Margin="5,0" HorizontalAlignment="Stretch" SelectionChanged="VMC_1_OnSelectionChanged"/>
                                        </StackPanel>
                                    </Border>
                                    <Border Grid.Column="3" Background="#35313d" Padding="0,5" CornerRadius="5">
                                        <StackPanel>
                                            <Image RenderOptions.BitmapInterpolationMode="HighQuality" Source="Assets/vmc.png"/>
                                            <ComboBox Name="VMC_2" Margin="5,0" HorizontalAlignment="Stretch" SelectionChanged="VMC_2_OnSelectionChanged"/>
                                        </StackPanel>
                                    </Border>
                                </Grid>
                                <Separator Margin="0,10"/>
                                <Grid Grid.RowDefinitions="*,*,*" Grid.ColumnDefinitions="*,120,*,120,*">
                                    <ToggleSwitch Name="toggle_mode1" Content="Mode 1" Grid.Row="0" Grid.Column="1" IsCheckedChanged="Toggle_mode_OnIsCheckedChanged"/>
                                    <ToggleSwitch Name="toggle_mode2" Content="Mode 2" Grid.Row="1" Grid.Column="1" IsCheckedChanged="Toggle_mode_OnIsCheckedChanged"/>
                                    <ToggleSwitch Name="toggle_mode3" Content="Mode 3" Grid.Row="2" Grid.Column="1" IsCheckedChanged="Toggle_mode_OnIsCheckedChanged"/>
                                    <ToggleSwitch Name="toggle_mode4" Content="Mode 4" Grid.Row="0" Grid.Column="3" IsCheckedChanged="Toggle_mode_OnIsCheckedChanged"/>
                                    <ToggleSwitch Name="toggle_mode5" Content="Mode 5" Grid.Row="1" Grid.Column="3" IsCheckedChanged="Toggle_mode_OnIsCheckedChanged"/>
                                    <ToggleSwitch Name="toggle_mode6" Content="Mode 6" Grid.Row="2" Grid.Column="3" IsCheckedChanged="Toggle_mode_OnIsCheckedChanged"/>
                                </Grid>
                                <Separator Margin="0,10"/>
                                <Button Foreground="White" Content="Calculate Checksums" Click="ChecksumButtonOnClick" HorizontalAlignment="Stretch"></Button>
                                <Border Background="#35313d" CornerRadius="5" Padding="10" Margin="0,5" IsVisible="False" Name="ChecksumArea">
                                    <StackPanel>
                                        <TextBlock Foreground="White" FontSize="10" Name="MD5TextBlock"/>
                                        <TextBlock Foreground="White" FontSize="10" Name="SHATextBlock"/>
                                    </StackPanel>
                                </Border>
                            </StackPanel>
                        </ScrollViewer>
                        <Grid Grid.Row="1" ColumnDefinitions="*,*">
                            <Button Foreground="White" Content="Undo" Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Center"
                                    Click="Undo_OnClick"/>
                            <Button Foreground="White" Content="Save" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center"
                                    Click="Save_OnClick"/>
                        </Grid>
                    </Grid>
                </Grid>
            </Border>
        </Border>

        <Border Grid.Column="4" Background="#35313d" CornerRadius="10" Name="InfoWindow" Margin="10">
            <Grid>
                <StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center" Name="GameInfoPlaceholder">
                    <TextBlock Text="Select a Game"/>
                </StackPanel>
                <Grid RowDefinitions="*, 350, 20, 20, 20, 20, *" Name="GameInfo" IsVisible="False">
                    <Grid Grid.Row="1" ColumnDefinitions="*, 205, *">
            
                        <Button Foreground="White" Grid.Column="0" Content="←" HorizontalAlignment="Center" VerticalAlignment="Center" Click="PrevButton"/>
                        <Button Foreground="White" Grid.Column="2" Content="→" HorizontalAlignment="Center" VerticalAlignment="Center" Click="NextButton"/>
            
                        <Border Grid.Column="1" Width="205" Height="292" Background="Transparent" CornerRadius="5" HorizontalAlignment="Center" VerticalAlignment="Center"
                                PointerPressed="CoverImage_OnPointerPressed" Name="CoverContainer">
                            <Grid>
                                <Image Name="CoverImage" Source="Assets/missing.png" Stretch="UniformToFill"/>
                                <TextBlock Name="CoverTextHint" HorizontalAlignment="Center" VerticalAlignment="Center" IsVisible="False"/>
                            </Grid>
                        </Border>
                    </Grid>
                    <TextBlock Foreground="White" Grid.Row="2" Text="" HorizontalAlignment="Center"
                               Name="GameNameTextBlock"/>
                    <TextBlock Foreground="White" Grid.Row="3" Text="" HorizontalAlignment="Center"
                               Name="GameIdTextBlock"/>
                    <TextBlock Foreground="White" Grid.Row="4" Text="" HorizontalAlignment="Center"
                               Name="IsoSizeTextBlock"/>
                    <TextBlock Foreground="White" Grid.Row="5" Text="" HorizontalAlignment="Center"
                               Name="GameDateTextBlock"/>
                </Grid>
            </Grid>
        </Border>
    </Grid>
</Window>
