This commit is contained in:
Yorick Rommers
2015-12-03 12:42:16 +01:00
5 changed files with 44 additions and 6 deletions
+2 -2
View File
@@ -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";
}
+33
View File
@@ -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;
}
}
}
+3 -2
View File
@@ -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>
+1
View File
@@ -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>
+5 -2
View File
@@ -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;