fixed bug in addalllights
This commit is contained in:
@@ -58,11 +58,11 @@ namespace HueUWP
|
||||
var json = await nwh.AllLights();
|
||||
JObject o = JObject.Parse(json);
|
||||
|
||||
for (int i = 1; i <= o.Count; i++)
|
||||
foreach(var i in o)
|
||||
{
|
||||
var light = o["" + i];
|
||||
var light = o["" + i.Key];
|
||||
var state = light["state"];
|
||||
alllights.Add(new Light() { api = this,ID = i, 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"] });
|
||||
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"]);
|
||||
} }
|
||||
catch(Exception e)
|
||||
|
||||
@@ -42,8 +42,8 @@ namespace HueUWP
|
||||
public MainPage()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
LOCAL_SETTINGS.Values["ip"] = "localhost";
|
||||
LOCAL_SETTINGS.Values["port"] = 8000;
|
||||
LOCAL_SETTINGS.Values["ip"] = "145.48.205.190";
|
||||
LOCAL_SETTINGS.Values["port"] = 80;
|
||||
NetworkHandler nwh = new NetworkHandler();
|
||||
api = new APIHandler(nwh);
|
||||
_lightsViewModel.Clear();
|
||||
|
||||
Reference in New Issue
Block a user