Archived
1
0

Complete Settings page

This commit is contained in:
Michael Gordeev
2018-04-20 21:08:59 +03:00
parent 8750df528f
commit 488cce915e
6 changed files with 103 additions and 31 deletions
+1 -1
View File
@@ -19,7 +19,7 @@
<HyperlinkButton Content="Community" Foreground="White" Margin="10,8,10,10"/> <HyperlinkButton Content="Community" Foreground="White" Margin="10,8,10,10"/>
<HyperlinkButton Content="Channels" Foreground="White" Margin="10,8,10,10"/> <HyperlinkButton Content="Channels" Foreground="White" Margin="10,8,10,10"/>
<HyperlinkButton Content="About channel" Foreground="White" FontStyle="Normal" Margin="10,8,10,10"/> <HyperlinkButton Content="About channel" Foreground="White" FontStyle="Normal" Margin="10,8,10,10"/>
<TextBox Name="searchField" ToolTipService.ToolTip="Search on channel" Margin="4" Width="350" Height="47" Padding="10,10,10,0" PlaceholderText="Search on channel" BorderThickness="0" Background="#7FFFFFFF" AcceptsReturn="True"/> <TextBox Name="searchField" ToolTipService.ToolTip="Search on channel" Margin="4" Width="350" Height="47" Padding="10,10,5,0" PlaceholderText="Search on channel" BorderThickness="0" Background="#7FFFFFFF"/>
<Button Name="searchButton" HorizontalAlignment="Right" <Button Name="searchButton" HorizontalAlignment="Right"
Width="39" Height="39" Margin="0" Padding="1" Width="39" Height="39" Margin="0" Padding="1"
RelativePanel.AlignRightWithPanel="True" RelativePanel.AlignRightWithPanel="True"
+2 -4
View File
@@ -19,17 +19,15 @@
<RadioButton Name="promblemRadio" Content="Problem"/> <RadioButton Name="promblemRadio" Content="Problem"/>
</StackPanel> </StackPanel>
<TextBlock Text="Tell us about it" FontSize="18" Margin="0,10,0,0"/> <TextBlock Text="Tell us about it" FontSize="18" Margin="0,10,0,0"/>
<TextBlock Text="Summarize your issue" Margin="0,10,0,0"/>
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
<ColumnDefinition Width="30"/> <ColumnDefinition Width="30"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<TextBox Name="subject" Grid.Column="0" HorizontalAlignment="Stretch" GotFocus="subject_GotFocus"/> <TextBox Name="subject" Grid.Column="0" HorizontalAlignment="Stretch" GotFocus="subject_GotFocus" Header="Summarize your issue (max 400 characters)" MaxLength="400"/>
<TextBlock Name="subjectMissed" Grid.Column="1" FontFamily="Segoe MDL2 Assets" Text="&#xE814;" Foreground="Red" FontSize="30" Visibility="Collapsed"/> <TextBlock Name="subjectMissed" Grid.Column="1" FontFamily="Segoe MDL2 Assets" Text="&#xE814;" Foreground="Red" FontSize="30" Visibility="Collapsed"/>
</Grid> </Grid>
<TextBlock Text="Give us more detail (optional)" Margin="0,10,0,0"/> <TextBox Name="details" HorizontalAlignment="Stretch" Height="200" AcceptsReturn="True" ScrollViewer.VerticalScrollBarVisibility="Auto" MaxLength="1000" Margin="0,5,30,0" Header="Give us more detail (optional) (max 1000 characters)"/>
<TextBox Name="details" HorizontalAlignment="Stretch" Height="200" AcceptsReturn="True" Margin="0,0,30,0"/>
<StackPanel Orientation="Horizontal" BorderBrush="Green" BorderThickness="5" Margin="0,10,30,0" Visibility="Collapsed" Name="greenResult"> <StackPanel Orientation="Horizontal" BorderBrush="Green" BorderThickness="5" Margin="0,10,30,0" Visibility="Collapsed" Name="greenResult">
<TextBlock FontFamily="Segoe MDL2 Assets" Text="&#xE76E;" FontSize="40" Foreground="Green" Margin="5"/> <TextBlock FontFamily="Segoe MDL2 Assets" Text="&#xE76E;" FontSize="40" Foreground="Green" Margin="5"/>
<StackPanel> <StackPanel>
+15 -13
View File
@@ -10,9 +10,8 @@
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<StackPanel Orientation="Vertical" Margin="10"> <StackPanel Orientation="Vertical" Margin="10">
<TextBlock Text="General settings" FontSize="28"/> <TextBlock Text="General settings" FontSize="28"/>
<TextBlock Text="Default video playback quality"/> <ComboBox Margin="0,0,0,10" Width="250" Header="Default video playback quality" Name="quality" SelectionChanged="quality_SelectionChanged">
<ComboBox Margin="0,0,0,10"> <ComboBoxItem Content="Auto"/>
<ComboBoxItem Content="Auto" IsSelected="True"/>
<ComboBoxItem Content="1080p60"/> <ComboBoxItem Content="1080p60"/>
<ComboBoxItem Content="1080p30"/> <ComboBoxItem Content="1080p30"/>
<ComboBoxItem Content="720p60"/> <ComboBoxItem Content="720p60"/>
@@ -23,18 +22,21 @@
<ComboBoxItem Content="144p"/> <ComboBoxItem Content="144p"/>
</ComboBox> </ComboBox>
<TextBlock Text="Notifications"/> <TextBlock Text="Notifications"/>
<CheckBox Content="New video" IsChecked="True"/> <CheckBox Content="New video" Name="newVideo" Click="notification_IsEnabledChanged"/>
<CheckBox Content="New post" IsChecked="True"/> <CheckBox Content="New post" Name="newPost" Click="notification_IsEnabledChanged"/>
<CheckBox Content="New commentary" IsChecked="True"/> <CheckBox Content="New commentary" Name="newComment" Click="notification_IsEnabledChanged"/>
<CheckBox Content="What's new posts" IsChecked="True"/> <CheckBox Content="What's new posts" Visibility="Collapsed" Click="notification_IsEnabledChanged"/>
<CheckBox Content="Developer's messages" IsChecked="True" Margin="0,0,0,10"/> <CheckBox Content="Developer's messages" Name="messages" Margin="0,0,0,10" Click="notification_IsEnabledChanged"/>
<ToggleSwitch OnContent="Notify when playing on mobile data" OffContent="Notify when playing on mobile data"/> <ToggleSwitch OnContent="Notify when playing on mobile data" OffContent="Notify when playing on mobile data" Name="mobileWarning" Toggled="notification_IsEnabledChanged"/>
<ToggleSwitch OnContent="Play videos automatically" OffContent="Play videos automatically" IsOn="True" Margin="0,0,0,10"/> <ToggleSwitch OnContent="Play videos automatically" OffContent="Play videos automatically" Name="autoplay" Margin="0,0,0,10" Toggled="notification_IsEnabledChanged"/>
<TextBlock Text="Lanuguage"/> <ComboBox Header="Language" MinWidth="250" Name="language" SelectionChanged="language_SelectionChanged">
<ComboBox> <ComboBoxItem Content="English"/>
<ComboBoxItem Content="English" IsSelected="True"/>
<ComboBoxItem Content="Russian"/> <ComboBoxItem Content="Russian"/>
</ComboBox> </ComboBox>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" BorderBrush="OrangeRed" BorderThickness="3" Margin="0,10,0,0" Padding="2" Visibility="Collapsed" Name="restartNote">
<TextBlock FontFamily="Segoe MDL2 Assets" FontWeight="Bold" Text="&#xE7BA;" FontSize="30" Foreground="OrangeRed"/>
<TextBlock FontFamily="Default" FontWeight="Bold" Text="Reopen the app to apply settings" Foreground="OrangeRed" VerticalAlignment="Center"/>
</StackPanel>
</StackPanel> </StackPanel>
</Grid> </Grid>
</Page> </Page>
+48
View File
@@ -5,6 +5,7 @@ using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime; using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation; using Windows.Foundation;
using Windows.Foundation.Collections; using Windows.Foundation.Collections;
using Windows.Storage;
using Windows.UI.Xaml; using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives; using Windows.UI.Xaml.Controls.Primitives;
@@ -22,9 +23,56 @@ namespace FoxTube
/// </summary> /// </summary>
public sealed partial class General : Page public sealed partial class General : Page
{ {
ApplicationDataContainer settings = ApplicationData.Current.LocalSettings;
public General() public General()
{ {
this.InitializeComponent(); this.InitializeComponent();
language.SelectedIndex = (int)settings.Values["language"];
quality.SelectedIndex = (int)settings.Values["quality"];
newVideo.IsChecked = (bool)settings.Values["newVideoNotification"];
newComment.IsChecked = (bool)settings.Values["newCommentNotification"];
newPost.IsChecked = (bool)settings.Values["newPostNotification"];
messages.IsChecked = (bool)settings.Values["newmessagesNotification"];
mobileWarning.IsOn = (bool)settings.Values["moblieWarning"];
autoplay.IsOn = (bool)settings.Values["videoAutoplay"];
}
private void language_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if((int)settings.Values["language"] != language.SelectedIndex)
{
settings.Values["language"] = language.SelectedIndex;
restartNote.Visibility = Visibility.Visible;
}
}
private void quality_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if ((int)settings.Values["quality"] != quality.SelectedIndex)
settings.Values["quality"] = quality.SelectedIndex;
}
private void notification_IsEnabledChanged(object sender, RoutedEventArgs e)
{
if ((bool)settings.Values["newVideoNotification"] != newVideo.IsChecked)
settings.Values["newVideoNotification"] = newVideo.IsChecked;
if ((bool)settings.Values["newPostNotification"] != newPost.IsChecked)
settings.Values["newPostNotification"] = newPost.IsChecked;
if ((bool)settings.Values["newCommentNotification"] != newComment.IsChecked)
settings.Values["newCommentNotification"] = newComment.IsChecked;
if ((bool)settings.Values["newmessagesNotification"] != messages.IsChecked)
settings.Values["newmessagesNotification"] = messages.IsChecked;
if ((bool)settings.Values["moblieWarning"] != mobileWarning.IsOn)
settings.Values["moblieWarning"] = mobileWarning.IsOn;
if ((bool)settings.Values["videoAutoplay"] != autoplay.IsOn)
settings.Values["videoAutoplay"] = autoplay.IsOn;
} }
} }
} }
+11 -8
View File
@@ -72,7 +72,10 @@
</MenuFlyout> </MenuFlyout>
</Button.Flyout> </Button.Flyout>
</Button> </Button>
<Popup Grid.Column="8" Margin="0,50,0,0" IsOpen="False" IsLightDismissEnabled="True"> <Button Grid.Column="8" Padding="0" Width="50" Height="50" Visibility="Collapsed" Name="LoggedAvatar" Click="LoggedAvatar_Click">
<PersonPicture Width="30"/>
</Button>
<Popup Grid.Column="8" Margin="0,50,0,0" IsOpen="False" IsLightDismissEnabled="True" Name="AccountManagement">
<StackPanel Width="300" Background="WhiteSmoke"> <StackPanel Width="300" Background="WhiteSmoke">
<ListBox> <ListBox>
<ListBoxItem Height="75"> <ListBoxItem Height="75">
@@ -102,7 +105,7 @@
</ListBox> </ListBox>
</StackPanel> </StackPanel>
</Popup> </Popup>
<TextBox Name="searchField" Grid.Column="9" ToolTipService.ToolTip="Search" Margin="4" Width="350" Height="50" Padding="14,11,55,14" PlaceholderText="Search" BorderThickness="0" Background="#7FFFFFFF" Text="" AcceptsReturn="True"/> <TextBox Name="searchField" Grid.Column="9" ToolTipService.ToolTip="Search" Margin="4" Width="350" Height="50" Padding="14,10,5,0" PlaceholderText="Search" BorderThickness="0" Background="#7FFFFFFF" Text=""/>
<Button Name="searchButton" Grid.Column="9" HorizontalAlignment="Right" <Button Name="searchButton" Grid.Column="9" HorizontalAlignment="Right"
Width="42" Height="42" Margin="4" Width="42" Height="42" Margin="4"
RelativePanel.AlignRightWithPanel="True" RelativePanel.AlignRightWithPanel="True"
@@ -174,19 +177,19 @@
<TextBlock Style="{StaticResource MenuItem}" Text="Gaming"/> <TextBlock Style="{StaticResource MenuItem}" Text="Gaming"/>
</StackPanel> </StackPanel>
</ListBoxItem> </ListBoxItem>
<ListBoxItem Name="historyMenu"> <ListBoxItem Name="historyMenu" Visibility="Collapsed">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource ItemIcon}" Text="&#xE81C;"/> <TextBlock Style="{StaticResource ItemIcon}" Text="&#xE81C;"/>
<TextBlock Style="{StaticResource MenuItem}" Text="History"/> <TextBlock Style="{StaticResource MenuItem}" Text="History"/>
</StackPanel> </StackPanel>
</ListBoxItem> </ListBoxItem>
<ListBoxItem Name="likedMenu"> <ListBoxItem Name="likedMenu" Visibility="Collapsed">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource ItemIcon}" Text="&#xE19F;"/> <TextBlock Style="{StaticResource ItemIcon}" Text="&#xE19F;"/>
<TextBlock Style="{StaticResource MenuItem}" Text="Liked videos"/> <TextBlock Style="{StaticResource MenuItem}" Text="Liked videos"/>
</StackPanel> </StackPanel>
</ListBoxItem> </ListBoxItem>
<ListBoxItem Name="watchLaterMenu"> <ListBoxItem Name="watchLaterMenu" Visibility="Collapsed">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource ItemIcon}" Text="&#xE121;"/> <TextBlock Style="{StaticResource ItemIcon}" Text="&#xE121;"/>
<TextBlock Style="{StaticResource MenuItem}" Text="Watch later"/> <TextBlock Style="{StaticResource MenuItem}" Text="Watch later"/>
@@ -198,9 +201,9 @@
<Line Name="subsMenuStroke" X1="0" Y1="10" X2="165" Y2="10" Stroke="Gray" StrokeThickness="2"/> <Line Name="subsMenuStroke" X1="0" Y1="10" X2="165" Y2="10" Stroke="Gray" StrokeThickness="2"/>
</StackPanel> </StackPanel>
</ListBoxItem> </ListBoxItem>
<ListBoxItem Height="60" IsEnabled="False" Name="subsLogErr" Visibility="Visible"> <ListBoxItem Height="100" IsEnabled="False" Name="subsLogErr" Visibility="Visible" VerticalContentAlignment="Top">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<TextBlock FontFamily="Default, Segoe MDL2 Assets" Text="Press &#xE1E2; and add an account to see your featured channels here" Width="225" Height="35" HorizontalTextAlignment="Center" Foreground="Gray" TextWrapping="WrapWholeWords"/> <TextBlock FontFamily="Default, Segoe MDL2 Assets" Text="Press &#xE1E2; and add an account to see your featured channels and more content here" Width="225" HorizontalTextAlignment="Center" Foreground="Gray" TextWrapping="WrapWholeWords"/>
</StackPanel> </StackPanel>
</ListBoxItem> </ListBoxItem>
</ListBox> </ListBox>
@@ -213,7 +216,7 @@
</ListBoxItem> </ListBoxItem>
</ListBox> </ListBox>
<ListBox RelativePanel.AlignBottomWithPanel="True" SelectionChanged="bottomHaburgerSelectionChanged" Name="bottomHaburger"> <ListBox RelativePanel.AlignBottomWithPanel="True" SelectionChanged="bottomHaburgerSelectionChanged" Name="bottomHaburger">
<ListBoxItem Name="channelMenu"> <ListBoxItem Name="channelMenu" Visibility="Visible">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource ItemIcon}" Text="&#xE13D;"/> <TextBlock Style="{StaticResource ItemIcon}" Text="&#xE13D;"/>
<TextBlock Style="{StaticResource MenuItem}" Text="My channel"/> <TextBlock Style="{StaticResource MenuItem}" Text="My channel"/>
+25 -4
View File
@@ -18,6 +18,7 @@ using System.Diagnostics;
using Microsoft.Toolkit.Uwp.Notifications; using Microsoft.Toolkit.Uwp.Notifications;
using Windows.UI.Notifications; using Windows.UI.Notifications;
using Windows.UI.Xaml.Media.Imaging; using Windows.UI.Xaml.Media.Imaging;
using Windows.Storage;
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409 // The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409
@@ -28,10 +29,24 @@ namespace FoxTube
/// </summary> /// </summary>
public sealed partial class MainPage : Page public sealed partial class MainPage : Page
{ {
ApplicationDataContainer settings = ApplicationData.Current.LocalSettings;
List<Notification> notifications = new List<Notification>(); List<Notification> notifications = new List<Notification>();
public MainPage() public MainPage()
{ {
this.InitializeComponent(); this.InitializeComponent();
if(settings.Values["language"] == null)
{
settings.Values.Add("language", 0);
settings.Values.Add("quality", 0);
settings.Values.Add("newVideoNotification", true);
settings.Values.Add("newCommentNotification", true);
settings.Values.Add("newPostNotification", true);
settings.Values.Add("newmessagesNotification", true);
settings.Values.Add("moblieWarning", false);
settings.Values.Add("videoAutoplay", true);
}
content.Navigate(typeof(Home)); content.Navigate(typeof(Home));
} }
@@ -204,11 +219,12 @@ namespace FoxTube
} }
else if (bottomHaburger.SelectedIndex == 2) else if (bottomHaburger.SelectedIndex == 2)
{ {
switch(content.SourcePageType) if(content.SourcePageType == typeof(Settings))
{ bottomHaburger.SelectedIndex = 3;
else if (content.SourcePageType == typeof(Home))
}
topHamburger.SelectedIndex = 0; topHamburger.SelectedIndex = 0;
else if (content.SourcePageType == typeof(Channel))
bottomHaburger.SelectedIndex = 1;
} }
} }
@@ -263,5 +279,10 @@ namespace FoxTube
subsLogErr.Visibility = Visibility.Visible; subsLogErr.Visibility = Visibility.Visible;
} catch { } } catch { }
} }
private void LoggedAvatar_Click(object sender, RoutedEventArgs e)
{
AccountManagement.IsOpen = true;
}
} }
} }