Make eject after dump an option

This commit is contained in:
Matt Nadareski
2021-03-08 15:06:40 -08:00
parent 20e475e130
commit 7225b8c32d
5 changed files with 20 additions and 14 deletions

View File

@@ -216,6 +216,15 @@ namespace MPF.Data
set { _settings["PromptForDiscInformation"] = value.ToString(); }
}
/// <summary>
/// Eject the disc after dumping
/// </summary>
public bool EjectAfterDump
{
get { return GetBooleanSetting(_settings, "EjectAfterDump", true); }
set { _settings["EjectAfterDump"] = value.ToString(); }
}
/// <summary>
/// Ignore fixed drives when populating the list
/// </summary>

View File

@@ -421,13 +421,11 @@ namespace MPF.Utilities
/// </summary>
/// <param name="resultProgress">Optional result progress callback</param>
/// <param name="protectionProgress">Optional protection progress callback</param>
/// <param name="ejectDisc">True if disc should be ejected after information is gathered, false otherwise</param>
/// <param name="showUserPrompt">Optional user prompt to deal with submsision information</param>
/// <returns>Result instance with the outcome</returns>
public async Task<Result> VerifyAndSaveDumpOutput(
IProgress<Result> resultProgress = null,
IProgress<ProtectionProgress> protectionProgress = null,
bool? ejectDisc = null,
Func<SubmissionInfo, bool?> showUserPrompt = null)
{
resultProgress?.Report(Result.Success("Gathering submission information... please wait!"));
@@ -442,8 +440,7 @@ namespace MPF.Utilities
resultProgress?.Report(Result.Success("Extracting information complete!"));
// Eject the disc automatically if confugured to
// TODO: Make this an Option instead
if (ejectDisc == true)
if (Options.EjectAfterDump == true)
{
resultProgress?.Report(Result.Success($"Ejecting disc in drive {Drive.Letter}"));
EjectDisc();

View File

@@ -92,11 +92,10 @@
</GroupBox>
<GroupBox Margin="5,5,5,5" HorizontalAlignment="Stretch" Header="Controls">
<UniformGrid Columns="4" Margin="5,5,5,5">
<UniformGrid Columns="3" Margin="5,5,5,5">
<Button x:Name="StartStopButton" Height="22" Width="125" VerticalAlignment="Center" HorizontalAlignment="Center" Content="Start Dumping" Click="StartStopButtonClick" IsEnabled="False" />
<Button x:Name="MediaScanButton" Height="22" Width="125" VerticalAlignment="Center" HorizontalAlignment="Center" Content="Scan for disks" Click="MediaScanButtonClick" />
<Button x:Name="CopyProtectScanButton" Height="22" Width="125" VerticalAlignment="Center" HorizontalAlignment="Center" Content="Scan for protection" Click="CopyProtectScanButtonClick" />
<CheckBox x:Name="EjectWhenDoneCheckBox" VerticalAlignment="Center" HorizontalAlignment="Center" Content="Eject When Done" IsChecked="False" />
</UniformGrid>
</GroupBox>

View File

@@ -598,14 +598,10 @@ namespace MPF.Windows
return;
}
// Verify dump output and save it
if (result)
{
// Verify dump output and save it
result = await Env.VerifyAndSaveDumpOutput(resultProgress,
protectionProgress,
EjectWhenDoneCheckBox.IsChecked,
ShowDiscInformationWindow
);
result = await Env.VerifyAndSaveDumpOutput(resultProgress, protectionProgress, ShowDiscInformationWindow);
}
else
{
@@ -832,7 +828,7 @@ namespace MPF.Windows
Env.CancelDumping();
CopyProtectScanButton.IsEnabled = true;
if (EjectWhenDoneCheckBox.IsChecked == true)
if (Env.Options.EjectAfterDump == true)
{
LogOutput.VerboseLogLn($"Ejecting disc in drive {Env.Drive.Letter}");
Env.EjectDisc();

View File

@@ -76,7 +76,7 @@
<TabItem Header="Dumping">
<StackPanel>
<GroupBox Margin="5,5,5,5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Header="Dumping">
<UniformGrid Columns="2" Rows="3">
<UniformGrid Columns="2" Rows="4">
<CheckBox VerticalAlignment="Center" Content="Skip Type Detect"
IsChecked="{Binding Path=UIOptions.Options.SkipMediaTypeDetection}"
ToolTip="Disable trying to guess media type inserted (may improve performance at startup)" Margin="0,4"
@@ -97,6 +97,11 @@
ToolTip="Enable automatic checking for copy protection on dumped media" Margin="0,4,0,0"
/>
<CheckBox VerticalAlignment="Center" Content="Eject After Dump"
IsChecked="{Binding Path=UIOptions.Options.EjectAfterDump}"
ToolTip="Eject the disc from the drive after dumping has completed" Margin="0,4"
/>
<CheckBox VerticalAlignment="Center" Content="Show Disc Info"
IsChecked="{Binding Path=UIOptions.Options.PromptForDiscInformation}"
ToolTip="Enable showing the disc information output after dumping" Margin="0,4"