diff --git a/HueUWP/APIHandler.cs b/HueUWP/APIHandler.cs
index e2e6413..3a9ebb0 100755
--- a/HueUWP/APIHandler.cs
+++ b/HueUWP/APIHandler.cs
@@ -73,25 +73,20 @@ namespace HueUWP
try {
var json = await nwh.AllLights();
JObject o = JObject.Parse(json);
+ Debug.WriteLine(o.ToString());
foreach(var i in o)
{
var light = o["" + i.Key];
var state = light["state"];
- alllights.Add(new Light() { api = this,ID = Int32.Parse( i.Key), Brightness = (int)state["bri"], IsOn = ((string)state["on"]).ToLower() == "true" ? true : false, Hue = (int)state["hue"], Saturation = (int)state["sat"], Name = (string)light["name"], Type = (string)light["type"] });
- //Debug.WriteLine("Added light number " + i + " " + state["on"]);
+ if ((String)light["type"] != "Dimmable light")
+ {
+ alllights.Add(new Light() { api = this, ID = Int32.Parse(i.Key), Brightness = (int)state["bri"], SaturationEnabled = true, HueEnabled = true, IsOn = ((string)state["on"]).ToLower() == "true" ? true : false, Hue = (int)state["hue"], Saturation = (int)state["sat"], Name = (string)light["name"], Type = (string)light["type"] });
+ }
+ 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 =0, Saturation = 0, Name = (string)light["name"], Type = (string)light["type"] });
+ }//Debug.WriteLine("Added light number " + i + " " + state["on"]);
}
-
- //lightlist = lightlist.OrderBy(q => q.Name).ToList();
-
- //lightlist.Sort(
- // delegate (Light p1, Light p2)
- // {
- // return p1.Name.CompareTo(p2.Name);
- // }
- // );
-
- //lightlist.ForEach(q => alllights.Add(q));
-
return "success";
}
catch(Exception e)
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 8f3f4bc..72cfa1e 100644
--- a/HueUWP/Light.cs
+++ b/HueUWP/Light.cs
@@ -17,6 +17,12 @@ namespace HueUWP
public string Name { get; set; }
public string Type { get; set; }
+ public bool HueEnabled
+ {
+ get; set;
+ }
+ public bool SaturationEnabled { get; set; }
+
private bool _isOn;
public bool IsOn