1
0
mirror of https://github.com/DarthAffe/CUE.NET.git synced 2025-12-12 08:48:30 +00:00

Correctly persisted update-rate in the ambilight example

This commit is contained in:
Darth Affe 2017-08-03 18:57:10 +02:00
parent 63ef78f8fc
commit c786710b65
3 changed files with 9 additions and 5 deletions

View File

@ -1,5 +1,4 @@
using System;
using System.Drawing;
using System.Drawing;
using CUE.NET;
using CUE.NET.Brushes;
using CUE.NET.Devices.Generic.Enums;
@ -36,7 +35,7 @@ namespace Example_Ambilight_full
{
CueSDK.Initialize();
CueSDK.UpdateMode = UpdateMode.Continuous;
CueSDK.UpdateFrequency = 1 / 20f;
CueSDK.UpdateFrequency = 1f / _settings.UpdateRate;
SetAmbilightBrush();
_settings.AmbienceCreatorTypeChanged += (sender, args) => SetAmbilightBrush();

View File

@ -23,6 +23,7 @@ namespace Example_Ambilight_full.TakeAsIs
}
}
public int UpdateRate { get; set; } = 20;
public int OffsetLeft { get; set; } = 0;
public int OffsetRight { get; set; } = 0;
public int OffsetTop { get; set; } = 0;

View File

@ -12,8 +12,12 @@ namespace Example_Ambilight_full.TakeAsIs.UI
public int UpdateRate
{
get { return (int)Math.Round(1f / CueSDK.UpdateFrequency); }
set { CueSDK.UpdateFrequency = 1f / value; }
get => (int)Math.Round(1f / CueSDK.UpdateFrequency);
set
{
Settings.UpdateRate = value;
CueSDK.UpdateFrequency = 1f / value;
}
}
#endregion