2022-11-15 15:42:05 +01:00
|
|
|
using CommonHelpers;
|
2022-11-18 21:00:52 +01:00
|
|
|
using PowerControl.Helpers;
|
2022-11-21 21:27:33 +01:00
|
|
|
using PowerControl.Helpers.AMD;
|
2022-11-14 11:06:03 +01:00
|
|
|
using System.Diagnostics;
|
2022-11-21 21:27:33 +01:00
|
|
|
using static PowerControl.Helpers.AMD.DCE;
|
2022-11-14 11:06:03 +01:00
|
|
|
|
|
|
|
|
namespace PowerControl
|
|
|
|
|
{
|
|
|
|
|
internal class MenuStack
|
|
|
|
|
{
|
|
|
|
|
public static Menu.MenuRoot Root = new Menu.MenuRoot()
|
|
|
|
|
{
|
|
|
|
|
Name = String.Format("\r\n\r\nPower Control v{0}\r\n", Application.ProductVersion.ToString()),
|
|
|
|
|
Items =
|
|
|
|
|
{
|
|
|
|
|
new Menu.MenuItemWithOptions()
|
|
|
|
|
{
|
|
|
|
|
Name = "Brightness",
|
2022-11-18 09:39:08 +01:00
|
|
|
Options = { 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100 },
|
2022-11-19 09:29:44 +01:00
|
|
|
CycleOptions = false,
|
2022-11-14 11:06:03 +01:00
|
|
|
CurrentValue = delegate()
|
|
|
|
|
{
|
2022-11-18 15:56:44 +01:00
|
|
|
return Helpers.WindowsSettingsBrightnessController.Get(5.0);
|
2022-11-14 11:06:03 +01:00
|
|
|
},
|
|
|
|
|
ApplyValue = delegate(object selected)
|
|
|
|
|
{
|
|
|
|
|
Helpers.WindowsSettingsBrightnessController.Set((int)selected);
|
|
|
|
|
|
2022-11-18 15:56:44 +01:00
|
|
|
return Helpers.WindowsSettingsBrightnessController.Get(5.0);
|
2022-11-14 11:06:03 +01:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
new Menu.MenuItemWithOptions()
|
|
|
|
|
{
|
|
|
|
|
Name = "Volume",
|
2022-11-18 09:39:08 +01:00
|
|
|
Options = { 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100 },
|
2022-11-19 09:29:44 +01:00
|
|
|
CycleOptions = false,
|
2022-11-14 11:06:03 +01:00
|
|
|
CurrentValue = delegate()
|
|
|
|
|
{
|
2022-11-18 15:56:44 +01:00
|
|
|
return Helpers.AudioManager.GetMasterVolume(5.0);
|
2022-11-14 11:06:03 +01:00
|
|
|
},
|
|
|
|
|
ApplyValue = delegate(object selected)
|
|
|
|
|
{
|
|
|
|
|
Helpers.AudioManager.SetMasterVolumeMute(false);
|
|
|
|
|
Helpers.AudioManager.SetMasterVolume((int)selected);
|
|
|
|
|
|
2022-11-18 15:56:44 +01:00
|
|
|
return Helpers.AudioManager.GetMasterVolume(5.0);
|
2022-11-14 11:06:03 +01:00
|
|
|
}
|
|
|
|
|
},
|
2022-11-21 21:27:33 +01:00
|
|
|
new Menu.MenuItemSeparator(),
|
2022-11-14 11:06:03 +01:00
|
|
|
new Menu.MenuItemWithOptions()
|
2022-11-18 15:20:35 +01:00
|
|
|
{
|
|
|
|
|
Name = "Resolution",
|
|
|
|
|
ApplyDelay = 1000,
|
2022-11-18 16:15:34 +01:00
|
|
|
ResetValue = () => {
|
2022-11-21 21:27:33 +01:00
|
|
|
if (!GPUScaling.SafeResolutionChange && !Settings.Default.EnableExperimentalFeatures)
|
2022-11-18 16:15:34 +01:00
|
|
|
return null;
|
2022-11-20 15:12:12 +01:00
|
|
|
return DisplayResolutionController.GetAllResolutions().Last();
|
2022-11-18 16:15:34 +01:00
|
|
|
},
|
2022-11-18 15:20:35 +01:00
|
|
|
OptionsValues = delegate()
|
|
|
|
|
{
|
2022-11-20 15:12:12 +01:00
|
|
|
var resolutions = DisplayResolutionController.GetAllResolutions();
|
2022-11-18 15:20:35 +01:00
|
|
|
if (resolutions.Count() > 1)
|
|
|
|
|
return resolutions.Select(item => (object)item).ToArray();
|
|
|
|
|
return null;
|
|
|
|
|
},
|
|
|
|
|
CurrentValue = delegate()
|
|
|
|
|
{
|
2022-11-21 21:27:33 +01:00
|
|
|
if (!GPUScaling.SafeResolutionChange && !Settings.Default.EnableExperimentalFeatures)
|
2022-11-18 16:15:34 +01:00
|
|
|
return null;
|
2022-11-20 15:12:12 +01:00
|
|
|
return DisplayResolutionController.GetResolution();
|
2022-11-18 15:20:35 +01:00
|
|
|
},
|
|
|
|
|
ApplyValue = delegate(object selected)
|
|
|
|
|
{
|
2022-11-20 15:12:12 +01:00
|
|
|
DisplayResolutionController.SetResolution((DisplayResolutionController.DisplayResolution)selected);
|
2022-11-23 10:26:24 +01:00
|
|
|
// force refresh Refresh Rate
|
|
|
|
|
Root["Refresh Rate"].Update();
|
|
|
|
|
// force reset and refresh of FPS limit
|
|
|
|
|
Root["FPS Limit"].Reset();
|
|
|
|
|
Root["FPS Limit"].Update();
|
2022-11-20 15:12:12 +01:00
|
|
|
return DisplayResolutionController.GetResolution();
|
2022-11-18 15:20:35 +01:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
new Menu.MenuItemWithOptions()
|
2022-11-14 11:06:03 +01:00
|
|
|
{
|
|
|
|
|
Name = "Refresh Rate",
|
|
|
|
|
ApplyDelay = 1000,
|
2022-11-20 15:12:12 +01:00
|
|
|
ResetValue = () => { return DisplayResolutionController.GetRefreshRates().Max(); },
|
2022-11-14 11:06:03 +01:00
|
|
|
OptionsValues = delegate()
|
|
|
|
|
{
|
2022-11-20 15:12:12 +01:00
|
|
|
var refreshRates = DisplayResolutionController.GetRefreshRates();
|
2022-11-18 15:26:41 +01:00
|
|
|
if (refreshRates.Count() > 1)
|
|
|
|
|
return refreshRates.Select(item => (object)item).ToArray();
|
|
|
|
|
return null;
|
2022-11-14 11:06:03 +01:00
|
|
|
},
|
|
|
|
|
CurrentValue = delegate()
|
|
|
|
|
{
|
2022-11-20 15:12:12 +01:00
|
|
|
return DisplayResolutionController.GetRefreshRate();
|
2022-11-14 11:06:03 +01:00
|
|
|
},
|
|
|
|
|
ApplyValue = delegate(object selected)
|
|
|
|
|
{
|
2022-11-20 15:12:12 +01:00
|
|
|
DisplayResolutionController.SetRefreshRate((int)selected);
|
2022-11-23 10:26:24 +01:00
|
|
|
// force reset and refresh of FPS limit
|
|
|
|
|
Root["FPS Limit"].Reset();
|
|
|
|
|
Root["FPS Limit"].Update();
|
2022-11-20 15:12:12 +01:00
|
|
|
return DisplayResolutionController.GetRefreshRate();
|
2022-11-14 11:06:03 +01:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
new Menu.MenuItemWithOptions()
|
2022-11-16 20:38:45 +01:00
|
|
|
{
|
|
|
|
|
Name = "FPS Limit",
|
|
|
|
|
ApplyDelay = 500,
|
2022-11-18 16:14:29 +01:00
|
|
|
ResetValue = () => { return "Off"; },
|
2022-11-16 20:38:45 +01:00
|
|
|
OptionsValues = delegate()
|
|
|
|
|
{
|
2022-11-20 15:12:12 +01:00
|
|
|
var refreshRate = DisplayResolutionController.GetRefreshRate();
|
2022-11-16 20:38:45 +01:00
|
|
|
return new object[]
|
|
|
|
|
{
|
2022-11-19 09:29:44 +01:00
|
|
|
refreshRate / 4, refreshRate / 2, refreshRate, "Off"
|
2022-11-16 20:38:45 +01:00
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
CurrentValue = delegate()
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
RTSS.LoadProfile();
|
|
|
|
|
if (RTSS.GetProfileProperty("FramerateLimit", out int framerate))
|
|
|
|
|
return (framerate == 0) ? "Off" : framerate;
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
},
|
|
|
|
|
ApplyValue = delegate(object selected)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
int framerate = 0;
|
|
|
|
|
if (selected != null && selected.ToString() != "Off")
|
|
|
|
|
framerate = (int)selected;
|
|
|
|
|
|
|
|
|
|
RTSS.LoadProfile();
|
|
|
|
|
if (!RTSS.SetProfileProperty("FramerateLimit", framerate))
|
|
|
|
|
return null;
|
|
|
|
|
if (!RTSS.GetProfileProperty("FramerateLimit", out framerate))
|
|
|
|
|
return null;
|
|
|
|
|
RTSS.SaveProfile();
|
|
|
|
|
RTSS.UpdateProfiles();
|
|
|
|
|
return (framerate == 0) ? "Off" : framerate;
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
new Menu.MenuItemWithOptions()
|
2022-11-21 21:27:33 +01:00
|
|
|
{
|
|
|
|
|
Name = "GPU Scaling",
|
|
|
|
|
ApplyDelay = 1000,
|
|
|
|
|
Options = Enum.GetValues<GPUScaling.ScalingMode>().Cast<object>().Prepend("Off").ToArray(),
|
|
|
|
|
CurrentValue = delegate()
|
|
|
|
|
{
|
|
|
|
|
if (!GPUScaling.IsSupported)
|
|
|
|
|
return null;
|
|
|
|
|
if (!GPUScaling.Enabled)
|
|
|
|
|
return "Off";
|
|
|
|
|
return GPUScaling.Mode;
|
|
|
|
|
},
|
|
|
|
|
ApplyValue = delegate(object selected)
|
|
|
|
|
{
|
|
|
|
|
if (!GPUScaling.IsSupported)
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
|
|
if (selected is GPUScaling.ScalingMode)
|
|
|
|
|
GPUScaling.Mode = (GPUScaling.ScalingMode)selected;
|
|
|
|
|
else
|
|
|
|
|
GPUScaling.Enabled = false;
|
|
|
|
|
|
|
|
|
|
// Since the RadeonSoftware will try to revert values
|
|
|
|
|
RadeonSoftware.Kill();
|
|
|
|
|
|
|
|
|
|
Root["Resolution"].Update();
|
|
|
|
|
Root["Refresh Rate"].Update();
|
2022-11-23 10:26:24 +01:00
|
|
|
Root["FPS Limit"].Reset();
|
2022-11-21 21:27:33 +01:00
|
|
|
Root["FPS Limit"].Update();
|
|
|
|
|
|
|
|
|
|
if (!GPUScaling.Enabled)
|
|
|
|
|
return "Off";
|
|
|
|
|
return GPUScaling.Mode;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
new Menu.MenuItemWithOptions()
|
|
|
|
|
{
|
|
|
|
|
Name = "Colors",
|
|
|
|
|
ApplyDelay = 1000,
|
|
|
|
|
Options = Enum.GetValues<DCE.Mode>().Cast<object>().ToList(),
|
|
|
|
|
CurrentValue = delegate()
|
|
|
|
|
{
|
|
|
|
|
return DCE.Current;
|
|
|
|
|
},
|
|
|
|
|
ApplyValue = delegate(object selected)
|
|
|
|
|
{
|
|
|
|
|
if (DCE.Current is null)
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
|
|
DCE.Current = (DCE.Mode)selected;
|
|
|
|
|
RadeonSoftware.Kill();
|
|
|
|
|
return DCE.Current;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
new Menu.MenuItemSeparator(),
|
|
|
|
|
new Menu.MenuItemWithOptions()
|
2022-11-14 11:06:03 +01:00
|
|
|
{
|
|
|
|
|
Name = "TDP",
|
2022-11-15 15:42:05 +01:00
|
|
|
Options = { "3W", "4W", "5W", "6W", "7W", "8W", "10W", "12W", "15W" },
|
2022-11-14 11:06:03 +01:00
|
|
|
ApplyDelay = 1000,
|
2022-11-15 15:42:05 +01:00
|
|
|
ResetValue = () => { return "15W"; },
|
|
|
|
|
ActiveOption = "?",
|
2022-11-14 11:06:03 +01:00
|
|
|
ApplyValue = delegate(object selected)
|
|
|
|
|
{
|
2022-11-15 15:42:05 +01:00
|
|
|
uint mW = uint.Parse(selected.ToString().Replace("W", "")) * 1000;
|
2022-11-14 11:06:03 +01:00
|
|
|
|
2022-11-15 15:42:05 +01:00
|
|
|
if (VangoghGPU.IsSupported)
|
2022-11-14 11:06:03 +01:00
|
|
|
{
|
2022-11-20 21:17:21 +01:00
|
|
|
return Instance.WithGlobalMutex<object>(200, () =>
|
2022-11-15 15:42:05 +01:00
|
|
|
{
|
2022-11-20 21:17:21 +01:00
|
|
|
using (var sd = VangoghGPU.Open())
|
|
|
|
|
{
|
|
|
|
|
if (sd is null)
|
|
|
|
|
return null;
|
2022-11-15 15:42:05 +01:00
|
|
|
|
2022-11-20 21:17:21 +01:00
|
|
|
sd.SlowTDP = mW;
|
|
|
|
|
sd.FastTDP = mW;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return selected;
|
|
|
|
|
});
|
2022-11-14 11:06:03 +01:00
|
|
|
}
|
2022-11-15 15:42:05 +01:00
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
uint stampLimit = mW/10;
|
2022-11-14 11:06:03 +01:00
|
|
|
|
2022-11-15 15:42:05 +01:00
|
|
|
Process.Start(new ProcessStartInfo()
|
|
|
|
|
{
|
|
|
|
|
FileName = "Resources/RyzenAdj/ryzenadj.exe",
|
|
|
|
|
ArgumentList = {
|
|
|
|
|
"--stapm-limit=" + stampLimit.ToString(),
|
|
|
|
|
"--slow-limit=" + mW.ToString(),
|
|
|
|
|
"--fast-limit=" + mW.ToString(),
|
|
|
|
|
},
|
|
|
|
|
WindowStyle = ProcessWindowStyle.Hidden,
|
|
|
|
|
UseShellExecute = false,
|
|
|
|
|
CreateNoWindow = true
|
|
|
|
|
});
|
2022-11-14 11:06:03 +01:00
|
|
|
|
2022-11-20 21:17:21 +01:00
|
|
|
return selected;
|
|
|
|
|
}
|
2022-11-15 15:42:05 +01:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
new Menu.MenuItemWithOptions()
|
|
|
|
|
{
|
2022-11-20 19:00:53 +01:00
|
|
|
Name = "GPU",
|
|
|
|
|
Options = { "Default", "400MHz", "800MHz", "1200MHz", "1600MHz" },
|
2022-11-15 15:42:05 +01:00
|
|
|
ApplyDelay = 1000,
|
|
|
|
|
Visible = VangoghGPU.IsSupported,
|
|
|
|
|
ActiveOption = "?",
|
2022-11-20 19:00:53 +01:00
|
|
|
ResetValue = () => { return "Default"; },
|
2022-11-15 15:42:05 +01:00
|
|
|
ApplyValue = delegate(object selected)
|
|
|
|
|
{
|
2022-11-20 21:17:21 +01:00
|
|
|
return Instance.WithGlobalMutex<object>(200, () =>
|
2022-11-15 22:30:59 +01:00
|
|
|
{
|
2022-11-20 21:17:21 +01:00
|
|
|
using (var sd = VangoghGPU.Open())
|
2022-11-20 19:00:53 +01:00
|
|
|
{
|
2022-11-20 21:17:21 +01:00
|
|
|
if (sd is null)
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
|
|
if (selected.ToString() == "Default")
|
|
|
|
|
{
|
|
|
|
|
sd.HardMinGfxClock = 200;
|
|
|
|
|
return selected;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sd.HardMinGfxClock = uint.Parse(selected.ToString().Replace("MHz", ""));
|
2022-11-20 19:00:53 +01:00
|
|
|
return selected;
|
|
|
|
|
}
|
2022-11-20 21:17:21 +01:00
|
|
|
});
|
2022-11-14 11:06:03 +01:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
new Menu.MenuItemWithOptions()
|
|
|
|
|
{
|
2022-11-20 19:00:53 +01:00
|
|
|
Name = "CPU",
|
|
|
|
|
Options = { "Default", "Power-Save", "Balanced", "Max" },
|
2022-11-14 11:06:03 +01:00
|
|
|
ApplyDelay = 1000,
|
2022-11-15 15:42:05 +01:00
|
|
|
ActiveOption = "?",
|
|
|
|
|
Visible = VangoghGPU.IsSupported,
|
2022-11-20 19:00:53 +01:00
|
|
|
ResetValue = () => { return "Default"; },
|
2022-11-15 15:42:05 +01:00
|
|
|
ApplyValue = delegate(object selected)
|
|
|
|
|
{
|
2022-11-20 21:17:21 +01:00
|
|
|
return Instance.WithGlobalMutex<object>(200, () =>
|
2022-11-15 15:42:05 +01:00
|
|
|
{
|
2022-11-20 21:17:21 +01:00
|
|
|
using (var sd = VangoghGPU.Open())
|
2022-11-20 19:00:53 +01:00
|
|
|
{
|
2022-11-20 21:17:21 +01:00
|
|
|
if (sd is null)
|
|
|
|
|
return null;
|
2022-11-20 19:00:53 +01:00
|
|
|
|
2022-11-20 21:17:21 +01:00
|
|
|
switch(selected.ToString())
|
|
|
|
|
{
|
|
|
|
|
case "Default":
|
|
|
|
|
sd.MinCPUClock = 1400;
|
|
|
|
|
sd.MaxCPUClock = 3500;
|
|
|
|
|
break;
|
2022-11-20 19:00:53 +01:00
|
|
|
|
2022-11-20 21:17:21 +01:00
|
|
|
case "Power-Save":
|
|
|
|
|
sd.MinCPUClock = 1400;
|
|
|
|
|
sd.MaxCPUClock = 1800;
|
|
|
|
|
break;
|
2022-11-20 19:00:53 +01:00
|
|
|
|
2022-11-20 21:17:21 +01:00
|
|
|
case "Balanced":
|
|
|
|
|
sd.MinCPUClock = 2200;
|
|
|
|
|
sd.MaxCPUClock = 2800;
|
|
|
|
|
break;
|
2022-11-20 19:00:53 +01:00
|
|
|
|
2022-11-20 21:17:21 +01:00
|
|
|
case "Max":
|
|
|
|
|
sd.MinCPUClock = 3000;
|
|
|
|
|
sd.MaxCPUClock = 3500;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
return selected;
|
2022-11-20 19:00:53 +01:00
|
|
|
}
|
2022-11-20 21:17:21 +01:00
|
|
|
});
|
2022-11-15 15:42:05 +01:00
|
|
|
}
|
2022-11-16 00:33:23 +01:00
|
|
|
},
|
2022-11-18 21:00:52 +01:00
|
|
|
new Menu.MenuItemWithOptions()
|
|
|
|
|
{
|
|
|
|
|
Name = "SMT",
|
|
|
|
|
ApplyDelay = 500,
|
|
|
|
|
Options = { "No", "Yes" },
|
|
|
|
|
ResetValue = () => { return "Yes"; },
|
|
|
|
|
CurrentValue = delegate()
|
|
|
|
|
{
|
|
|
|
|
if (!RTSS.IsOSDForeground(out var processId))
|
|
|
|
|
return null;
|
|
|
|
|
if (!ProcessorCores.HasSMTThreads())
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
|
|
return ProcessorCores.IsUsingSMT(processId.Value) ? "Yes" : "No";
|
|
|
|
|
},
|
|
|
|
|
ApplyValue = delegate(object selected)
|
|
|
|
|
{
|
|
|
|
|
if (!RTSS.IsOSDForeground(out var processId))
|
|
|
|
|
return null;
|
|
|
|
|
if (!ProcessorCores.HasSMTThreads())
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
|
|
ProcessorCores.SetProcessSMT(processId.Value, selected.ToString() == "Yes");
|
|
|
|
|
|
|
|
|
|
return ProcessorCores.IsUsingSMT(processId.Value) ? "Yes" : "No";
|
|
|
|
|
}
|
|
|
|
|
},
|
2022-11-16 00:33:23 +01:00
|
|
|
new Menu.MenuItemSeparator(),
|
|
|
|
|
new Menu.MenuItemWithOptions()
|
|
|
|
|
{
|
|
|
|
|
Name = "OSD",
|
|
|
|
|
ApplyDelay = 500,
|
|
|
|
|
OptionsValues = delegate()
|
|
|
|
|
{
|
|
|
|
|
return Enum.GetValues<OverlayEnabled>().Select(item => (object)item).ToArray();
|
|
|
|
|
},
|
|
|
|
|
CurrentValue = delegate()
|
|
|
|
|
{
|
|
|
|
|
if (SharedData<OverlayModeSetting>.GetExistingValue(out var value))
|
|
|
|
|
return value.CurrentEnabled;
|
|
|
|
|
return null;
|
|
|
|
|
},
|
|
|
|
|
ApplyValue = delegate(object selected)
|
|
|
|
|
{
|
|
|
|
|
if (!SharedData<OverlayModeSetting>.GetExistingValue(out var value))
|
|
|
|
|
return null;
|
|
|
|
|
value.DesiredEnabled = (OverlayEnabled)selected;
|
|
|
|
|
if (!SharedData<OverlayModeSetting>.SetExistingValue(value))
|
|
|
|
|
return null;
|
|
|
|
|
return selected;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
new Menu.MenuItemWithOptions()
|
|
|
|
|
{
|
|
|
|
|
Name = "OSD Mode",
|
|
|
|
|
ApplyDelay = 500,
|
|
|
|
|
OptionsValues = delegate()
|
|
|
|
|
{
|
|
|
|
|
return Enum.GetValues<OverlayMode>().Select(item => (object)item).ToArray();
|
|
|
|
|
},
|
|
|
|
|
CurrentValue = delegate()
|
|
|
|
|
{
|
|
|
|
|
if (SharedData<OverlayModeSetting>.GetExistingValue(out var value))
|
|
|
|
|
return value.Current;
|
|
|
|
|
return null;
|
|
|
|
|
},
|
|
|
|
|
ApplyValue = delegate(object selected)
|
|
|
|
|
{
|
|
|
|
|
if (!SharedData<OverlayModeSetting>.GetExistingValue(out var value))
|
|
|
|
|
return null;
|
|
|
|
|
value.Desired = (OverlayMode)selected;
|
|
|
|
|
if (!SharedData<OverlayModeSetting>.SetExistingValue(value))
|
|
|
|
|
return null;
|
|
|
|
|
return selected;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
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;
|
|
|
|
|
}
|
2022-11-14 11:06:03 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|