From c786710b65e557e1ed1271a5ff3ea74dd0414a4a Mon Sep 17 00:00:00 2001 From: Darth Affe Date: Thu, 3 Aug 2017 18:57:10 +0200 Subject: [PATCH] Correctly persisted update-rate in the ambilight example --- Examples/Ambilight/Example_Ambilight_full/Ambilight.cs | 5 ++--- .../Example_Ambilight_full/TakeAsIs/AmbilightSettings.cs | 1 + .../Example_Ambilight_full/TakeAsIs/UI/ConfigViewModel.cs | 8 ++++++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Examples/Ambilight/Example_Ambilight_full/Ambilight.cs b/Examples/Ambilight/Example_Ambilight_full/Ambilight.cs index 9cdf656..09b5b52 100644 --- a/Examples/Ambilight/Example_Ambilight_full/Ambilight.cs +++ b/Examples/Ambilight/Example_Ambilight_full/Ambilight.cs @@ -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(); diff --git a/Examples/Ambilight/Example_Ambilight_full/TakeAsIs/AmbilightSettings.cs b/Examples/Ambilight/Example_Ambilight_full/TakeAsIs/AmbilightSettings.cs index 0b768b3..c90660e 100644 --- a/Examples/Ambilight/Example_Ambilight_full/TakeAsIs/AmbilightSettings.cs +++ b/Examples/Ambilight/Example_Ambilight_full/TakeAsIs/AmbilightSettings.cs @@ -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; diff --git a/Examples/Ambilight/Example_Ambilight_full/TakeAsIs/UI/ConfigViewModel.cs b/Examples/Ambilight/Example_Ambilight_full/TakeAsIs/UI/ConfigViewModel.cs index 0be7edf..ad99bac 100644 --- a/Examples/Ambilight/Example_Ambilight_full/TakeAsIs/UI/ConfigViewModel.cs +++ b/Examples/Ambilight/Example_Ambilight_full/TakeAsIs/UI/ConfigViewModel.cs @@ -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