mirror of
https://github.com/ayufan/steam-deck-tools.git
synced 2026-04-07 07:14:04 +00:00
PowerControl: Decompose MenuStack.cs into Options/
This commit is contained in:
parent
ebe1cdba87
commit
f207c12935
18 changed files with 660 additions and 528 deletions
32
PowerControl/Options/FanControl.cs
Normal file
32
PowerControl/Options/FanControl.cs
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
using CommonHelpers;
|
||||
|
||||
namespace PowerControl.Options
|
||||
{
|
||||
public static class FanControl
|
||||
{
|
||||
public static Menu.MenuItemWithOptions Instance = new Menu.MenuItemWithOptions()
|
||||
{
|
||||
Name = "FAN",
|
||||
ApplyDelay = 500,
|
||||
OptionsValues = delegate ()
|
||||
{
|
||||
return Enum.GetValues<FanMode>().Select(item => (object)item).ToArray();
|
||||
},
|
||||
CurrentValue = delegate ()
|
||||
{
|
||||
if (SharedData<FanModeSetting>.GetExistingValue(out var value))
|
||||
return value.Current;
|
||||
return null;
|
||||
},
|
||||
ApplyValue = delegate (object selected)
|
||||
{
|
||||
if (!SharedData<FanModeSetting>.GetExistingValue(out var value))
|
||||
return null;
|
||||
value.Desired = (FanMode)selected;
|
||||
if (!SharedData<FanModeSetting>.SetExistingValue(value))
|
||||
return null;
|
||||
return selected;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue