From 7225b8c32d80e849ea6c65d4307fbf7e96910eed Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Mon, 8 Mar 2021 15:06:40 -0800 Subject: [PATCH] Make eject after dump an option --- MPF.Library/Data/Options.cs | 9 +++++++++ MPF.Library/Utilities/DumpEnvironment.cs | 5 +---- MPF/Windows/MainWindow.xaml | 3 +-- MPF/Windows/MainWindow.xaml.cs | 10 +++------- MPF/Windows/OptionsWindow.xaml | 7 ++++++- 5 files changed, 20 insertions(+), 14 deletions(-) diff --git a/MPF.Library/Data/Options.cs b/MPF.Library/Data/Options.cs index b88ac160..d4cad255 100644 --- a/MPF.Library/Data/Options.cs +++ b/MPF.Library/Data/Options.cs @@ -216,6 +216,15 @@ namespace MPF.Data set { _settings["PromptForDiscInformation"] = value.ToString(); } } + /// + /// Eject the disc after dumping + /// + public bool EjectAfterDump + { + get { return GetBooleanSetting(_settings, "EjectAfterDump", true); } + set { _settings["EjectAfterDump"] = value.ToString(); } + } + /// /// Ignore fixed drives when populating the list /// diff --git a/MPF.Library/Utilities/DumpEnvironment.cs b/MPF.Library/Utilities/DumpEnvironment.cs index 48554d2f..7657d97b 100644 --- a/MPF.Library/Utilities/DumpEnvironment.cs +++ b/MPF.Library/Utilities/DumpEnvironment.cs @@ -421,13 +421,11 @@ namespace MPF.Utilities /// /// Optional result progress callback /// Optional protection progress callback - /// True if disc should be ejected after information is gathered, false otherwise /// Optional user prompt to deal with submsision information /// Result instance with the outcome public async Task VerifyAndSaveDumpOutput( IProgress resultProgress = null, IProgress protectionProgress = null, - bool? ejectDisc = null, Func 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(); diff --git a/MPF/Windows/MainWindow.xaml b/MPF/Windows/MainWindow.xaml index 839d50f1..3dab11a9 100644 --- a/MPF/Windows/MainWindow.xaml +++ b/MPF/Windows/MainWindow.xaml @@ -92,11 +92,10 @@ - +