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

@ -33,6 +33,8 @@ namespace PowerControl
DateTime? neptuneDeviceNextKey;
System.Windows.Forms.Timer neptuneTimer;
ProfilesController profilesController;
SharedData<PowerControlSetting> sharedData = SharedData<PowerControlSetting>.CreateNew();
static Controller()
@ -110,6 +112,9 @@ namespace PowerControl
osdTimer.Interval = 250;
osdTimer.Enabled = true;
profilesController = new ProfilesController();
profilesController.Initialize();
GlobalHotKey.RegisterHotKey(Settings.Default.MenuUpKey, () =>
{
if (!RTSS.IsOSDForeground())
@ -409,6 +414,9 @@ namespace PowerControl
System.Windows.Threading.Dispatcher.CurrentDispatcher.BeginInvoke(
new Action(() =>
{
Options.RefreshRate.Instance?.Reset();
Options.FPSLimit.Instance?.Reset();
rootMenu.Update();
})
);