<Window x:Class="Wabbajack.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        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:Wabbajack"
        mc:Ignorable="d"
        Title="Wabbajack"
        MinWidth="1280" MinHeight="960"
        Width="1280" Height="960" 
        Style="{StaticResource {x:Type Window}}" Icon="Icons/wabbajack.ico" WindowStyle="ToolWindow"
        ResizeMode="CanResize"
        Closing="Window_Closing">
    <Viewbox Stretch="Uniform">
        <!--<Grid Width="1280" Height="960">-->
        <Grid Margin="4,0,4,0">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="*"/>
                <RowDefinition Height="10" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="320"/>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="640"/>
                <ColumnDefinition Width="640"/>
            </Grid.ColumnDefinitions>

            <StackPanel Grid.Row="0" Orientation="Horizontal" Margin="0, 8, 0, 8">
                <TextBlock Text="{Binding Mode}" FontSize="16" FontWeight="Bold" />
                <TextBlock Text=" : " FontSize="16" />
                <TextBlock Text="{Binding ModListName}" FontSize="16" />
            </StackPanel>

            <!-- Properties -->
            <Grid Grid.Row="1" Grid.Column="0" Margin="0,0,2,4" Name="PropertyCompilerGrid">
                <Grid.RowDefinitions>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="30"/>
                </Grid.RowDefinitions>
                <Image Grid.Row="0" Margin="0,0,0,4" Source="{Binding SplashScreenImage}" Stretch="Fill"/>
                <Button Grid.Row="1" Height="30" Command="{Binding OpenModListPropertiesCommand}" IsEnabled="{Binding UIReady}">
                    <TextBlock Text="Modlist Properties" FontSize="15" FontWeight="Bold"/>
                </Button>
            </Grid>
            <Grid Grid.Row="1" Grid.Column="0" Margin="0,0,2,4" Name="PropertyInstallerGrid">
                <Grid.RowDefinitions>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>
                <Image Grid.Row="0" Source="{Binding SplashScreenImage}" Stretch="Fill"/>
            </Grid>
            <!-- End Properties -->

            <!-- Slideshow -->
            <Grid Grid.Row="1" Grid.Column="1" Margin="2,0,0,4">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>
                <TextBlock Text="{Binding SplashScreenModName}" Grid.Row="0" FontSize="30" FontWeight="Bold"/>
                <TextBlock Text="{Binding SplashScreenAuthorName}" Grid.Row="1" FontSize="15" FontWeight="Bold"/>
                <TextBlock Text="{Binding SplashScreenSummary}" TextWrapping="Wrap" Grid.Row="2" FontSize="15" FontWeight="Bold"/>
                <Grid Grid.Row="3">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="48"/>
                    </Grid.ColumnDefinitions>
                    <CheckBox Margin="0,10,0,0" Grid.Column="0" IsChecked="{Binding EnableSlideShow}" Name="EnableSlideShow">Enable the Slideshow</CheckBox>
                    <CheckBox Margin="4,10,0,0" Grid.Column="1" IsChecked="{Binding SplashShowNSFW}" Name="ShowNSFWContent">Show NSFW Mods in the Slideshow</CheckBox>
                    <Button HorizontalAlignment="Right" Height="30" Grid.Column="2" Command="{Binding SlideShowNextItem}">
                        <DockPanel>
                            <Image Source="{Binding NextIcon}" Stretch="Fill"/>
                        </DockPanel>
                    </Button>
                </Grid>
                <Button Height="30" Grid.Row="4" Command="{Binding VisitNexusSiteCommand}">
                    <TextBlock Text="View Nexus Site" FontSize="15" FontWeight="Bold"/>
                </Button>
            </Grid>
            <!-- End Slideshow-->

            <ProgressBar Grid.Row="2" Margin="1,0,1,0" Grid.Column="0" Grid.ColumnSpan="2" Value="{Binding QueueProgress}" Minimum="0" Maximum="100" Background="#444444" />

            <!-- Log -->
            <TextBlock Text="Log:" Grid.Row="3" FontSize="14" Margin="0, 16, 0, 8" />
            <ListBox local:AutoScrollBehavior.ScrollOnNewItem="True" Margin="0,0,2,0" Grid.Row="4" ItemsSource="{Binding Log}" />
            <!-- End Log -->

            <!-- Location -->
            <Grid HorizontalAlignment="Stretch" Margin="-4,10,2,10" Grid.Row="5" Grid.Column="0" Grid.RowSpan="2">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition />
                    <RowDefinition MinHeight="10" />
                    <RowDefinition />
                </Grid.RowDefinitions>
                <Label Grid.Row="0" Content="{Binding LocationLabel}" Grid.Column="0"  />
                <TextBox Grid.Row="0" Grid.Column="1" Text="{Binding Location, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True, NotifyOnValidationError=True}" IsEnabled="{Binding UIReady}"/>
                <Button Grid.Row="0" Content="Select" MinWidth="80" Grid.Column="2" Command="{Binding ChangePath}" IsEnabled="{Binding UIReady}"/>
                <Label Grid.Row="2" Content="Download Location:" Grid.Column="0" />
                <TextBox Grid.Row="2" Grid.Column="1" Text="{Binding DownloadLocation}" IsEnabled="{Binding UIReady}"/>
                <Button Grid.Row="2" Content="Select" MinWidth="80" Grid.Column="2" Command="{Binding ChangeDownloadPath}" IsEnabled="{Binding UIReady}"/>
            </Grid>
            <!-- End Location -->


            <!-- Work Queue Start -->
            <TextBlock Text="Work Queue:" Grid.Row="3" Grid.Column="1" FontSize="14" Margin="2, 16, 0, 8" />

            <ListBox Margin="2,0,0,0" Grid.Row="4" Grid.Column="1" ItemsSource="{Binding Status}" Width="Auto" HorizontalAlignment="Stretch">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <Grid HorizontalAlignment="Stretch">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>
                            <ProgressBar Minimum="0" Maximum="100" Value="{Binding Progress, Mode=OneTime}" Width="100"
                                     Grid.Column="0">
                                <ProgressBar.Style>
                                    <Style TargetType="ProgressBar">
                                        <Setter Property="Visibility" Value="Visible" />
                                        <Style.Triggers>
                                            <DataTrigger Binding="{Binding Progress}" Value="0">
                                                <Setter Property="Visibility" Value="Collapsed" />
                                            </DataTrigger>
                                        </Style.Triggers>
                                    </Style>
                                </ProgressBar.Style>
                            </ProgressBar>
                            <TextBlock Text=" CPU " Grid.Column="1" />
                            <TextBlock Text="{Binding ID}" Grid.Column="2" />
                            <TextBlock Text=" - " Grid.Column="3" />
                            <TextBlock Text="{Binding Msg}" Grid.Column="4" />
                        </Grid>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
            <!-- Work Queue End-->

            <Grid Margin="2,10,0,10" Grid.Row="5" Grid.RowSpan="2" Grid.Column="1">
                <Grid.RowDefinitions>
                    <RowDefinition Height="30"/>
                    <RowDefinition Height="30"/>
                </Grid.RowDefinitions>
                <Button Margin="0,0,0,4" Grid.Row="0" Visibility="{Binding ShowReportButton}" Command="{Binding ShowReportCommand}">
                    <TextBlock FontSize="13" FontWeight="Bold">View ModList Contents</TextBlock>
                </Button>
                <Button Margin="0,4,0,0" Grid.Row="1" Command="{Binding Begin}" IsEnabled="{Binding UIReady}">
                    <TextBlock FontSize="13" FontWeight="Bold">Begin</TextBlock>
                </Button>
            </Grid>
        </Grid>
    </Viewbox>
</Window>