Added settings for auto refresh

This commit is contained in:
2015-12-11 13:46:58 +01:00
parent 542e6879bc
commit c7f3e946ee
2 changed files with 51 additions and 27 deletions
+9 -3
View File
@@ -20,19 +20,25 @@ namespace HueUWP
public string IP
{
get { Debug.WriteLine(App.LOCAL_SETTINGS.Values["ip"]); return App.LOCAL_SETTINGS.Values["ip"] as string; }
get { return App.LOCAL_SETTINGS.Values["ip"] as string; }
set { App.LOCAL_SETTINGS.Values["ip"] = value; NotifyPropertyChanged(nameof(IP)); }
}
public string PORT
{
get { Debug.WriteLine(App.LOCAL_SETTINGS.Values["port"]); return Convert.ToInt32(App.LOCAL_SETTINGS.Values["port"]).ToString(); }
get { return Convert.ToInt32(App.LOCAL_SETTINGS.Values["port"]).ToString(); }
set { App.LOCAL_SETTINGS.Values["port"] = int.Parse(value); NotifyPropertyChanged(nameof(PORT)); }
}
public bool AUTOREFRESH
{
get { return (bool)(App.LOCAL_SETTINGS.Values["autorefresh"]); }
set { App.LOCAL_SETTINGS.Values["autorefresh"] = value; NotifyPropertyChanged(nameof(AUTOREFRESH)); }
}
public string ID
{
get { Debug.WriteLine(App.LOCAL_SETTINGS.Values["id"]); return App.LOCAL_SETTINGS.Values["id"] as string; }
get { return App.LOCAL_SETTINGS.Values["id"] as string; }
}
public void Update()
+42 -24
View File
@@ -3,11 +3,16 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:HueUWP.Views"
xmlns:convert="using:HueUWP.Helpers"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<!--DataContext="{Binding SettingsViewModel, RelativeSource={RelativeSource Self}}"-->
<Page.Resources>
<convert:NullableBooleanConverter x:Key="BoolConverter"/>
</Page.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
@@ -18,30 +23,43 @@
<TextBlock RelativePanel.AlignLeftWithPanel="True" FontSize="24" Margin="20,10,0,0">Settings</TextBlock>
</RelativePanel>
<StackPanel Grid.Row="1">
<StackPanel Margin="20, 10, 20, 0">
<TextBlock FontSize="16">Server IP</TextBlock>
<TextBox Margin="0,10,0,10" Text="{x:Bind SettingsViewModel.IP, Mode=TwoWay}" PlaceholderText="145.48.205.190"/>
</StackPanel>
<StackPanel Margin="20, 10, 20, 0">
<TextBlock FontSize="16">Server Port</TextBlock>
<TextBox Margin="0,10,0,10" Text="{x:Bind SettingsViewModel.PORT, Mode=TwoWay}" PlaceholderText="80" />
</StackPanel>
<StackPanel Margin="20, 10, 20, 0">
<TextBlock FontSize="16">User ID</TextBlock>
<TextBox Name="IDBox" Margin="0,10,0,10" Text="{x:Bind SettingsViewModel.ID, Mode=OneWay}" IsEnabled="False"/>
<StackPanel Orientation="Horizontal" Margin="0,10,0,10">
<Button Click="UpdateID_Click">
<StackPanel Orientation="Horizontal">
<TextBlock FontFamily="Segoe MDL2 Assets" FontSize="15" Margin="5, 9, 5, 5" Text="&#xE72C;" />
<TextBlock FontSize="15" Margin="5" Text="Request new" />
</StackPanel>
</Button>
<ProgressRing Height="35" Width="35" Margin="20, 0, 0, 0" IsActive="False" Name="UserIdProgress" />
<RelativePanel Grid.Row="1">
<ScrollViewer RelativePanel.AlignBottomWithPanel="True" RelativePanel.AlignTopWithPanel="True">
<StackPanel>
<StackPanel Margin="20, 10, 20, 0">
<TextBlock FontSize="16">Automatic Refreshing</TextBlock>
<ToggleSwitch Margin="0,10,0,10" IsOn="{x:Bind SettingsViewModel.AUTOREFRESH, Mode=TwoWay, Converter={StaticResource BoolConverter}}">
<ToggleSwitch.OffContent>Off</ToggleSwitch.OffContent>
<ToggleSwitch.OnContent>On</ToggleSwitch.OnContent>
</ToggleSwitch>
</StackPanel>
</StackPanel>
</StackPanel>
<StackPanel Margin="20, 10, 20, 0">
<TextBlock FontSize="16">Server IP</TextBlock>
<TextBox Margin="0,10,0,10" Text="{x:Bind SettingsViewModel.IP, Mode=TwoWay}" PlaceholderText="145.48.205.190"/>
</StackPanel>
<StackPanel Margin="20, 10, 20, 0">
<TextBlock FontSize="16">Server Port</TextBlock>
<TextBox Margin="0,10,0,10" Text="{x:Bind SettingsViewModel.PORT, Mode=TwoWay}" PlaceholderText="80" />
</StackPanel>
<StackPanel Margin="20, 10, 20, 0">
<TextBlock FontSize="16">User ID</TextBlock>
<TextBox Name="IDBox" Margin="0,10,0,10" Text="{x:Bind SettingsViewModel.ID, Mode=OneWay}" IsEnabled="False"/>
<StackPanel Orientation="Horizontal" Margin="0,10,0,10">
<Button Click="UpdateID_Click">
<StackPanel Orientation="Horizontal">
<TextBlock FontFamily="Segoe MDL2 Assets" FontSize="15" Margin="5, 9, 5, 5" Text="&#xE72C;" />
<TextBlock FontSize="15" Margin="5" Text="Request new" />
</StackPanel>
</Button>
<ProgressRing Height="35" Width="35" Margin="20, 0, 0, 0" IsActive="False" Name="UserIdProgress" />
</StackPanel>
</StackPanel>
</StackPanel>
</ScrollViewer>
</RelativePanel>
</Grid>
</Page>