mirror of
https://github.com/fadden/6502bench.git
synced 2026-01-22 07:19:49 +00:00
Added the recovery file check when a project is opened, and the GUI elements for choosing which file to use. If a recovery file exists but can't be opened, presumably because it's open by another process, offer to open the project read-only. (This is a generally good idea, but we don't hold the project file open in normal usage, so it only works when auto-save is enabled.) After making a choice, auto-save is disabled until the first manual save. One thing we don't do: if we find a recovery file, but auto-save is disabled, the recovery file won't be deleted after the user makes a choice. This might be a feature. Updated documentation. (issue #161)
88 lines
4.4 KiB
XML
88 lines
4.4 KiB
XML
<!--
|
|
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>
|