PowerControl: Base Profiles Implementation (#38)

Small refactor of menu with options

Fix protection error on menuwithoptions

Make profiles controller non static

Dynamicall set and load options

Use IsOSDForeground when retriveing current game name

Better alt-tab functionality

Get rid off thread.sleep

Merged #38
This commit is contained in:
maniman303 2022-12-20 22:52:56 +01:00 committed by Kamil Trzciński
parent ef94d24cfc
commit 3252e799cb
7 changed files with 252 additions and 12 deletions

View file

@ -8,6 +8,7 @@ namespace PowerControl.Options
public static Menu.MenuItemWithOptions Instance = new Menu.MenuItemWithOptions()
{
Name = "FPS Limit",
PersistentKey = "FPSLimit",
ApplyDelay = 500,
ResetValue = () => { return "Off"; },
OptionsValues = delegate ()

View file

@ -8,6 +8,7 @@ namespace PowerControl.Options
public static Menu.MenuItemWithOptions Instance = new Menu.MenuItemWithOptions()
{
Name = "Refresh Rate",
PersistentKey = "RefreshRate",
ApplyDelay = 1000,
ResetValue = () => { return DisplayResolutionController.GetRefreshRates().Max().ToString(); },
OptionsValues = delegate ()
@ -24,10 +25,14 @@ namespace PowerControl.Options
ApplyValue = (selected) =>
{
DisplayResolutionController.SetRefreshRate(int.Parse(selected));
return DisplayResolutionController.GetRefreshRate().ToString();
},
AfterApply = () =>
{
// force reset and refresh of FPS limit
FPSLimit.Instance.Reset();
FPSLimit.Instance.Update();
return DisplayResolutionController.GetRefreshRate().ToString();
}
};
}