Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
+9
-14
@@ -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)
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
<Page.Resources>
|
||||
<convert:NullableBooleanConverter x:Key="BoolConverter"/>
|
||||
<convert:VisibilityConverter x:Key="VisibilityConverter"/>
|
||||
</Page.Resources>
|
||||
|
||||
<Grid>
|
||||
@@ -40,12 +41,12 @@
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Row="4">
|
||||
<StackPanel Margin="20,10,20,0">
|
||||
<StackPanel Margin="20,10,20,0" Visibility="{Binding HueEnabled, Converter={StaticResource VisibilityConverter}}">
|
||||
<TextBlock FontSize="18">Hue</TextBlock>
|
||||
<Slider Maximum="65535" Value="{Binding Hue, Mode=TwoWay}" ValueChanged="Slider_ValueChanged" PointerCaptureLost="Slider_Released"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Margin="20,10,20,0">
|
||||
<StackPanel Margin="20,10,20,0" Visibility="{Binding SaturationEnabled, Converter={StaticResource VisibilityConverter}}">
|
||||
<TextBlock FontSize="18">Saturation</TextBlock>
|
||||
<Slider Maximum="254" Value="{Binding Saturation, Mode=TwoWay}" ValueChanged="Slider_ValueChanged" PointerCaptureLost="Slider_Released" />
|
||||
</StackPanel>
|
||||
|
||||
@@ -102,6 +102,7 @@
|
||||
</Compile>
|
||||
<Compile Include="ColorUtil.cs" />
|
||||
<Compile Include="Converters\NullableBooleanConverter.cs" />
|
||||
<Compile Include="Converters\VisibilityConverter.cs" />
|
||||
<Compile Include="DetailView.xaml.cs">
|
||||
<DependentUpon>DetailView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user