public void SetBrightness(int targetBrightness) { if (targetBrightness < 0 || targetBrightness > 100) { PackageHost.WriteError("Invalid value !"); } else { WindowsBrightness.SetBrightness((byte)targetBrightness); } }
public void BrightnessDown() { int currentValue = WindowsBrightness.GetBrightness(); byte[] levels = WindowsBrightness.GetBrightnessLevels(); for (int i = levels.Length - 1; i > 0; i--) { if (currentValue > levels[i]) { WindowsBrightness.SetBrightness(levels[i]); break; } } }
public void BrightnessUp() { int currentValue = WindowsBrightness.GetBrightness(); byte[] levels = WindowsBrightness.GetBrightnessLevels(); for (int i = 0; i < levels.Length; i++) { if (levels[i] > currentValue) { WindowsBrightness.SetBrightness(levels[i]); break; } } }