diff --git a/MPF.Core/Data/Options.cs b/MPF.Core/Data/Options.cs index 871e1091..0845bc1e 100644 --- a/MPF.Core/Data/Options.cs +++ b/MPF.Core/Data/Options.cs @@ -87,6 +87,15 @@ namespace MPF.Core.Data set { _settings["CheckForUpdatesOnStartup"] = value.ToString(); } } + /// + /// Fast update label - Skips disc checks and updates path only + /// + public bool FastUpdateLabel + { + get { return GetBooleanSetting(_settings, "FastUpdateLabel", false); } + set { _settings["FastUpdateLabel"] = value.ToString(); } + } + /// /// Default output path for dumps /// diff --git a/MPF/ViewModels/MainViewModel.cs b/MPF/ViewModels/MainViewModel.cs index 2bad5ebb..d2feea16 100644 --- a/MPF/ViewModels/MainViewModel.cs +++ b/MPF/ViewModels/MainViewModel.cs @@ -432,7 +432,7 @@ namespace MPF.UI.ViewModels { App.Instance.SystemTypeComboBox.IsEnabled = false; App.Instance.MediaTypeComboBox.IsEnabled = false; - + App.Instance.OutputPathTextBox.IsEnabled = false; App.Instance.OutputPathBrowseButton.IsEnabled = false; @@ -449,7 +449,7 @@ namespace MPF.UI.ViewModels App.Instance.SystemTypeComboBox.IsEnabled = true; App.Instance.MediaTypeComboBox.IsEnabled = true; - + App.Instance.OutputPathTextBox.IsEnabled = true; App.Instance.OutputPathBrowseButton.IsEnabled = true; @@ -570,6 +570,43 @@ namespace MPF.UI.ViewModels App.Instance.StartStopButton.IsEnabled = ShouldEnableDumpingButton(); } + /// + /// Performs a fast update of the output path while skipping disc checks + /// + /// Whether event handlers need to be removed first + private void FastUpdateLabel(bool removeEventHandlers) + { + // Disable the dumping button + App.Instance.StartStopButton.IsEnabled = false; + + // Safely uncheck the parameters box, just in case + if (App.Instance.EnableParametersCheckBox.IsChecked == true) + { + App.Instance.EnableParametersCheckBox.Checked -= EnableParametersCheckBoxClick; + App.Instance.EnableParametersCheckBox.IsChecked = false; + App.Instance.ParametersTextBox.IsEnabled = false; + App.Instance.EnableParametersCheckBox.Checked += EnableParametersCheckBoxClick; + } + + // Remove event handlers to ensure ordering + if (removeEventHandlers) + DisableEventHandlers(); + + // Refresh the drive info + (App.Instance.DriveLetterComboBox.SelectedItem as Drive)?.RefreshDrive(); + + // Set the initial environment and UI values + Env = DetermineEnvironment(); + GetOutputNames(true); + EnsureDiscInformation(); + + // Enable event handlers + EnableEventHandlers(); + + // Enable the dumping button, if necessary + App.Instance.StartStopButton.IsEnabled = ShouldEnableDumpingButton(); + } + /// /// Add all event handlers /// @@ -1532,7 +1569,12 @@ namespace MPF.UI.ViewModels private void UpdateVolumeLabelClick(object sender, RoutedEventArgs e) { if (_canExecuteSelectionChanged) - InitializeUIValues(removeEventHandlers: true, rescanDrives: false); + { + if (App.Options.FastUpdateLabel) + FastUpdateLabel(removeEventHandlers: true); + else + InitializeUIValues(removeEventHandlers: true, rescanDrives: false); + } } #endregion diff --git a/MPF/Windows/OptionsWindow.xaml b/MPF/Windows/OptionsWindow.xaml index 40d0076e..bc3c9bc1 100644 --- a/MPF/Windows/OptionsWindow.xaml +++ b/MPF/Windows/OptionsWindow.xaml @@ -70,12 +70,15 @@ - + /> +