Improved Interface

This commit is contained in:
2015-12-04 17:51:52 +01:00
parent ad65c72747
commit f4ff363cb9
7 changed files with 49 additions and 16 deletions
+1 -1
View File
@@ -64,7 +64,7 @@ namespace HueUWP
l.UpdateColorDisco();
});
//"transitiontime": 0
await Task.Delay(TimeSpan.FromMilliseconds(100));
await Task.Delay(TimeSpan.FromMilliseconds(400));
}
}
+21
View File
@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HueUWP
{
public static class Extensions
{
public static string ToDelimitedString<T>(this IEnumerable<T> source, Func<T, string> func)
{
return ToDelimitedString(source, ", ", func);
}
public static string ToDelimitedString<T>(this IEnumerable<T> source, string delimiter, Func<T, string> func)
{
return String.Join(delimiter, source.Select(func).ToArray());
}
}
}
+1
View File
@@ -106,6 +106,7 @@
<Compile Include="DetailView.xaml.cs">
<DependentUpon>DetailView.xaml</DependentUpon>
</Compile>
<Compile Include="Extensions.cs" />
<Compile Include="Light.cs" />
<Compile Include="MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
+7 -5
View File
@@ -62,12 +62,14 @@
<Page.BottomAppBar>
<CommandBar>
<AppBarButton Icon="Edit" Label="Change values" Name="ValuesButton" Click="ValuesButton_Click" Visibility="Collapsed"/>
<AppBarButton Icon="Like" Label="On/Off" Name="OnOffButton" Click="OnOffButton_Click" Visibility="Collapsed"/>
<AppBarButton Icon="LikeDislike" Label="On/Off" Name="OnOffButton" Click="OnOffButton_Click" Visibility="Collapsed"/>
<AppBarToggleButton Icon="SelectAll" Label="Group" Name="GroupButton" Click="GroupButton_Click"/>
<AppBarSeparator Name="Seperator" />
<AppBarToggleButton Icon="Audio" Label="Disco" Name="DiscoButton" Click="DiscoButton_Click"/>
<AppBarToggleButton Icon="Save" Label="Group" Name="GroupButton" Click="GroupButton_Click"/>
<AppBarButton Icon="Setting" Label="Settings" Click="SettingsButton_Click"/>
<AppBarButton Icon="Refresh" Label="Refresh" Click="RefreshButton_Click"/>
<AppBarSeparator/>
<AppBarButton Icon="Setting" Label="Settings" Name="SettingsButton" Click="SettingsButton_Click"/>
<AppBarButton Icon="Refresh" Label="Refresh" Name="RefreshButton" Click="RefreshButton_Click"/>
<CommandBar.SecondaryCommands>
<AppBarButton Label="About" Click="AboutButton_Click"/>
+10
View File
@@ -138,6 +138,11 @@ namespace HueUWP
myListView.SelectionMode = ListViewSelectionMode.Multiple;
OnOffButton.Visibility = Visibility.Visible;
ValuesButton.Visibility = Visibility.Visible;
Seperator.Visibility = Visibility.Collapsed;
DiscoButton.Visibility = Visibility.Collapsed;
RefreshButton.Visibility = Visibility.Collapsed;
SettingsButton.Visibility = Visibility.Collapsed;
}
else
{
@@ -145,6 +150,11 @@ namespace HueUWP
myListView.SelectionMode = ListViewSelectionMode.Single;
OnOffButton.Visibility = Visibility.Collapsed;
ValuesButton.Visibility = Visibility.Collapsed;
Seperator.Visibility = Visibility.Visible;
DiscoButton.Visibility = Visibility.Visible;
RefreshButton.Visibility = Visibility.Visible;
SettingsButton.Visibility = Visibility.Visible;
}
}
+6 -6
View File
@@ -24,13 +24,13 @@
</Grid.RowDefinitions>
<RelativePanel Grid.Row="0">
<TextBlock RelativePanel.AlignLeftWithPanel="True" FontSize="24" Margin="20,10,0,0" Text="MultiEdit"/>
<TextBlock RelativePanel.AlignLeftWithPanel="True" FontSize="24" Margin="20,10,0,0" Text="Miltiple Lights"/>
</RelativePanel>
<RelativePanel Grid.Row="1">
<TextBlock RelativePanel.AlignLeftWithPanel="True" FontSize="14" Margin="20,10,0,0" Text="Multiple Lamps"/>
<TextBlock RelativePanel.AlignLeftWithPanel="True" FontSize="14" Name="LightsSelectedField" Margin="20,10,0,0" Text="" TextWrapping="WrapWholeWords"/>
</RelativePanel>
<RelativePanel Grid.Row="2">
<Rectangle Fill="{Binding color}" Name="ColorRectangle" RelativePanel.AlignLeftWithPanel="True" RelativePanel.AlignRightWithPanel="True" Height="20" Margin="0,10,0,10" />
<Rectangle Fill="Red" Name="ColorRectangle" RelativePanel.AlignLeftWithPanel="True" RelativePanel.AlignRightWithPanel="True" Height="20" Margin="0,10,0,10" />
</RelativePanel>
<StackPanel Grid.Row="3">
@@ -43,17 +43,17 @@
<StackPanel Grid.Row="4">
<StackPanel Margin="20,10,20,0" Visibility="Visible">
<TextBlock FontSize="18">Hue</TextBlock>
<Slider Maximum="65535" Name="HueSlider" Value="{Binding hue, Mode=TwoWay}" ValueChanged="Slider_ValueChanged" PointerCaptureLost="Slider_Released"/>
<Slider Maximum="65535" Name="HueSlider" Value="30000" ValueChanged="Slider_ValueChanged" PointerCaptureLost="Slider_Released"/>
</StackPanel>
<StackPanel Margin="20,10,20,0" Visibility="Visible">
<TextBlock FontSize="18">Saturation</TextBlock>
<Slider Maximum="254" Name="SaturationSlider" Value="{Binding sat, Mode=TwoWay}" ValueChanged="Slider_ValueChanged" PointerCaptureLost="Slider_Released" />
<Slider Maximum="254" Name="SaturationSlider" Value="254" ValueChanged="Slider_ValueChanged" PointerCaptureLost="Slider_Released" />
</StackPanel>
<StackPanel Margin="20,10,20,0">
<TextBlock FontSize="18">Brightness</TextBlock>
<Slider Maximum="254" Name="BrightnessSlider" Value="{Binding bri, Mode=TwoWay}" ValueChanged="Slider_ValueChanged" PointerCaptureLost="Slider_Released"/>
<Slider Maximum="254" Name="BrightnessSlider" Value="254" ValueChanged="Slider_ValueChanged" PointerCaptureLost="Slider_Released"/>
</StackPanel>
</StackPanel>
+3 -4
View File
@@ -26,9 +26,6 @@ namespace HueUWP
{
IList<Light> lights = new List<Light>();
MainPage main;
int hue = 65535;
int sat = 254;
int bri = 254;
public MultiEdit()
{
@@ -38,12 +35,14 @@ namespace HueUWP
protected override void OnNavigatedTo(NavigationEventArgs e)
{
main = e.Parameter as MainPage;
foreach(var v in main.GetListView().SelectedItems)
{
Light l = (Light)v;
lights.Add(l);
}
this.DataContext = this;
LightsSelectedField.Text = lights.ToDelimitedString(l => l.Name);
}