Separate params checkbox from input

This commit is contained in:
Matt Nadareski
2024-12-20 22:31:10 -05:00
parent 17f850ecb2
commit bc0cd60fc1
3 changed files with 33 additions and 15 deletions

View File

@@ -108,6 +108,7 @@
- Fix output name null edge case
- Selectively rebuild program list
- Use IBM PC as default system out of the box
- Separate params checkbox from input
### 3.2.4 (2024-11-24)

View File

@@ -316,6 +316,20 @@ namespace MPF.Frontend.ViewModels
/// <summary>
/// Indicates the status of the parameters text box
/// </summary>
public bool ParametersTextBoxEnabled
{
get => _parametersTextBoxEnabled;
set
{
_parametersTextBoxEnabled = value;
TriggerPropertyChanged(nameof(ParametersTextBoxEnabled));
}
}
private bool _parametersTextBoxEnabled;
/// <summary>
/// Indicates the status of the parameters check box
/// </summary>
public bool ParametersCheckBoxEnabled
{
get => _parametersCheckBoxEnabled;
@@ -995,12 +1009,12 @@ namespace MPF.Frontend.ViewModels
// Disable the dumping button
StartStopButtonEnabled = false;
// Safely uncheck the parameters box, just in case
if (ParametersCheckBoxEnabled == true)
// Safely check the parameters box, just in case
if (ParametersCheckBoxEnabled == false)
{
bool cachedCanExecuteSelectionChanged = CanExecuteSelectionChanged;
DisableEventHandlers();
ParametersCheckBoxEnabled = false;
ParametersCheckBoxEnabled = true;
if (cachedCanExecuteSelectionChanged) EnableEventHandlers();
}
@@ -1050,12 +1064,12 @@ namespace MPF.Frontend.ViewModels
// Disable the dumping button
StartStopButtonEnabled = false;
// Safely uncheck the parameters box, just in case
if (ParametersCheckBoxEnabled == true)
// Safely check the parameters box, just in case
if (ParametersCheckBoxEnabled == false)
{
bool cachedCanExecuteSelectionChanged = CanExecuteSelectionChanged;
DisableEventHandlers();
ParametersCheckBoxEnabled = false;
ParametersCheckBoxEnabled = true;
if (cachedCanExecuteSelectionChanged) EnableEventHandlers();
}
@@ -1331,8 +1345,8 @@ namespace MPF.Frontend.ViewModels
// If we're in a type that doesn't support drive speeds
DriveSpeedComboBoxEnabled = _environment.DoesSupportDriveSpeed();
// If input params are not enabled, generate the full parameters from the environment
if (!ParametersCheckBoxEnabled)
// If input params are enabled, generate the full parameters from the environment
if (ParametersCheckBoxEnabled)
{
var generated = _environment.GetFullParameters(DriveSpeed);
if (generated != null)
@@ -2008,12 +2022,12 @@ namespace MPF.Frontend.ViewModels
_environment.RefreshDrive();
// If still in custom parameter mode, check that users meant to continue or not
if (ParametersCheckBoxEnabled == true && _displayUserMessage != null)
if (ParametersCheckBoxEnabled == false && _displayUserMessage != null)
{
bool? result = _displayUserMessage("Custom Changes", "It looks like you have custom parameters that have not been saved. Would you like to apply those changes before starting to dump?", 3, true);
if (result == true)
{
ParametersCheckBoxEnabled = false;
ParametersCheckBoxEnabled = true;
ProcessCustomParameters();
}
else if (result == null)
@@ -2023,9 +2037,6 @@ namespace MPF.Frontend.ViewModels
// If false, then we continue with the current known environment
}
// Run path adjustments for DiscImageCreator -- Disabled until further notice
//Env.AdjustPathsForDiscImageCreator();
try
{
// Run pre-dumping validation checks
@@ -2092,7 +2103,7 @@ namespace MPF.Frontend.ViewModels
/// </summary>
public void ToggleParameters()
{
if (ParametersCheckBoxEnabled == true)
if (ParametersCheckBoxEnabled == false)
{
SystemTypeComboBoxEnabled = false;
MediaTypeComboBoxEnabled = false;
@@ -2100,6 +2111,9 @@ namespace MPF.Frontend.ViewModels
OutputPathTextBoxEnabled = false;
OutputPathBrowseButtonEnabled = false;
DumpingProgramComboBoxEnabled = false;
ParametersTextBoxEnabled = false;
MediaScanButtonEnabled = false;
UpdateVolumeLabelEnabled = false;
CopyProtectScanButtonEnabled = false;
@@ -2114,6 +2128,9 @@ namespace MPF.Frontend.ViewModels
OutputPathTextBoxEnabled = true;
OutputPathBrowseButtonEnabled = true;
DumpingProgramComboBoxEnabled = true;
ParametersTextBoxEnabled = true;
MediaScanButtonEnabled = true;
UpdateVolumeLabelEnabled = true;
CopyProtectScanButtonEnabled = true;

View File

@@ -182,7 +182,7 @@
<Label x:Name="ParametersLabel" Grid.Row="5" Grid.Column="0" VerticalAlignment="Center" Content="Parameters"/>
<TextBox x:Name="ParametersTextBox" Grid.Row="5" Grid.Column="1" Height="22" Width="370" HorizontalAlignment="Left" VerticalContentAlignment="Center"
Text="{Binding Parameters, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
IsEnabled="{Binding ParametersCheckBoxEnabled}"/>
IsEnabled="{Binding ParametersTextBoxEnabled}"/>
<CheckBox x:Name="EnableParametersCheckBox" Grid.Row="5" Grid.Column="1" Height="22" HorizontalAlignment="Right"
IsChecked="{Binding ParametersCheckBoxEnabled, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
IsEnabled="{Binding EnableParametersCheckBoxEnabled}"/>