PowerControl: Retain FPS Limit (proportion) on refresh rate change

This commit is contained in:
Kamil Trzciński 2023-02-08 20:17:11 +01:00
parent bc9c3199b7
commit 5cd873b9a3
6 changed files with 58 additions and 24 deletions

View file

@ -16,6 +16,7 @@ namespace PowerControl.Menu
public Func<string?>? CurrentValue { get; set; }
public Func<string[]?>? OptionsValues { get; set; }
public Func<string, string?>? ApplyValue { get; set; }
public Action<MenuItemWithOptions, string?, string>? ImpactedBy { get; set; }
public Action? AfterApply { get; set; }
public Func<string?>? ResetValue { get; set; }
@ -114,9 +115,6 @@ namespace PowerControl.Menu
CommonHelpers.Log.TraceException("FinalizeSet", Name, e);
Update();
}
if (AfterApply != null && runAfterApply)
AfterApply();
}
else
ActiveOption = SelectedOption;
@ -124,7 +122,19 @@ namespace PowerControl.Menu
SelectedOption = null;
if (wasOption != ActiveOption && ActiveOption != null)
{
if (AfterApply != null)
AfterApply();
foreach (var impact in Impacts)
{
if (impact.ImpactedBy is not null)
impact.ImpactedBy(this, wasOption, ActiveOption);
impact.Update();
}
ValueChanged(this, wasOption, ActiveOption);
}
}
public override void CreateMenu(System.Windows.Forms.ContextMenuStrip contextMenu)