diff --git a/HueUWP/APIHandler.cs b/HueUWP/APIHandler.cs index f18f9bf..d8748d1 100755 --- a/HueUWP/APIHandler.cs +++ b/HueUWP/APIHandler.cs @@ -114,8 +114,8 @@ namespace HueUWP } else { - alllights.Add(new Light() { api = this, ID = Int32.Parse(i.Key), Brightness = (int)state["bri"], SaturationEnabled = false, HueEnabled = false, IsOn = ((string)state["on"]).ToLower() == "true" ? true : false, Hue = -1, Saturation = 254, Name = (string)light["name"], Type = (string)light["type"] }); - } + alllights.Add(new Light() { api = this, ID = Int32.Parse(i.Key), Brightness = (int)state["bri"], SaturationEnabled = false,HueEnabled = false,IsOn = ((string)state["on"]).ToLower() == "true" ? true : false, Hue =0, Saturation = 0, Name = (string)light["name"], Type = (string)light["type"] }); + }//Debug.WriteLine("Added light number " + i + " " + state["on"]); } return "success"; } diff --git a/HueUWP/Converters/VisibilityConverter.cs b/HueUWP/Converters/VisibilityConverter.cs new file mode 100644 index 0000000..a64099c --- /dev/null +++ b/HueUWP/Converters/VisibilityConverter.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Windows.UI.Xaml; +using Windows.UI.Xaml.Data; + +namespace HueUWP.Converters +{ + class VisibilityConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, string language) + { + bool b = (bool)value; + + if (b) + return Visibility.Visible; + else + return Visibility.Collapsed; + } + + public object ConvertBack(object value, Type targetType, object parameter, string language) + { + Visibility v = (Visibility)value; + + if (v == Visibility.Visible) + return true; + else + return false; + } + } +} diff --git a/HueUWP/DetailView.xaml b/HueUWP/DetailView.xaml index 2d03ca4..95fcd3f 100644 --- a/HueUWP/DetailView.xaml +++ b/HueUWP/DetailView.xaml @@ -11,6 +11,7 @@ + @@ -40,12 +41,12 @@ - + Hue - + Saturation diff --git a/HueUWP/HueUWP.csproj b/HueUWP/HueUWP.csproj index a556db7..aae2ed5 100644 --- a/HueUWP/HueUWP.csproj +++ b/HueUWP/HueUWP.csproj @@ -102,6 +102,7 @@ + DetailView.xaml diff --git a/HueUWP/Light.cs b/HueUWP/Light.cs index 3911676..c26613c 100644 --- a/HueUWP/Light.cs +++ b/HueUWP/Light.cs @@ -17,8 +17,11 @@ namespace HueUWP public string Name { get; set; } public string Type { get; set; } - public bool HueEnabled; - public bool SaturationEnabled; + public bool HueEnabled + { + get; set; + } + public bool SaturationEnabled { get; set; } private bool _isOn;