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);
            }
        }
예제 #2
0
        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];
            }
        }
예제 #3
0
        public void BrightnessTick(int currBrightness)
        {
            int currState = WMITool.GetBatteryState();

            if (currState != prevState)
            {
                WMITool.SetBrightness(currentInstance, prevBrightness);
                BrightnessChanged?.Invoke(prevBrightness);
            }

            prevState      = currState;
            prevBrightness = currBrightness;
        }
예제 #4
0
        private void setBrightnessButton_Click(object sender, EventArgs e)
        {
            if (!ValidateChildren())
            {
                return;
            }

            var b    = GetBrightnessValue();
            var args = new ViewBrightnessChangedEventArgs {
                Brightness = b
            };

            BrightnessChanged?.Invoke(args);
        }
예제 #5
0
 private void OnBrightnessChanged()
 {
     BrightnessChanged?.Invoke();
 }
예제 #6
0
 private void OnBrightnessChanged()
 {
     BrightnessChanged?.Invoke(this, EventArgs.Empty);
 }
예제 #7
0
 private void DispatchBrightnessChanged(ModelBrightnessChangedEventArgs e)
 {
     BrightnessChanged?.Invoke(e);
 }
예제 #8
0
 private void OnBrightnessChanged(object sender, EventArgs e)
 {
     float.TryParse(txtBrightness.Text, out _brightness);
     _eventArgs.Brightness = _brightness;
     BrightnessChanged?.Invoke(this, _eventArgs);
 }
예제 #9
0
 protected virtual void OnBrighnessChanged(ScreenPageEventArgs e)
 {
     BrightnessChanged?.Invoke(this, e);
 }