Fixed disco mode

This commit is contained in:
2015-12-03 12:48:08 +01:00
parent 0b8688ed7b
commit 482ebc828b
3 changed files with 14 additions and 5 deletions
+8 -2
View File
@@ -13,7 +13,7 @@ namespace HueUWP
{
public class APIHandler
{
bool discomode = false;
NetworkHandler nwh;
public APIHandler(NetworkHandler nwh)
@@ -52,8 +52,9 @@ namespace HueUWP
public async void DiscoMode(ObservableCollection<Light> lights)
{
discomode = true;
Random rnd = new Random();
for(int i = 0; i < 100; i++)
while(discomode)
{
lights.ToList().ForEach(l =>
{
@@ -67,6 +68,11 @@ namespace HueUWP
}
public async void DiscoMode(bool on)
{
discomode = on;
}
public async Task<String> SetLightValues(Light l)
{
if(l.IsOn)
+1 -1
View File
@@ -61,7 +61,7 @@
<Page.BottomAppBar>
<CommandBar>
<AppBarButton Icon="Audio" Label="Disco" Click="AppBarButton_Click"/>
<AppBarToggleButton Icon="Audio" Label="Disco" Name="DiscoButton" Click="DiscoButton_Click"/>
<AppBarButton Icon="Setting" Label="Settings" Click="SettingsButton_Click"/>
<AppBarButton Icon="Refresh" Label="Refresh" Click="RefreshButton_Click"/>
<AppBarSeparator/>
+5 -2
View File
@@ -119,9 +119,12 @@ namespace HueUWP
rootframe.Navigate(typeof(AboutView));
}
private void AppBarButton_Click(object sender, RoutedEventArgs e)
private void DiscoButton_Click(object sender, RoutedEventArgs e)
{
api.DiscoMode(_lightsViewModel);
if ((bool)DiscoButton.IsChecked)
api.DiscoMode(_lightsViewModel);
else
api.DiscoMode(false);
}
}
}