mirror of
https://github.com/snltty/linker.git
synced 2025-10-30 20:16:53 +08:00
31 lines
794 B
C#
31 lines
794 B
C#
namespace cmonitor.client.reports.light
|
|
{
|
|
public sealed class LightWindows : ILight
|
|
{
|
|
private readonly LightWindowsWatcher lightWatcher;
|
|
private int value = 0;
|
|
public LightWindows(Config config)
|
|
{
|
|
if (config.IsCLient)
|
|
{
|
|
lightWatcher = new LightWindowsWatcher();
|
|
lightWatcher.BrightnessChanged += (e, value) =>
|
|
{
|
|
this.value = (int)value.newBrightness;
|
|
};
|
|
value = LightWindowsWmiHelper.GetBrightnessLevel();
|
|
}
|
|
}
|
|
|
|
public int Get()
|
|
{
|
|
return value;
|
|
}
|
|
|
|
public void Set(int value)
|
|
{
|
|
LightWindowsWmiHelper.SetBrightnessLevel(value);
|
|
}
|
|
}
|
|
}
|