private void AdjustmentThrottle_Tick(object state) { if (_display == null) { return; } lock (_queueLock) { if (_brightnessAdjustQueue.TryPop(out byte newBrightnessValue)) { byte[] writeBuffer = new byte[] { BACKLIGHT_REGISTER_ADDRESS, newBrightnessValue }; try { _display.Write(writeBuffer); BrightnessChanged?.Invoke(this, newBrightnessValue); } catch (Exception ex) { Debug.WriteLine($"Failed to update backlight brightness: {ex}"); } } _brightnessAdjustQueue.Clear(); _adjustmentThrottle.Change(Timeout.Infinite, Timeout.Infinite); } }
private void CANInterface_MessageReceived(C4UFX.CANMessage message) { if (message.Data[0] == (byte)Commands.CmdStatLightValue && CANInterface.IdToFndTnd(message.ID).FromDevice == deviceId) { if (brightness != message.Data[1]) { BrightnessChanged?.Invoke(message.Data[1]); } brightness = message.Data[1]; } }
public void BrightnessTick(int currBrightness) { int currState = WMITool.GetBatteryState(); if (currState != prevState) { WMITool.SetBrightness(currentInstance, prevBrightness); BrightnessChanged?.Invoke(prevBrightness); } prevState = currState; prevBrightness = currBrightness; }
private void setBrightnessButton_Click(object sender, EventArgs e) { if (!ValidateChildren()) { return; } var b = GetBrightnessValue(); var args = new ViewBrightnessChangedEventArgs { Brightness = b }; BrightnessChanged?.Invoke(args); }
private void OnBrightnessChanged() { BrightnessChanged?.Invoke(); }
private void OnBrightnessChanged() { BrightnessChanged?.Invoke(this, EventArgs.Empty); }
private void DispatchBrightnessChanged(ModelBrightnessChangedEventArgs e) { BrightnessChanged?.Invoke(e); }
private void OnBrightnessChanged(object sender, EventArgs e) { float.TryParse(txtBrightness.Text, out _brightness); _eventArgs.Brightness = _brightness; BrightnessChanged?.Invoke(this, _eventArgs); }
protected virtual void OnBrighnessChanged(ScreenPageEventArgs e) { BrightnessChanged?.Invoke(this, e); }