Skip to content

Commit

Permalink
Refactoring: extracted a new private method GetRepairSelState().
Browse files Browse the repository at this point in the history
  • Loading branch information
xvitaly committed Apr 14, 2024
1 parent 137c09c commit ddf4035
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/srcrepair/FrmMainW.cs
Original file line number Diff line number Diff line change
Expand Up @@ -789,6 +789,15 @@ private void CheckSymbolsGame()
}
}

/// <summary>
/// Get the selection status of repair procedures.
/// </summary>
/// <returns>Returns True if at least one repair procedure is selected.</returns>
private bool GetRepairSelState()
{
return PS_CleanBlobs.Checked || PS_CleanRegistry.Checked;
}

/// <summary>
/// Handles with installed FPS-configs and shows special icon.
/// </summary>
Expand Down Expand Up @@ -1736,7 +1745,7 @@ private async void FrmMainW_Load(object sender, EventArgs e)
/// <param name="e">Event arguments.</param>
private void PS_CleanBlobs_CheckedChanged(object sender, EventArgs e)
{
PS_ExecuteNow.Enabled = PS_CleanBlobs.Checked || PS_CleanRegistry.Checked;
PS_ExecuteNow.Enabled = GetRepairSelState();
}

/// <summary>
Expand All @@ -1746,7 +1755,7 @@ private void PS_CleanBlobs_CheckedChanged(object sender, EventArgs e)
/// <param name="e">Event arguments.</param>
private void PS_CleanRegistry_CheckedChanged(object sender, EventArgs e)
{
PS_ExecuteNow.Enabled = PS_CleanRegistry.Checked || PS_CleanBlobs.Checked;
PS_ExecuteNow.Enabled = GetRepairSelState();
}

/// <summary>
Expand All @@ -1756,7 +1765,7 @@ private void PS_CleanRegistry_CheckedChanged(object sender, EventArgs e)
/// <param name="e">Event arguments.</param>
private void PS_ExecuteNow_Click(object sender, EventArgs e)
{
if ((PS_CleanBlobs.Checked || PS_CleanRegistry.Checked) && MessageBox.Show(AppStrings.PS_ExecuteMSG, Properties.Resources.AppName, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
if (GetRepairSelState() && MessageBox.Show(AppStrings.PS_ExecuteMSG, Properties.Resources.AppName, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
{
if (ProcessManager.ProcessTerminate("Steam") != 0)
{
Expand Down

0 comments on commit ddf4035

Please sign in to comment.