PowerControl: Update and expose UserProfiles that can persist per-game settings

This commit is contained in:
Kamil Trzciński 2023-01-05 23:35:31 +01:00
parent 3252e799cb
commit 2d5f8c498f
11 changed files with 436 additions and 200 deletions

View file

@ -33,7 +33,7 @@ namespace PowerControl
DateTime? neptuneDeviceNextKey;
System.Windows.Forms.Timer neptuneTimer;
ProfilesController profilesController;
ProfilesController? profilesController;
SharedData<PowerControlSetting> sharedData = SharedData<PowerControlSetting>.CreateNew();
@ -113,7 +113,6 @@ namespace PowerControl
osdTimer.Enabled = true;
profilesController = new ProfilesController();
profilesController.Initialize();
GlobalHotKey.RegisterHotKey(Settings.Default.MenuUpKey, () =>
{
@ -222,6 +221,10 @@ namespace PowerControl
notifyIcon.Icon = Resources.traffic_light_outline_red;
}
var watchedProfiles = profilesController?.WatchedProfiles ?? new string[0];
if (watchedProfiles.Any())
notifyIcon.Text += ". Profile: " + string.Join(", ", watchedProfiles);
updateOSD();
}
@ -381,6 +384,7 @@ namespace PowerControl
public void Dispose()
{
using (profilesController) { }
components.Dispose();
osdClose();
}