Archived
1
0

Redesign 1

This commit is contained in:
Michael Gordeev
2018-08-08 13:55:37 +03:00
parent 039a504d56
commit 6969af84a8
17 changed files with 446 additions and 880 deletions
+42 -62
View File
@@ -11,18 +11,12 @@
<Grid Name="grid" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid.RowDefinitions>
<RowDefinition Height="50"/>
<RowDefinition Height="*"/>
<RowDefinition/>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<Pivot Grid.Row="1" Margin="0,-48,0,0" SelectedIndex="0" Name="content" IsHeaderItemsCarouselEnabled="False" SelectionChanged="content_SelectionChanged">
<Pivot.ItemContainerStyle>
<Style TargetType="PivotItem">
<Setter Property="Margin" Value="0"/>
</Style>
</Pivot.ItemContainerStyle>
<PivotItem>
<Pivot SelectedIndex="0" Name="content" IsHeaderItemsCarouselEnabled="False" SelectionChanged="content_SelectionChanged">
<PivotItem Header="Videos">
<ScrollViewer>
<StackPanel Name="videos">
<Image Name="channelCover" Stretch="Uniform" Source="/Assets/ChannelCoverTemplate.png"/>
@@ -51,7 +45,7 @@
</StackPanel>
</ScrollViewer>
</PivotItem>
<PivotItem>
<PivotItem Header="Playlists">
<ScrollViewer>
<Grid Name="playlists">
<StackPanel Margin="10" Visibility="Visible">
@@ -63,70 +57,56 @@
</Grid>
</ScrollViewer>
</PivotItem>
<PivotItem>
<StackPanel Margin="10">
<TextBlock FontSize="28" Text="About this channel"/>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<StackPanel>
<TextBlock FontSize="24" Text="Description"/>
<TextBlock Name="description" Margin="0,10,0,0" TextWrapping="WrapWholeWords" IsTextSelectionEnabled="True"/>
</StackPanel>
<Grid Grid.Column="1">
<PivotItem Header="About channel">
<ScrollViewer>
<StackPanel Margin="10">
<TextBlock FontSize="28" Text="About this channel"/>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="10"/>
<ColumnDefinition/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<TextBlock FontSize="24" Text="Statistics"/>
<TextBlock Text="Registration date:" Grid.Row="1"/>
<TextBlock Grid.Row="1" Grid.Column="2" Name="registration" Text="13-May-18" HorizontalAlignment="Right"/>
<StackPanel>
<TextBlock FontSize="24" Text="Description"/>
<TextBlock Name="description" Margin="0,10,0,0" TextWrapping="WrapWholeWords" IsTextSelectionEnabled="True"/>
</StackPanel>
<TextBlock Grid.Row="2" Text="Views"/>
<TextBlock Grid.Row="2" Grid.Column="2" Name="views" Text="1885510485" HorizontalAlignment="Right"/>
<Grid Grid.Column="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="10"/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<TextBlock FontSize="24" Text="Statistics"/>
<TextBlock Text="Registration date:" Grid.Row="1"/>
<TextBlock Grid.Row="1" Grid.Column="2" Name="registration" Text="13-May-18" HorizontalAlignment="Right"/>
<TextBlock Grid.Row="2" Text="Views"/>
<TextBlock Grid.Row="2" Grid.Column="2" Name="views" Text="1885510485" HorizontalAlignment="Right"/>
</Grid>
</Grid>
</Grid>
</StackPanel>
</StackPanel>
</ScrollViewer>
</PivotItem>
</Pivot>
<Grid Background="Red" Name="navigationPane">
<StackPanel Orientation="Horizontal" Margin="10,0,10,0">
<HyperlinkButton Name="toVideos" Click="toVideos_Click" Foreground="White" Margin="0,0,10,0">
<TextBlock Text="Videos"/>
</HyperlinkButton>
<HyperlinkButton Foreground="White" Margin="0,0,10,0" Name="toPlaylists" Click="toPlaylists_Click">
<TextBlock Text="Playlists"/>
</HyperlinkButton>
<HyperlinkButton Foreground="White" Margin="0,0,10,0" Name="toAbout" Click="toAbout_Click">
<TextBlock Text="About channel"/>
</HyperlinkButton>
<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" Click="searchButton_Click"
Width="39" Height="39" Margin="0" Padding="1"
RelativePanel.AlignRightWithPanel="True"
Background="Transparent"
FontFamily="Segoe MDL2 Assets" Content="&#xE11A;" FontSize="20" FocusVisualSecondaryBrush="#66FFFFFF" FocusVisualPrimaryBrush="White" Foreground="White"/>
</StackPanel>
</Grid>
<CommandBar Grid.Row="2" VerticalAlignment="Bottom" Name="commandBar">
<Pivot.RightHeader>
<AutoSuggestBox VerticalAlignment="Center" Width="250" Margin="8" PlaceholderText="Search on channel" QueryIcon="Find" Name="search" QuerySubmitted="AutoSuggestBox_QuerySubmitted"/>
</Pivot.RightHeader>
</Pivot>
<CommandBar Grid.Row="1" VerticalAlignment="Bottom" Name="commandBar">
<AppBarButton Icon="Globe" Label="Open in browser" Name="inBrowser" Click="inBrowser_Click"/>
<AppBarButton Icon="Refresh" Label="Refresh" Name="refresh" Click="refresh_Click"/>
<AppBarButton Icon="Share" Label="Share" Name="share" Click="share_Click"/>
</CommandBar>
<local:LoadingPage Grid.RowSpan="3" Visibility="Collapsed"/>
<local:LoadingPage Grid.RowSpan="2" Visibility="Collapsed"/>
</Grid>
</Page>
+19 -50
View File
@@ -53,7 +53,7 @@ namespace FoxTube.Pages
public ChannelPage()
{
this.InitializeComponent();
loading = grid.Children[3] as LoadingPage;
loading = grid.Children[2] as LoadingPage;
playlistLoading = playlists.Children[1] as LoadingPage;
videoList = videos.Children[2] as VideoGrid;
@@ -181,57 +181,10 @@ namespace FoxTube.Pages
}
}
private void searchButton_Click(object sender, RoutedEventArgs e)
{
if (content.Items.Count == 4)
(((content.Items[3] as PivotItem).Content as Frame).Content as Search).Initialize(new SearchParameters(item.Id, searchField.Text));
else
{
content.Items.Add(new PivotItem()
{
Content = new Frame()
});
((content.Items[3] as PivotItem).Content as Frame).Navigate(typeof(Search), new SearchParameters(item.Id, searchField.Text));
}
content.SelectedIndex = 3;
}
private void content_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
toVideos.FontWeight = FontWeights.Normal;
toPlaylists.FontWeight = FontWeights.Normal;
toAbout.FontWeight = FontWeights.Normal;
switch (content.SelectedIndex)
{
case 0:
toVideos.FontWeight = FontWeights.Bold;
break;
case 1:
toPlaylists.FontWeight = FontWeights.Bold;
if (!playlistLoaded)
LoadPlaylist();
break;
case 2:
toAbout.FontWeight = FontWeights.Bold;
break;
}
}
private void toVideos_Click(object sender, RoutedEventArgs e)
{
content.SelectedIndex = 0;
}
private void toPlaylists_Click(object sender, RoutedEventArgs e)
{
content.SelectedIndex = 1;
}
private void toAbout_Click(object sender, RoutedEventArgs e)
{
content.SelectedIndex = 2;
if (content.SelectedIndex == 1 && !playlistLoaded)
LoadPlaylist();
}
private async void showMorePlaylists_Click()
@@ -297,6 +250,22 @@ namespace FoxTube.Pages
SecretsVault.Authorize();
}
private void AutoSuggestBox_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
{
if (content.Items.Count == 4)
(((content.Items[3] as PivotItem).Content as Frame).Content as Search).Initialize(new SearchParameters(item.Id, search.Text));
else
{
content.Items.Add(new PivotItem()
{
Content = new Frame()
});
((content.Items[3] as PivotItem).Content as Frame).Navigate(typeof(Search), new SearchParameters(item.Id, search.Text));
}
content.SelectedIndex = 3;
}
private void refresh_Click(object sender, RoutedEventArgs e)
{
Initialize(channelId);
+5 -5
View File
@@ -13,7 +13,7 @@
<RowDefinition Height="auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid Background="Red">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition Height="30"/>
@@ -22,15 +22,15 @@
<Button HorizontalAlignment="Right" Name="send" Click="send_Click" VerticalAlignment="Top"
Height="32" Width="32"
Margin="0,5,5,0" Padding="0"
Background="Transparent" Foreground="White"
Background="Transparent"
FontFamily="Segoe MDL2 Assets"
Content="&#xE122;" FontSize="30" ToolTipService.ToolTip="Post comment"/>
<ProgressBar Name="sending" IsIndeterminate="True" Foreground="Red" Visibility="Collapsed" VerticalAlignment="Bottom" HorizontalAlignment="Stretch"/>
<TextBlock Name="counter" Grid.Row="1" Text="[Comments count] Comments" Margin="5,0,0,0" VerticalAlignment="Center" Foreground="White" FontWeight="SemiBold"/>
<TextBlock Name="counter" Grid.Row="1" Text="[Comments count] Comments" Margin="5,0,0,0" VerticalAlignment="Center" FontWeight="SemiBold"/>
<StackPanel Padding="0" Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,0,10,0">
<TextBlock Text="Sort by: " Foreground="White" VerticalAlignment="Center" Margin="0,0,5,0"/>
<Button Name="orderBtn" Background="Transparent" Content="Relevance" Foreground="DeepSkyBlue" Padding="0" VerticalAlignment="Center">
<TextBlock Text="Sort by: " VerticalAlignment="Center" Margin="0,0,5,0"/>
<Button Name="orderBtn" Background="Transparent" Content="Relevance" Foreground="Blue" Padding="0" VerticalAlignment="Center">
<Button.Flyout>
<MenuFlyout>
+2 -14
View File
@@ -11,25 +11,13 @@
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" Name="grid">
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition/>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<StackPanel Name="navigation" Visibility="Collapsed" Orientation="Horizontal" Padding="10,0,10,0" Background="Red" Height="47">
<HyperlinkButton Name="toRecommended" Click="toRecommended_Click" Foreground="White" Margin="0,0,10,0">
<TextBlock Text="Recommended"/>
</HyperlinkButton>
<HyperlinkButton Name="toTrending" Click="toTrending_Click" Foreground="White" Margin="0,0,10,0">
<TextBlock Text="Trending"/>
</HyperlinkButton>
<HyperlinkButton Name="tosubs" Click="tosubs_Click" Foreground="White" Margin="0,0,10,0">
<TextBlock Text="Subscriptions"/>
</HyperlinkButton>
</StackPanel>
<Pivot Grid.Row="1" Name="pivot" SelectionChanged="pivot_SelectionChanged"/>
<Pivot Name="pivot" SelectionChanged="pivot_SelectionChanged"/>
<CommandBar Grid.Row="2">
<CommandBar Grid.Row="1">
<AppBarButton Icon="Refresh" Label="Refresh page" Name="refresh" Click="refresh_Click"/>
</CommandBar>
</Grid>
+8 -37
View File
@@ -80,7 +80,7 @@ namespace FoxTube
else
trendMore.Complete(true);
foreach (Google.Apis.YouTube.v3.Data.Video vid in response.Items)
foreach (Video vid in response.Items)
{
VideoCard vCard = new VideoCard(vid.Id);
recGrid.Add(vCard);
@@ -99,8 +99,6 @@ namespace FoxTube
if(SecretsVault.IsAuthorized)
{
navigation.Visibility = Visibility.Visible;
//Initializing recommended tab
StackPanel rs = new StackPanel();
rs.Children.Add(recGrid);
@@ -111,8 +109,8 @@ namespace FoxTube
pivot.Items.Add(new PivotItem()
{
Margin = new Thickness(0, -48, 0, 0),
Content = rg
Content = rg,
Header = "Recommended"
});
//Initializing trending tab
@@ -125,8 +123,8 @@ namespace FoxTube
pivot.Items.Add(new PivotItem()
{
Margin = new Thickness(0, -48, 0, 0),
Content = tg
Content = tg,
Header = "Trending"
});
//Initializing subscriptions tab
@@ -139,8 +137,8 @@ namespace FoxTube
pivot.Items.Add(new PivotItem()
{
Margin = new Thickness(0, -48, 0, 0),
Content = g
Content = g,
Header = "Subscriptions"
});
LoadRecommendations();
@@ -156,7 +154,6 @@ namespace FoxTube
pivot.Items.Add(new PivotItem()
{
Margin = new Thickness(0, -48, 0, 0),
Content = tg
});
@@ -164,24 +161,6 @@ namespace FoxTube
}
}
private void toRecommended_Click(object sender, RoutedEventArgs e)
{
pivot.SelectedIndex = 0;
}
private void toTrending_Click(object sender, RoutedEventArgs e)
{
if (pivot.Items.Count > 1)
pivot.SelectedIndex = 1;
else
pivot.SelectedIndex = 0;
}
private void tosubs_Click(object sender, RoutedEventArgs e)
{
pivot.SelectedIndex = 2;
}
private void refresh_Click(object sender, RoutedEventArgs e)
{
Initialize();
@@ -189,32 +168,24 @@ namespace FoxTube
private void pivot_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
toRecommended.FontWeight = FontWeights.Normal;
toTrending.FontWeight = FontWeights.Normal;
tosubs.FontWeight = FontWeights.Normal;
switch(pivot.SelectedIndex)
{
case 2:
tosubs.FontWeight = FontWeights.Bold;
if (!subsLoaded)
LoadSubscriptions();
break;
case 1:
toTrending.FontWeight = FontWeights.Bold;
if (!trendLoaded)
LoadTrending();
break;
case 0:
if (pivot.Items.Count > 1)
{
toRecommended.FontWeight = FontWeights.Bold;
if (!recLoaded)
LoadRecommendations();
}
else
{
toTrending.FontWeight = FontWeights.Bold;
if (!trendLoaded)
LoadTrending();
}
@@ -236,7 +207,7 @@ namespace FoxTube
else
trendMore.Complete(true);
foreach (Google.Apis.YouTube.v3.Data.Video vid in response.Items)
foreach (Video vid in response.Items)
{
VideoCard vCard = new VideoCard(vid.Id);
trendGrid.Add(vCard);
+72 -187
View File
@@ -24,201 +24,86 @@
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Grid.RowDefinitions>
<RowDefinition Height="50" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid Background="Red">
<StackPanel Orientation="Horizontal">
<Button Name="menuButton"
Width="50" Height="50"
FontFamily="Segoe MDL2 Assets" FontSize="20" Content="&#xE700;"
Foreground="White" Background="Red"
Click="menuButton_Click"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
<TextBlock Text="FoxTube" FontSize="20" FontWeight="Bold" Margin="5, 0, 0, 0" HorizontalAlignment="Left" VerticalAlignment="Center" Foreground="White" Name="headerText"/>
</StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Background="Red">
<Grid Width="50">
<Button Name="notificationMenu" ToolTipService.ToolTip="Notifications" Click="notificationMenu_Click"
FontFamily="Segoe MDL2 Assets" Content="&#xED0D;" Foreground="White"
<NavigationView PaneTitle="FoxTube" OpenPaneLength="300" Name="nav" IsPaneOpen="False" SelectionChanged="nav_SelectionChanged">
<NavigationView.MenuItems>
<NavigationViewItem Icon="Home" Content="Home" Name="toHome"/>
<NavigationViewItem Content="History" Name="toHistory">
<NavigationViewItem.Icon>
<FontIcon Glyph="&#xE81C;"/>
</NavigationViewItem.Icon>
</NavigationViewItem>
<NavigationViewItem Icon="Like" Content="Liked videos" Name="toLiked"/>
<NavigationViewItem Icon="Clock" Content="Watch later" Name="toLater"/>
<NavigationViewItem Icon="People" Content="Subscriptions" Name="toSubscriptions"/>
<NavigationViewItem Icon="Download" Content="Downloads" Name="toDownloads"/>
<NavigationViewItemHeader Content="Subscriptions" Name="subsHeader"/>
</NavigationView.MenuItems>
<NavigationView.PaneFooter>
<NavigationViewList>
<NavigationViewItem Content="My channel" Icon="Contact" Name="toChannel"/>
<!--<NavigationViewItem>
<StackPanel Orientation="Horizontal">
<PersonPicture Height="20" Margin="-2,0,14,0"/>
<TextBlock Text="My channel"/>
</StackPanel>
</NavigationViewItem>-->
<NavigationViewItem Icon="Shop" Content="Remove ads"/>
</NavigationViewList>
</NavigationView.PaneFooter>
<NavigationView.AutoSuggestBox>
<AutoSuggestBox x:Name="search" QueryIcon="Find" QuerySubmitted="search_QuerySubmitted" TextChanged="search_TextChanged" PlaceholderText="Search"/>
</NavigationView.AutoSuggestBox>
<NavigationView.Header>
<Grid Margin="10,10,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock FontSize="28" VerticalAlignment="Center" Text="Home" Name="header"/>
<StackPanel Orientation="Horizontal" Grid.Column="1" Margin="0,17,0,0">
<Button Name="notificationMenu" ToolTipService.ToolTip="Notifications" Click="notificationMenu_Click"
FontFamily="Segoe MDL2 Assets" Content="&#xED0D;"
Width="50" Height="50" Background="Transparent"/>
<Popup HorizontalAlignment="Right" Margin="0,50,0,0" Name="notificationPane" Width="350" Height="450" IsOpen="False" IsLightDismissEnabled="True"/>
</Grid>
<Button Name="feedback" ToolTipService.ToolTip="Send feedback" Click="feedback_Click"
FontFamily="Segoe MDL2 Assets" Content="&#xED15;" Foreground="White"
<Button Name="feedback" ToolTipService.ToolTip="Send feedback" Click="feedback_Click"
FontFamily="Segoe MDL2 Assets" Content="&#xED15;"
Width="50" Height="50" Background="Transparent"/>
<Button Name="account" ToolTipService.ToolTip="Sign in"
FontFamily="Segoe MDL2 Assets" Content="&#xE8FA;" Foreground="White"
<Button Name="account" ToolTipService.ToolTip="Sign in"
FontFamily="Segoe MDL2 Assets" Content="&#xE8FA;"
Width="50" Height="50" Background="Transparent">
<Button.Flyout>
<MenuFlyout>
<MenuFlyoutItem Text="Sign in with existing account" Name="signIn" Click="signIn_Click"/>
<MenuFlyoutItem Text="Create new Google account" Name="createAccount" Click="createAccount_Click"/>
</MenuFlyout>
</Button.Flyout>
</Button>
<Button.Flyout>
<MenuFlyout>
<MenuFlyoutItem Text="Sign in with existing account" Name="signIn" Click="signIn_Click"/>
<MenuFlyoutItem Text="Create new Google account" Name="createAccount" Click="createAccount_Click"/>
</MenuFlyout>
</Button.Flyout>
</Button>
<Button Width="50" Background="Transparent" Height="50" Visibility="Visible" Name="avatar" ToolTipService.ToolTip="My account">
<Grid>
<Ellipse Height="30" Fill="White"/>
<PersonPicture Width="30"/>
</Grid>
<Button.Flyout>
<MenuFlyout>
<MenuFlyoutItem Text="My channel" Name="myChannel" Click="myChannel_Click"/>
<MenuFlyoutSeparator/>
<MenuFlyoutItem Text="Log out" Name="logout" Click="logout_Click"/>
</MenuFlyout>
</Button.Flyout>
</Button>
<!--<Grid>
<Button Width="50" Background="Transparent" Height="50" Visibility="Collapsed" Name="LoggedAvatar" ToolTipService.ToolTip="My account" Click="LoggedAvatar_Click">
<PersonPicture Width="30"/>
</Button>
<Popup Margin="0,50,0,0" IsOpen="False" IsLightDismissEnabled="True" Name="AccountManagement">
<StackPanel Width="300" Background="WhiteSmoke">
<StackPanel Name="accountsMenu">
<Button HorizontalAlignment="Stretch" HorizontalContentAlignment="Left" Background="Transparent" Height="75">
<StackPanel Orientation="Horizontal">
<PersonPicture Height="50" Margin="0,0,5,0"></PersonPicture>
<StackPanel VerticalAlignment="Center">
<TextBlock Text="[Account name]"/>
<TextBlock Foreground="Gray" FontStyle="Italic" Text="[example@mail.com]"/>
</StackPanel>
</StackPanel>
</Button>
</StackPanel>
<Button HorizontalAlignment="Stretch" HorizontalContentAlignment="Left" Background="Transparent" Content="Add another account">
<Button.Flyout>
<MenuFlyout>
<MenuFlyoutItem Text="Sign in with existing account" Click="signIn_Click"/>
<MenuFlyoutItem Text="Create a new Google account" Click="createAccount_Click"/>
</MenuFlyout>
</Button.Flyout>
</Button>
<Line X1="10" X2="290" Stroke="Gray" StrokeThickness="1"/>
<Button HorizontalAlignment="Stretch" HorizontalContentAlignment="Left" Background="Transparent" Content="Log out"/>
</StackPanel>
</Popup>
</Grid>-->
<Grid Name="compactSearch" Visibility="Collapsed">
<TextBox KeyUp="searchField_KeyUp" Name="searchField" ToolTipService.ToolTip="Search" Margin="4" Width="350" Height="42" Padding="10,10,45,0" PlaceholderText="Search" BorderThickness="0" Background="#7FFFFFFF" Text="DAGmaes" TextChanged="searchField_TextChanged" GotFocus="searchField_GotFocus"/>
<Button Name="searchButton" HorizontalAlignment="Right" Click="searchButton_Click"
Width="42" Height="42" Margin="4"
Background="Transparent"
FontFamily="Segoe MDL2 Assets" Content="&#xE11A;" FontSize="20" Foreground="Black"/>
<Popup Margin="0,50,0,0" Name="searchSuggestions" IsOpen="False" Width="350" IsLightDismissEnabled="True"/>
<Button Width="50" Background="Transparent" Height="50" Visibility="Visible" Name="avatar" ToolTipService.ToolTip="My account">
<PersonPicture Width="30"/>
<Button.Flyout>
<MenuFlyout>
<MenuFlyoutItem Text="My channel" Name="myChannel" Click="myChannel_Click"/>
<MenuFlyoutSeparator/>
<MenuFlyoutItem Text="Log out" Name="logout" Click="logout_Click"/>
</MenuFlyout>
</Button.Flyout>
</Button>
</StackPanel>
</Grid>
<Button Width="50" Height="50" Background="Transparent" FontFamily="Segoe MDL2 Assets" Content="&#xE11A;" Foreground="White" Name="openSearch" Visibility="Visible"/>
</StackPanel>
<Grid Visibility="Collapsed">
<TextBox HorizontalAlignment="Stretch" Background="White" BorderThickness="1" BorderBrush="Gray" PlaceholderText="Search" Padding="10,13,10,0" Margin="0,0,50,0"/>
<Button Background="White" HorizontalAlignment="Right" Width="50" Height="50" FontFamily="Segoe MDL2 Assets" Content="&#xE11A;"/>
</NavigationView.Header>
<Grid>
<Frame Name="content"/>
<Frame Name="videoPlaceholder"/>
</Grid>
</Grid>
<SplitView Name="menu" Grid.Row="1" OpenPaneLength="250" CompactPaneLength="50" DisplayMode="CompactInline" IsPaneOpen="True" PaneClosing="menu_PaneClosed" PaneOpening="menu_PaneOpened">
<SplitView.Pane>
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<ScrollViewer>
<StackPanel>
<ListBox Name="mainList" SelectionChanged="MainListSelected">
<ListBoxItem Name="toHome" IsSelected="True">
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource ItemIcon}" Text="&#xE80F;"/>
<TextBlock Style="{StaticResource MenuItem}" Text="Home"/>
</StackPanel>
</ListBoxItem>
<ListBoxItem Name="toHistory" Visibility="Visible">
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource ItemIcon}" Text="&#xE81C;"/>
<TextBlock Style="{StaticResource MenuItem}" Text="History"/>
</StackPanel>
</ListBoxItem>
<ListBoxItem Name="toLiked" Visibility="Visible">
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource ItemIcon}" Text="&#xE19F;"/>
<TextBlock Style="{StaticResource MenuItem}" Text="Liked videos"/>
</StackPanel>
</ListBoxItem>
<ListBoxItem Name="toLater" Visibility="Visible">
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource ItemIcon}" Text="&#xE121;"/>
<TextBlock Style="{StaticResource MenuItem}" Text="Watch later"/>
</StackPanel>
</ListBoxItem>
<ListBoxItem Name="toSubscriptions" Visibility="Visible">
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource ItemIcon}" Text="&#xE716;"/>
<TextBlock Style="{StaticResource MenuItem}" Text="Subscriptions"/>
</StackPanel>
</ListBoxItem>
<ListBoxItem Name="toDownloads">
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource ItemIcon}" Text="&#xE896;"/>
<TextBlock Style="{StaticResource MenuItem}" Text="Downloads"/>
</StackPanel>
</ListBoxItem>
</ListBox>
<ListBox Name="subscriptionsList" Visibility="Collapsed" SelectionChanged="SubscriptionSelected">
<ListBoxItem IsEnabled="False" Height="17" Padding="0,0,5,0">
<StackPanel Orientation="Horizontal">
<TextBlock Name="subsTitle" Text="Subscriptions" FontSize="12" Padding="5,0,5,0" Visibility="Visible"/>
<Line X2="300" Stroke="Gray" VerticalAlignment="Center"/>
</StackPanel>
</ListBoxItem>
</ListBox>
</StackPanel>
</ScrollViewer>
<ListBox Grid.Row="1" VerticalAlignment="Bottom" Name="serviceList" SelectionChanged="ServiceListSelected">
<ListBoxItem Padding="0" IsEnabled="False">
<Line X2="250" Stroke="Gray"/>
</ListBoxItem>
<ListBoxItem Name="toChannel">
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource ItemIcon}" Text="&#xE13D;"/>
<TextBlock Style="{StaticResource MenuItem}" Text="My channel"/>
</StackPanel>
</ListBoxItem>
<ListBoxItem Name="toRemoveAds">
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource ItemIcon}" Text="&#xE719;"/>
<TextBlock Style="{StaticResource MenuItem}" Text="Remove ads (2$)"/>
</StackPanel>
</ListBoxItem>
<ListBoxItem Name="toSettings">
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource ItemIcon}" Text="&#xE115;"/>
<TextBlock Style="{StaticResource MenuItem}" Text="Settings"/>
</StackPanel>
</ListBoxItem>
</ListBox>
</Grid>
</SplitView.Pane>
<SplitView.Content>
<Grid>
<Frame Name="content"/>
<Frame Name="videoPlaceholder"/>
<Frame Name="popupPlaceholder" Visibility="Collapsed"/>
</Grid>
</SplitView.Content>
</SplitView>
</NavigationView>
</Grid>
</Page>
+82 -211
View File
@@ -47,19 +47,13 @@ namespace FoxTube
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public enum RightPaneState { Full, Collapsed, Hidden }
public sealed partial class MainPage : Page
{
public DownloadAgent Agent = new DownloadAgent();
RightPaneState paneState = RightPaneState.Full;
bool isForcedCollapsed = false;
ApplicationDataContainer settings = ApplicationData.Current.LocalSettings;
NotificationsCenter notificationsCenter = new NotificationsCenter();
SuggestionsQueries suggestions = new SuggestionsQueries();
public MainPage()
{
this.InitializeComponent();
@@ -89,8 +83,6 @@ namespace FoxTube
if (settings.Values["defaultDownload"] == null)
settings.Values.Add("defaultDownload", Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\DownloadedVideos");
notificationPane.Child = notificationsCenter;
SecretsVault.AuthorizationStateChanged += Vault_AuthorizationStateChanged;
SecretsVault.SubscriptionsChanged += SecretsVault_SubscriptionsChanged;
SecretsVault.CheckAuthorization();
@@ -98,27 +90,41 @@ namespace FoxTube
content.Navigate(typeof(Home));
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
SetTitleBar();
}
public void SetTitleBar()
{
var titleBar = ApplicationView.GetForCurrentView().TitleBar;
titleBar.ButtonBackgroundColor = Colors.Transparent;
titleBar.ButtonHoverBackgroundColor = Colors.IndianRed;
titleBar.ButtonPressedBackgroundColor = Colors.DarkRed;
CoreApplicationViewTitleBar coreTitleBar = CoreApplication.GetCurrentView().TitleBar;
coreTitleBar.ExtendViewIntoTitleBar = false;
}
private void SecretsVault_SubscriptionsChanged(object sender, params object[] args)
{
if ((string)args[0] == "add" && subscriptionsList.Items.Count < 10)
if ((string)args[0] == "add" && nav.MenuItems.Count < 16)
{
Subscription s = args[1] as Subscription;
StackPanel panel = new StackPanel() { Orientation = Orientation.Horizontal };
panel.Children.Add(new PersonPicture()
{
Height = 25,
Margin = new Thickness(0, 0, 17, 0),
Height = 20,
Margin = new Thickness(0, 0, 13, 0),
ProfilePicture = new BitmapImage(new Uri(s.Snippet.Thumbnails.Medium.Url))
});
panel.Children.Add(new TextBlock()
{
VerticalAlignment = VerticalAlignment.Center,
Text = s.Snippet.Title
});
subscriptionsList.Items.Add(new ListBoxItem() { Content = panel });
panel.Children.Add(new TextBlock() { Text = s.Snippet.Title });
nav.MenuItems.Add(new NavigationViewItem() { Content = panel });
}
else if ((string)args[0] == "remove" && (int)args[1] < 10)
subscriptionsList.Items.RemoveAt((int)args[1]);
nav.MenuItems.RemoveAt((int)args[1]);
}
private async void Vault_AuthorizationStateChanged(object sender, EventArgs e)
@@ -144,7 +150,7 @@ namespace FoxTube
if (SecretsVault.Subscriptions.Count > 0)
{
subscriptionsList.Visibility = Visibility.Visible;
subsHeader.Visibility = Visibility.Visible;
int l = SecretsVault.Subscriptions.Count;
int n = 10;
for(int k = 0; k < l && k < n; k++)
@@ -154,18 +160,14 @@ namespace FoxTube
StackPanel panel = new StackPanel() { Orientation = Orientation.Horizontal };
panel.Children.Add(new PersonPicture()
{
Height = 25,
Margin = new Thickness(0, 0, 17, 0),
Height = 20,
Margin = new Thickness(0, 0, 13, 0),
ProfilePicture = new BitmapImage(new Uri(s.Snippet.Thumbnails.Medium.Url))
});
panel.Children.Add(new TextBlock()
{
VerticalAlignment = VerticalAlignment.Center,
Text = s.Snippet.Title
});
subscriptionsList.Items.Add(new ListBoxItem() { Content = panel });
panel.Children.Add(new TextBlock() { Text = s.Snippet.Title });
nav.MenuItems.Add(new NavigationViewItem() { Content = panel });
}
catch { n++; }
catch { continue; }
}
}
else
@@ -179,9 +181,9 @@ namespace FoxTube
toSubscriptions.Visibility = Visibility.Collapsed;
toChannel.Visibility = Visibility.Collapsed;
subscriptionsList.Visibility = Visibility.Collapsed;
for(int k = 1; k < subscriptionsList.Items.Count; k++)
subscriptionsList.Items.RemoveAt(k);
subsHeader.Visibility = Visibility.Collapsed;
for(int k = 7; k < nav.MenuItems.Count; k++)
nav.MenuItems.RemoveAt(k);
}
content.CacheSize = 0;
@@ -191,36 +193,12 @@ namespace FoxTube
(videoPlaceholder.Content as VideoPage).refresh_Click(this, null);
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
SetTitleBar();
}
public void SetTitleBar()
{
var titleBar = ApplicationView.GetForCurrentView().TitleBar;
titleBar.BackgroundColor = titleBar.ButtonBackgroundColor = Colors.Red;
titleBar.ForegroundColor = titleBar.ButtonForegroundColor = Colors.White;
titleBar.ButtonHoverBackgroundColor = Colors.IndianRed;
titleBar.ButtonPressedBackgroundColor = Colors.DarkRed;
CoreApplicationViewTitleBar coreTitleBar = CoreApplication.GetCurrentView().TitleBar;
coreTitleBar.ExtendViewIntoTitleBar = false;
}
private void menuButton_Click(object sender, RoutedEventArgs e)
{
menu.IsPaneOpen = !menu.IsPaneOpen;
}
public void GotNotification()
{
notificationMenu.Content = "";
notificationMenu.Content = "\xED0C";
}
void MainListSelected(object sender, SelectionChangedEventArgs e)
/*void MainListSelected(object sender, SelectionChangedEventArgs e)
{
try
{
@@ -283,12 +261,12 @@ namespace FoxTube
GoToChannel(SecretsVault.Subscriptions[subscriptionsList.SelectedIndex - 1].Snippet.ResourceId.ChannelId);
}
catch { }
}
}*/
public void notificationMenu_Click(object sender, RoutedEventArgs e)
{
notificationMenu.Content = "";
notificationPane.IsOpen = !notificationPane.IsOpen;
notificationMenu.Content = "\xED0D";
//notificationPane.IsOpen = !notificationPane.IsOpen;
}
private void feedback_Click(object sender, RoutedEventArgs e)
@@ -301,20 +279,6 @@ namespace FoxTube
content.Navigate(typeof(Settings), $"feedback&isProblem={isProblem}&meta={meta}");
}
private void menu_PaneClosed(SplitView sender, object args)
{
subsTitle.Visibility = Visibility.Collapsed;
}
private void menu_PaneOpened(SplitView sender, object args)
{
try
{
subsTitle.Visibility = Visibility.Visible;
}
catch { }
}
private async void createAccount_Click(object sender, RoutedEventArgs e)
{
await Launcher.LaunchUriAsync(new Uri("https://accounts.google.com/signup/v2/webcreateaccount?ManageAccount&flowName=GlifWebSignIn&flowEntry=SignUp"));
@@ -335,92 +299,17 @@ namespace FoxTube
SecretsVault.Deauthenticate();
}
private void searchField_TextChanged(object sender, TextChangedEventArgs e)
public void GoToSearch(string keyword = null)
{
if (searchField.Text.Length > 2)
suggestions.BuildList(searchField.Text);
else
suggestions.Hide();
}
if(keyword != null)
search.Text = keyword;
private void searchField_GotFocus(object sender, RoutedEventArgs e)
{
suggestions.Hide();
if (Window.Current.Bounds.Width >= 500)
{
searchSuggestions.Child = suggestions;
searchSuggestions.IsOpen = !searchSuggestions.IsOpen;
}
else
popupPlaceholder.Content = suggestions;
}
private void searchButton_Click(object sender, RoutedEventArgs e)
{
if(!string.IsNullOrWhiteSpace(searchField.Text))
if (!string.IsNullOrWhiteSpace(search.Text))
{
if (!(content.Content is Search))
content.Navigate(typeof(Search), searchField.Text);
else if ((content.Content as Search).Term != searchField.Text)
(content.Content as Search).Initialize(searchField.Text);
}
}
public void GoToSearch(string keyword)
{
searchField.Text = keyword;
searchButton_Click(this, null);
}
/*private async void StartSearch(string keyword)
{
content.Navigate(typeof(Search));
HamburgerSelectionChanged(null, null);
YouTubeService ytService = SecretsVault.IsAuthorized ? SecretsVault.Service : SecretsVault.NoAuthService;
var searchListRequest = ytService.Search.List("snippet");
searchListRequest.Q = keyword;
searchListRequest.SafeSearch = (SearchResource.ListRequest.SafeSearchEnum)(int)settings.Values["safeSearch"];
searchListRequest.MaxResults = 25;
try
{
searchListRequest.RelevanceLanguage = settings.Values["region"].ToString().Remove(2).ToLower();
}
catch(ArgumentOutOfRangeException)
{
searchListRequest.RelevanceLanguage = settings.Values["region"].ToString().ToLower();
}
var response = await searchListRequest.ExecuteAsync();
Search s = content.Content as Search;
s.SetResults(keyword, (int)response.PageInfo.TotalResults);
Debug.WriteLine("building items tree...");
foreach (SearchResult result in response.Items)
s.AddItem(result);
s.ring.IsActive = false;
s.content.Visibility = Visibility.Visible;
Debug.WriteLine("done");
}*/
private void searchField_KeyUp(object sender, KeyRoutedEventArgs e)
{
if (e.Key == VirtualKey.Enter)
{
searchButton_Click(this, null);
content.Focus(FocusState.Pointer);
searchSuggestions.IsOpen = false;
}
}
private void searchSuggestionsList_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if(e.AddedItems.Count > 0)
{
ListBoxItem item = e.AddedItems[0] as ListBoxItem;
searchField.Text = item.Content.ToString();
searchButton_Click(this, null);
content.Navigate(typeof(Search), search.Text);
else if ((content.Content as Search).Term != search.Text)
(content.Content as Search).Initialize(search.Text);
}
}
@@ -432,16 +321,11 @@ namespace FoxTube
public void GoToVideo(string id)
{
menu.DisplayMode = SplitViewDisplayMode.CompactOverlay;
menu.IsPaneOpen = false;
isForcedCollapsed = true;
nav.IsPaneOpen = false;
videoPlaceholder.Content = null;
videoPlaceholder.Width = double.NaN;
videoPlaceholder.Height = double.NaN;
videoPlaceholder.VerticalAlignment = VerticalAlignment.Stretch;
videoPlaceholder.HorizontalAlignment = HorizontalAlignment.Stretch;
videoPlaceholder.Margin = new Thickness(0);
MaximizeVideo();
Fullscreen(false);
videoPlaceholder.Navigate(typeof(VideoPage), id);
}
@@ -462,51 +346,11 @@ namespace FoxTube
{
if (videoPlaceholder.Content != null)
(videoPlaceholder.Content as VideoPage).player.UpdateSize();
if(isForcedCollapsed)
{
if (e.NewSize.Width >= 600 && paneState != RightPaneState.Collapsed)
{
menu.DisplayMode = SplitViewDisplayMode.CompactOverlay;
menu.IsPaneOpen = false;
paneState = RightPaneState.Collapsed;
}
else if (e.NewSize.Width < 600 && paneState != RightPaneState.Hidden)
{
menu.DisplayMode = SplitViewDisplayMode.Overlay;
menu.IsPaneOpen = false;
paneState = RightPaneState.Hidden;
}
}
else
{
if (e.NewSize.Width >= 1000 && paneState != RightPaneState.Full)
{
menu.DisplayMode = SplitViewDisplayMode.CompactInline;
menu.IsPaneOpen = true;
paneState = RightPaneState.Full;
}
else if(e.NewSize.Width >= 600 && e.NewSize.Width < 1000 && paneState != RightPaneState.Collapsed)
{
menu.DisplayMode = SplitViewDisplayMode.CompactOverlay;
menu.IsPaneOpen = false;
paneState = RightPaneState.Collapsed;
}
else if(e.NewSize.Width < 600 && paneState != RightPaneState.Hidden)
{
menu.DisplayMode = SplitViewDisplayMode.Overlay;
menu.IsPaneOpen = false;
paneState = RightPaneState.Hidden;
}
}
}
public void MinimizeAsInitializer()
{
try
{
(videoPlaceholder.Content as VideoPage).player.minimize_Click(this, null);
}
try { (videoPlaceholder.Content as VideoPage).player.minimize_Click(this, null); }
catch { }
}
@@ -532,15 +376,15 @@ namespace FoxTube
{
if(on)
{
grid.RowDefinitions[0].Height = new GridLength(0);
menu.CompactPaneLength = 0;
menu.OpenPaneLength = 0;
nav.AlwaysShowHeader = false;
nav.CompactPaneLength = 0;
nav.OpenPaneLength = 0;
}
else
{
grid.RowDefinitions[0].Height = new GridLength(50);
menu.CompactPaneLength = 50;
menu.OpenPaneLength = 250;
nav.AlwaysShowHeader = true;
nav.CompactPaneLength = 48;
nav.OpenPaneLength = 300;
}
}
@@ -554,5 +398,32 @@ namespace FoxTube
videoPlaceholder.Content = null;
MaximizeVideo();
}
private void search_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
{
GoToSearch();
}
private void search_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
{
if(search.Text.Length > 2)
{
XmlDocument doc = new XmlDocument();
doc.Load($"http://suggestqueries.google.com/complete/search?output=toolbar&hl={(settings.Values["region"] as string)[0] + (settings.Values["region"] as string)[1]}&q={search.Text}");
if (doc["toplevel"].HasChildNodes)
for (int k = 0; k < 5; k++)
try
{
search.Items.Add(doc["toplevel"].ChildNodes[k]["suggestion"].GetAttribute("data"));
}
catch { break; }
}
}
private void nav_SelectionChanged(NavigationView sender, NavigationViewSelectionChangedEventArgs args)
{
}
}
}
+23 -73
View File
@@ -10,82 +10,32 @@
mc:Ignorable="d">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid.RowDefinitions>
<RowDefinition Height="47"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<ScrollViewer Grid.Row="1">
<Pivot SelectedIndex="0" Name="pivot" Grid.Row="1" IsHeaderItemsCarouselEnabled="False" SelectionChanged="content_SelectionChanged">
<PivotItem Margin="0,-48,0,0">
<StackPanel Orientation="Vertical" Margin="10">
<TextBlock Text="Preferences" FontSize="28"/>
<TextBlock Text="Region &#x26; search" FontSize="22"/>
<ComboBox Header="App interface language" MinWidth="250" Name="language" SelectionChanged="language_SelectionChanged">
<ComboBoxItem Content="English"/>
<ComboBoxItem Content="Russian"/>
</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>
<ComboBox Header="Region (for targeted content)" MinWidth="250" Name="region" SelectionChanged="region_SelectionChanged"/>
<ComboBox Header="SafeSearch" MinWidth="250" Name="safeSearch" SelectionChanged="safeSearch_SelectionChanged">
<ComboBoxItem Content="Moderate"/>
<ComboBoxItem Content="None"/>
<ComboBoxItem Content="Strict"/>
</ComboBox>
<TextBlock Text="Playback" FontSize="22"/>
<ComboBox Margin="0,0,0,10" Width="250" Header="Default video playback quality" Name="quality" SelectionChanged="quality_SelectionChanged">
<!--<ComboBoxItem Content="Auto"/>-->
<ComboBoxItem Content="2160p"/>
<ComboBoxItem Content="1080p"/>
<ComboBoxItem Content="720p"/>
<ComboBoxItem Content="480p"/>
<ComboBoxItem Content="360p"/>
<ComboBoxItem Content="240p"/>
<ComboBoxItem Content="144p"/>
</ComboBox>
<ToggleSwitch OnContent="Notify when playing on metered connection" OffContent="Notify when playing on metered connection" Name="mobileWarning" Toggled="notification_IsEnabledChanged"/>
<ToggleSwitch OnContent="Play videos automatically" OffContent="Play videos automatically" Name="autoplay" Margin="0,0,0,10" Toggled="notification_IsEnabledChanged"/>
<TextBlock Text="Notifications" FontSize="22"/>
<CheckBox Content="New video" Name="newVideo" Click="notification_IsEnabledChanged"/>
<CheckBox Content="What's new posts" Visibility="Collapsed" Click="notification_IsEnabledChanged"/>
<CheckBox Content="Developer's messages" Name="messages" Margin="0,0,0,10" Click="notification_IsEnabledChanged"/>
</StackPanel>
</PivotItem>
<PivotItem Name="feedbackHub" Margin="0,-48,0,0">
<Pivot SelectedIndex="0" Name="pivot" IsHeaderItemsCarouselEnabled="False">
<PivotItem Header="General">
<ScrollViewer>
<settingspages:General/>
</ScrollViewer>
</PivotItem>
<PivotItem Header="Leave a feedback">
<ScrollViewer>
<settingspages:Feedback/>
</PivotItem>
<PivotItem Margin="0,-48,0,0">
</ScrollViewer>
</PivotItem>
<PivotItem Header="About us">
<ScrollViewer>
<settingspages:About/>
</PivotItem>
<PivotItem Margin="0,-48,0,0">
</ScrollViewer>
</PivotItem>
<PivotItem Header="Help us translate this app">
<ScrollViewer>
<settingspages:Translate/>
</PivotItem>
<PivotItem Margin="0,-48,0,0">
</ScrollViewer>
</PivotItem>
<PivotItem Header="Inbox">
<ScrollViewer>
<settingspages:Inbox/>
</PivotItem>
</Pivot>
</ScrollViewer>
<Grid Grid.Row="0" Background="Red">
<StackPanel Orientation="Horizontal" Margin="10,0,10,0" Grid.Row="0" Background="Red">
<HyperlinkButton Name="toGeneral" Click="toGeneral_Click" Foreground="White" Margin="0,0,10,0">
<TextBlock Text="General"/>
</HyperlinkButton>
<HyperlinkButton Foreground="White" Margin="0,0,10,0" Name="toFeedback" Click="toFeedback_Click">
<TextBlock Text="Leave feedback"/>
</HyperlinkButton>
<HyperlinkButton Foreground="White" Margin="0,0,10,0" Name="toAbout" Click="toAbout_Click">
<TextBlock Text="About us"/>
</HyperlinkButton>
<HyperlinkButton Foreground="White" Margin="0,0,10,0" Name="toTranslate" Click="toTranslate_Click">
<TextBlock Text="Help us translate this app"/>
</HyperlinkButton>
<HyperlinkButton Foreground="White" Margin="0,0,10,0" Name="toInbox" Click="toInbox_Click">
<TextBlock Text="Inbox"/>
</HyperlinkButton>
</StackPanel>
</Grid>
</ScrollViewer>
</PivotItem>
</Pivot>
</Grid>
</Page>
+4 -111
View File
@@ -27,28 +27,9 @@ namespace FoxTube
/// </summary>
public sealed partial class Settings : Page
{
ApplicationDataContainer settings = ApplicationData.Current.LocalSettings;
public Settings()
{
this.InitializeComponent();
language.SelectedIndex = (int)settings.Values["language"];
quality.SelectedIndex = (int)settings.Values["quality"];
newVideo.IsChecked = (bool)settings.Values["newVideoNotification"];
messages.IsChecked = (bool)settings.Values["newmessagesNotification"];
mobileWarning.IsOn = (bool)settings.Values["moblieWarning"];
autoplay.IsOn = (bool)settings.Values["videoAutoplay"];
safeSearch.SelectedIndex = (int)settings.Values["safeSearch"];
foreach (CultureInfo culture in CultureInfo.GetCultures(CultureTypes.AllCultures))
{
region.Items.Add(culture.DisplayName);
if (culture.Name == (string)settings.Values["region"])
region.SelectedIndex = region.Items.Count - 1;
}
}
protected override void OnNavigatedTo(NavigationEventArgs e)
@@ -58,7 +39,7 @@ namespace FoxTube
{
if((e.Parameter as string).Contains("feedback"))
{
toFeedback_Click(this, null);
pivot.SelectedIndex = 1;
if ((string)e.Parameter != "feedback")
{
((pivot.Items[1] as PivotItem).Content as Feedback).PreDefine(Convert.ToBoolean((e.Parameter as string).Split('&', '=')[2]), (e.Parameter as string).Split('&', '=')[4]);
@@ -68,104 +49,16 @@ namespace FoxTube
switch(e.Parameter as string)
{
case "about":
toAbout_Click(this, null);
pivot.SelectedIndex = 2;
break;
case "translate":
toTranslate_Click(this, null);
pivot.SelectedIndex = 3;
break;
case "inbox":
toInbox_Click(this, null);
pivot.SelectedIndex = 4;
break;
}
}
}
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)
{
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["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;
}
private void toGeneral_Click(object sender, RoutedEventArgs e)
{
pivot.SelectedIndex = 0;
}
private void toFeedback_Click(object sender, RoutedEventArgs e)
{
pivot.SelectedIndex = 1;
}
private void toTranslate_Click(object sender, RoutedEventArgs e)
{
pivot.SelectedIndex = 3;
}
private void content_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
toGeneral.FontWeight = FontWeights.Normal;
toFeedback.FontWeight = FontWeights.Normal;
toAbout.FontWeight = FontWeights.Normal;
toTranslate.FontWeight = FontWeights.Normal;
toInbox.FontWeight = FontWeights.Normal;
if (pivot.SelectedIndex == 0)
toGeneral.FontWeight = FontWeights.Bold;
else if (pivot.SelectedIndex == 1)
toFeedback.FontWeight = FontWeights.Bold;
else if (pivot.SelectedIndex == 2)
toAbout.FontWeight = FontWeights.Bold;
else if (pivot.SelectedIndex == 3)
toTranslate.FontWeight = FontWeights.Bold;
else if (pivot.SelectedIndex == 4)
{
toInbox.FontWeight = FontWeights.Bold;
if (!((pivot.SelectedItem as PivotItem).Content as Inbox).Loaded)
((pivot.SelectedItem as PivotItem).Content as Inbox).LoadItems();
}
}
private void toAbout_Click(object sender, RoutedEventArgs e)
{
pivot.SelectedIndex = 2;
}
private void region_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
settings.Values["region"] = CultureInfo.GetCultures(CultureTypes.AllCultures)[region.SelectedIndex].Name;
}
private void safeSearch_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
settings.Values["safeSearch"] = safeSearch.SelectedIndex;
}
private void toInbox_Click(object sender, RoutedEventArgs e)
{
pivot.SelectedIndex = 4;
}
}
}
+43
View File
@@ -0,0 +1,43 @@
<Page
x:Class="FoxTube.Pages.SettingsPages.General"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:FoxTube.Pages.SettingsPages"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<StackPanel Orientation="Vertical">
<TextBlock Text="Preferences" FontSize="28"/>
<TextBlock Text="Region &#x26; search" FontSize="22"/>
<ComboBox Header="App interface language" MinWidth="250" Name="language" SelectionChanged="language_SelectionChanged">
<ComboBoxItem Content="English"/>
<ComboBoxItem Content="Russian"/>
</ComboBox>
<TextBlock Foreground="Red" Name="restartNote" Text="Reopen the app to apply settings" Visibility="Collapsed"/>
<ComboBox Header="Region" MinWidth="250" Name="region" SelectionChanged="region_SelectionChanged"/>
<ComboBox Header="SafeSearch" MinWidth="250" Name="safeSearch" SelectionChanged="safeSearch_SelectionChanged">
<ComboBoxItem Content="Moderate"/>
<ComboBoxItem Content="None"/>
<ComboBoxItem Content="Strict"/>
</ComboBox>
<TextBlock Text="Playback" FontSize="22"/>
<ComboBox Width="250" Header="Default video playback quality" Name="quality" SelectionChanged="quality_SelectionChanged">
<ComboBoxItem Content="Remember my choice"/>
<ComboBoxItem Content="2160p"/>
<ComboBoxItem Content="1080p"/>
<ComboBoxItem Content="720p"/>
<ComboBoxItem Content="480p"/>
<ComboBoxItem Content="360p"/>
<ComboBoxItem Content="240p"/>
<ComboBoxItem Content="144p"/>
</ComboBox>
<ToggleSwitch OnContent="Notify when playing on metered connection" OffContent="Notify when playing on metered connection" Name="mobileWarning" Toggled="notification_IsEnabledChanged"/>
<ToggleSwitch OnContent="Play videos automatically" OffContent="Play videos automatically" Name="autoplay" Toggled="notification_IsEnabledChanged"/>
<TextBlock Text="Notifications" FontSize="22"/>
<ToggleSwitch Name="newVideo" OnContent="Notify when someone of your subscriptions uploaded new video" OffContent="Notify when someone of your subscriptions uploaded new video" Toggled="notification_IsEnabledChanged"/>
</StackPanel>
</Page>
@@ -0,0 +1,86 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.Storage;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
namespace FoxTube.Pages.SettingsPages
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class General : Page
{
ApplicationDataContainer settings = ApplicationData.Current.LocalSettings;
public General()
{
this.InitializeComponent();
language.SelectedIndex = (int)settings.Values["language"];
quality.SelectedIndex = (int)settings.Values["quality"];
newVideo.IsOn = (bool)settings.Values["newVideoNotification"];
mobileWarning.IsOn = (bool)settings.Values["moblieWarning"];
autoplay.IsOn = (bool)settings.Values["videoAutoplay"];
safeSearch.SelectedIndex = (int)settings.Values["safeSearch"];
foreach (CultureInfo culture in CultureInfo.GetCultures(CultureTypes.AllCultures))
{
region.Items.Add(culture.DisplayName);
if (culture.Name == (string)settings.Values["region"])
region.SelectedIndex = region.Items.Count - 1;
}
}
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)
{
settings.Values["quality"] = quality.SelectedIndex;
}
private void notification_IsEnabledChanged(object sender, RoutedEventArgs e)
{
if ((bool)settings.Values["newVideoNotification"] != newVideo.IsOn)
settings.Values["newVideoNotification"] = newVideo.IsOn;
if ((bool)settings.Values["moblieWarning"] != mobileWarning.IsOn)
settings.Values["moblieWarning"] = mobileWarning.IsOn;
if ((bool)settings.Values["videoAutoplay"] != autoplay.IsOn)
settings.Values["videoAutoplay"] = autoplay.IsOn;
}
private void region_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
settings.Values["region"] = CultureInfo.GetCultures(CultureTypes.AllCultures)[region.SelectedIndex].Name;
}
private void safeSearch_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
settings.Values["safeSearch"] = safeSearch.SelectedIndex;
}
}
}
+13 -37
View File
@@ -94,46 +94,22 @@
</CommandBar>
<Grid Grid.Column="1" Name="tabsPlaceholder">
<Grid Name="tabs">
<Grid.RowDefinitions>
<RowDefinition Height="47"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid Background="Red">
<StackPanel Orientation="Horizontal" Margin="10,0,10,0">
<HyperlinkButton Name="toDescription" Click="toDescription_Click" Foreground="White" Margin="0,0,10,0" Visibility="Collapsed">
<TextBlock Text="Description"/>
</HyperlinkButton>
<HyperlinkButton Name="toPlaylist" Click="toPlaylist_Click" Foreground="White" Margin="0,0,10,0" Visibility="Collapsed">
<TextBlock Text="Playlist"/>
</HyperlinkButton>
<HyperlinkButton Name="toSuggestions" Click="toSuggestions_Click" Foreground="White" Margin="0,0,10,0">
<TextBlock Text="Suggestions"/>
</HyperlinkButton>
<HyperlinkButton Name="toComments" Click="toComments_Click" Foreground="White" Margin="0,0,10,0">
<TextBlock Text="Comments"/>
</HyperlinkButton>
</StackPanel>
</Grid>
<Pivot Grid.Row="1" Name="pivot" SelectedIndex="0" SelectionChanged="pivot_SelectionChanged">
<PivotItem Margin="0,-48,0,0">
<ScrollViewer>
<StackPanel>
<ui:AdControl
<Pivot Grid.Row="1" Name="pivot" SelectedIndex="0" IsHeaderItemsCarouselEnabled="False">
<PivotItem Header="Suggestions">
<ScrollViewer>
<StackPanel>
<ui:AdControl
ApplicationId="3f83fe91-d6be-434d-a0ae-7351c5a997f1"
AdUnitId="test"
Width="320" Height="50"/>
<StackPanel Name="relatedVideos"/>
</StackPanel>
</ScrollViewer>
</PivotItem>
<PivotItem Margin="0,-48,0,0" Name="commentsPlaceholder">
<pages:CommentsPage/>
</PivotItem>
</Pivot>
</Grid>
<StackPanel Name="relatedVideos"/>
</StackPanel>
</ScrollViewer>
</PivotItem>
<PivotItem Header="Comments" Name="commentsPlaceholder">
<pages:CommentsPage/>
</PivotItem>
</Pivot>
</Grid>
<local:LoadingPage Grid.ColumnSpan="2" Visibility="Collapsed"/>
+13 -83
View File
@@ -79,13 +79,12 @@ namespace FoxTube.Pages
pivot.Items.Insert(0, new PivotItem()
{
Content = descriptionPanel,
Margin = new Thickness(0, -48, 0, 0)
Header = "Description"
});
tabsPlaceholder.Children.Remove(tabs);
mainContent.Children.Add(tabs);
toDescription.Visibility = Visibility.Visible;
tabsPlaceholder.Children.Remove(pivot);
mainContent.Children.Add(pivot);
grid.ColumnDefinitions[1].Width = new GridLength(0);
pivot.SelectedIndex = 0;
@@ -287,17 +286,15 @@ namespace FoxTube.Pages
if (e.NewSize.Width > 1000 && e.PreviousSize.Width <= 1000 && !isExtended)
{
if (mainContent.Children.Contains(tabs))
if (mainContent.Children.Contains(pivot))
{
mainContent.Children.Remove(tabs);
tabsPlaceholder.Children.Add(tabs);
(pivot.Items[0] as PivotItem).Content = null;
mainContent.Children.Remove(pivot);
tabsPlaceholder.Children.Add(pivot);
pivot.Items.RemoveAt(0);
mainContent.Children.Add(descriptionPanel);
}
toDescription.Visibility = Visibility.Collapsed;
grid.ColumnDefinitions[1].Width = new GridLength(400);
}
else if (e.NewSize.Width <= 1000 & e.PreviousSize.Width > 1000)
@@ -308,39 +305,17 @@ namespace FoxTube.Pages
pivot.Items.Insert(0, new PivotItem()
{
Content = descriptionPanel,
Margin = new Thickness(0, -48, 0, 0)
Header = "Description"
});
tabsPlaceholder.Children.Remove(tabs);
mainContent.Children.Add(tabs);
tabsPlaceholder.Children.Remove(pivot);
mainContent.Children.Add(pivot);
}
toDescription.Visibility = Visibility.Visible;
grid.ColumnDefinitions[1].Width = new GridLength(0);
}
pivot.SelectedIndex = 0;
pivot_SelectionChanged(this, null);
}
private void toDescription_Click(object sender, RoutedEventArgs e)
{
pivot.SelectedIndex = 0;
}
private void toPlaylist_Click(object sender, RoutedEventArgs e)
{
pivot.SelectedIndex = pivot.Items.Count - 3;
}
private void toComments_Click(object sender, RoutedEventArgs e)
{
pivot.SelectedIndex = pivot.Items.Count - 1;
}
private void toSuggestions_Click(object sender, RoutedEventArgs e)
{
pivot.SelectedIndex = pivot.Items.Count - 2;
}
private async void Share(DataTransferManager sender, DataRequestedEventArgs args)
@@ -387,51 +362,6 @@ namespace FoxTube.Pages
DataTransferManager.ShowShareUI();
}
private void pivot_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
toDescription.FontWeight = FontWeights.Normal;
toPlaylist.FontWeight = FontWeights.Normal;
toSuggestions.FontWeight = FontWeights.Normal;
toComments.FontWeight = FontWeights.Normal;
if (pivot.SelectedIndex == 0)
{
if (toDescription.Visibility != Visibility.Collapsed)
toDescription.FontWeight = FontWeights.Bold;
else if (toPlaylist.Visibility != Visibility.Collapsed)
toPlaylist.FontWeight = FontWeights.Bold;
else
toSuggestions.FontWeight = FontWeights.Bold;
}
else if (pivot.SelectedIndex == 1)
{
if (toDescription.Visibility == Visibility.Collapsed)
{
if (toPlaylist.Visibility == Visibility.Collapsed)
toComments.FontWeight = FontWeights.Bold;
else
toSuggestions.FontWeight = FontWeights.Bold;
}
else
{
if (toPlaylist.Visibility != Visibility.Collapsed)
toPlaylist.FontWeight = FontWeights.Bold;
else
toSuggestions.FontWeight = FontWeights.Bold;
}
}
else if (pivot.SelectedIndex == 2)
{
if(toDescription.Visibility != Visibility.Collapsed && toPlaylist.Visibility != Visibility.Collapsed)
toSuggestions.FontWeight = FontWeights.Bold;
else if (toDescription.Visibility != Visibility.Collapsed || toPlaylist.Visibility != Visibility.Collapsed)
toComments.FontWeight = FontWeights.Bold;
}
else if (pivot.SelectedIndex == 3)
toComments.FontWeight = FontWeights.Bold;
}
private async void dislike_Click(object sender, RoutedEventArgs e)
{
if (SecretsVault.IsAuthorized)