<!--
Copyright 2024 faddenSoft

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<Window x:Class="SourceGen.WpfGui.RecoveryChoice"
        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:SourceGen.WpfGui"
        mc:Ignorable="d"
        Title="Use Recovery File?"
        SizeToContent="Height" Width="500" MinWidth="500" ResizeMode="CanResizeWithGrip"
        ShowInTaskbar="False" WindowStartupLocation="CenterOwner"
        ContentRendered="Window_ContentRendered">

    <Grid Margin="8">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>

        <TextBlock Grid.Row="0" TextWrapping="Wrap"
                   Text="A recovery file, created by the auto-save feature, was found.  Please choose which you would like to use."/>

        <Grid Grid.Row="1" Margin="0,8,0,0">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <!--<TextBlock Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="2" Margin="0,0,0,4"
                       Text="Or leave the existing file alone:"/>-->
            <Button Name="projectButton" Grid.Column="0" Grid.Row="1" Grid.RowSpan="4"
                    Width="80" Height="60" Margin="0,0,8,0" HorizontalAlignment="Left" BorderThickness="1"
                    Content="Project File" Click="ProjectButton_Click"/>
            <TextBlock Grid.Column="1" Grid.Row="1" Text="{Binding ProjPathName, FallbackValue=ProjPath}" FontWeight="Bold"/>
            <TextBlock Grid.Column="1" Grid.Row="2" Text="{Binding ProjModWhen, FallbackValue=Modified:yesterday}"/>
            <TextBlock Grid.Column="1" Grid.Row="3" Text="{Binding ProjLength, FallbackValue=len:1234kB}"/>
        </Grid>

        <Grid Grid.Row="2" Margin="0,8,0,0">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <!--<TextBlock Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="2" Margin="0,0,0,4"
                       Text="You can use the project file:"/>-->
            <Button Name="recoveryButton" Grid.Column="0" Grid.Row="1" Grid.RowSpan="4"
                    Width="80" Height="60" Margin="0,0,8,0" HorizontalAlignment="Left" BorderThickness="1"
                    Content="Recovery File" Click="RecoveryButton_Click"/>
            <TextBlock Grid.Column="1" Grid.Row="1" Text="{Binding RecovPathName, FallbackValue=RecovPath}" FontWeight="Bold"/>
            <TextBlock Grid.Column="1" Grid.Row="2" Text="{Binding RecovModWhen, FallbackValue=Modified:today}"/>
            <TextBlock Grid.Column="1" Grid.Row="3" Text="{Binding RecovLength, FallbackValue=len:2345kB}"/>
        </Grid>

        <DockPanel Grid.Row="3" Margin="0,16,0,0" LastChildFill="False">
            <Button DockPanel.Dock="Right" Name="cancelButton" Content="Cancel" IsCancel="True"
                    Width="70" Margin="4,0,4,0"/>
        </DockPanel>
    </Grid>
</Window>
