mirror of
https://github.com/SabreTools/MPF.git
synced 2026-07-02 17:24:48 +00:00
Originally intended behaviour of the Update Label button. (#459)
* Originally intended behaviour of the Update Label button. Sets up the environment and simply updates the output path and filename. No System, Media, Drive, or Speed changes. It's a very fast update meant for large lots of similar discs. * Functionized the FastUpdateLabel code path. Added new UI option to enable Fast Update Label feature. Added missing function calls. Prevents UI misbehaviour. * Fixed several glaring holes in the process. ^_^ * Removed some unecessary code.
This commit is contained in:
@@ -87,6 +87,15 @@ namespace MPF.Core.Data
|
||||
set { _settings["CheckForUpdatesOnStartup"] = value.ToString(); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fast update label - Skips disc checks and updates path only
|
||||
/// </summary>
|
||||
public bool FastUpdateLabel
|
||||
{
|
||||
get { return GetBooleanSetting(_settings, "FastUpdateLabel", false); }
|
||||
set { _settings["FastUpdateLabel"] = value.ToString(); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Default output path for dumps
|
||||
/// </summary>
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Performs a fast update of the output path while skipping disc checks
|
||||
/// </summary>
|
||||
/// <param name="removeEventHandlers">Whether event handlers need to be removed first</param>
|
||||
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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add all event handlers
|
||||
/// </summary>
|
||||
@@ -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
|
||||
|
||||
@@ -70,12 +70,15 @@
|
||||
<CheckBox VerticalAlignment="Center" Content="Enable Dark Mode"
|
||||
IsChecked="{Binding Options.EnableDarkMode}"
|
||||
ToolTip="(Experimental) Enable dark mode across the entire application" Margin="0,4"
|
||||
/>
|
||||
|
||||
/>
|
||||
<CheckBox VerticalAlignment="Center" Content="Check for Updates on Startup"
|
||||
IsChecked="{Binding Options.CheckForUpdatesOnStartup}"
|
||||
ToolTip="Check for updates when the application starts" Margin="0,4"
|
||||
/>
|
||||
<CheckBox VerticalAlignment="Center" Content="Fast Update Label"
|
||||
IsChecked="{Binding Options.FastUpdateLabel}"
|
||||
ToolTip="Bypasses disc checks to quickly update the output path. Use with caution!" Margin="0,4"
|
||||
/>
|
||||
</UniformGrid>
|
||||
</TabItem>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user