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
+4
View File
@@ -5,8 +5,10 @@ using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime; using System.Runtime.InteropServices.WindowsRuntime;
using Windows.ApplicationModel; using Windows.ApplicationModel;
using Windows.ApplicationModel.Activation; using Windows.ApplicationModel.Activation;
using Windows.ApplicationModel.Core;
using Windows.Foundation; using Windows.Foundation;
using Windows.Foundation.Collections; using Windows.Foundation.Collections;
using Windows.UI.Core;
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;
@@ -71,6 +73,8 @@ namespace FoxTube
// Ensure the current window is active // Ensure the current window is active
Window.Current.Activate(); Window.Current.Activate();
} }
CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true;
} }
/// <summary> /// <summary>
+16 -3
View File
@@ -61,21 +61,34 @@ namespace FoxTube
{ {
if (isWWW.IsMatch(item)) if (isWWW.IsMatch(item))
{ {
Debug.WriteLine(item); try
{
Hyperlink link = new Hyperlink { NavigateUri = new Uri(item), Foreground = new SolidColorBrush(Colors.Red) }; Hyperlink link = new Hyperlink { NavigateUri = new Uri(item), Foreground = new SolidColorBrush(Colors.Red) };
link.Inlines.Add(new Run { Text = item }); link.Inlines.Add(new Run { Text = item });
block.Inlines.Add(link); block.Inlines.Add(link);
} }
catch
{
block.Inlines.Add(new Run { Text = item });
}
}
else if (isEmail.IsMatch(item)) else if (isEmail.IsMatch(item))
{ {
Debug.WriteLine(item); try
{
Hyperlink link = new Hyperlink { NavigateUri = new Uri($"mailto:{item}"), Foreground = new SolidColorBrush(Colors.Red) }; Hyperlink link = new Hyperlink { NavigateUri = new Uri($"mailto:{item}"), Foreground = new SolidColorBrush(Colors.Red) };
link.Inlines.Add(new Run { Text = item }); link.Inlines.Add(new Run { Text = item });
block.Inlines.Add(link); block.Inlines.Add(link);
} }
catch
{
block.Inlines.Add(new Run { Text = item });
}
}
else if (item == "s") else if (item == "s")
continue; continue;
else block.Inlines.Add(new Run { Text = item }); else
block.Inlines.Add(new Run { Text = item });
} }
} }
+1 -1
View File
@@ -627,7 +627,7 @@ namespace FoxTube
{ {
await ApplicationView.GetForCurrentView().TryEnterViewModeAsync(ApplicationViewMode.Default); await ApplicationView.GetForCurrentView().TryEnterViewModeAsync(ApplicationViewMode.Default);
Methods.MainPage.SetTitleBar(); //Methods.MainPage.SetTitleBar();
mainControls.Visibility = Visibility.Visible; mainControls.Visibility = Visibility.Visible;
header.Visibility = Visibility.Visible; header.Visibility = Visibility.Visible;
+7
View File
@@ -142,6 +142,9 @@
<Compile Include="Pages\Home.xaml.cs"> <Compile Include="Pages\Home.xaml.cs">
<DependentUpon>Home.xaml</DependentUpon> <DependentUpon>Home.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Pages\SettingsPages\General.xaml.cs">
<DependentUpon>General.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\SettingsPages\Inbox.xaml.cs"> <Compile Include="Pages\SettingsPages\Inbox.xaml.cs">
<DependentUpon>Inbox.xaml</DependentUpon> <DependentUpon>Inbox.xaml</DependentUpon>
</Compile> </Compile>
@@ -331,6 +334,10 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
<Page Include="Pages\SettingsPages\General.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Pages\SettingsPages\Inbox.xaml"> <Page Include="Pages\SettingsPages\Inbox.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
+13 -33
View File
@@ -11,18 +11,12 @@
<Grid Name="grid" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> <Grid Name="grid" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="50"/> <RowDefinition/>
<RowDefinition Height="*"/>
<RowDefinition Height="auto"/> <RowDefinition Height="auto"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Pivot Grid.Row="1" Margin="0,-48,0,0" SelectedIndex="0" Name="content" IsHeaderItemsCarouselEnabled="False" SelectionChanged="content_SelectionChanged"> <Pivot SelectedIndex="0" Name="content" IsHeaderItemsCarouselEnabled="False" SelectionChanged="content_SelectionChanged">
<Pivot.ItemContainerStyle> <PivotItem Header="Videos">
<Style TargetType="PivotItem">
<Setter Property="Margin" Value="0"/>
</Style>
</Pivot.ItemContainerStyle>
<PivotItem>
<ScrollViewer> <ScrollViewer>
<StackPanel Name="videos"> <StackPanel Name="videos">
<Image Name="channelCover" Stretch="Uniform" Source="/Assets/ChannelCoverTemplate.png"/> <Image Name="channelCover" Stretch="Uniform" Source="/Assets/ChannelCoverTemplate.png"/>
@@ -51,7 +45,7 @@
</StackPanel> </StackPanel>
</ScrollViewer> </ScrollViewer>
</PivotItem> </PivotItem>
<PivotItem> <PivotItem Header="Playlists">
<ScrollViewer> <ScrollViewer>
<Grid Name="playlists"> <Grid Name="playlists">
<StackPanel Margin="10" Visibility="Visible"> <StackPanel Margin="10" Visibility="Visible">
@@ -63,7 +57,8 @@
</Grid> </Grid>
</ScrollViewer> </ScrollViewer>
</PivotItem> </PivotItem>
<PivotItem> <PivotItem Header="About channel">
<ScrollViewer>
<StackPanel Margin="10"> <StackPanel Margin="10">
<TextBlock FontSize="28" Text="About this channel"/> <TextBlock FontSize="28" Text="About this channel"/>
<Grid> <Grid>
@@ -98,35 +93,20 @@
</Grid> </Grid>
</Grid> </Grid>
</StackPanel> </StackPanel>
</ScrollViewer>
</PivotItem> </PivotItem>
<Pivot.RightHeader>
<AutoSuggestBox VerticalAlignment="Center" Width="250" Margin="8" PlaceholderText="Search on channel" QueryIcon="Find" Name="search" QuerySubmitted="AutoSuggestBox_QuerySubmitted"/>
</Pivot.RightHeader>
</Pivot> </Pivot>
<Grid Background="Red" Name="navigationPane"> <CommandBar Grid.Row="1" VerticalAlignment="Bottom" Name="commandBar">
<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">
<AppBarButton Icon="Globe" Label="Open in browser" Name="inBrowser" Click="inBrowser_Click"/> <AppBarButton Icon="Globe" Label="Open in browser" Name="inBrowser" Click="inBrowser_Click"/>
<AppBarButton Icon="Refresh" Label="Refresh" Name="refresh" Click="refresh_Click"/> <AppBarButton Icon="Refresh" Label="Refresh" Name="refresh" Click="refresh_Click"/>
<AppBarButton Icon="Share" Label="Share" Name="share" Click="share_Click"/> <AppBarButton Icon="Share" Label="Share" Name="share" Click="share_Click"/>
</CommandBar> </CommandBar>
<local:LoadingPage Grid.RowSpan="3" Visibility="Collapsed"/> <local:LoadingPage Grid.RowSpan="2" Visibility="Collapsed"/>
</Grid> </Grid>
</Page> </Page>
+18 -49
View File
@@ -53,7 +53,7 @@ namespace FoxTube.Pages
public ChannelPage() public ChannelPage()
{ {
this.InitializeComponent(); this.InitializeComponent();
loading = grid.Children[3] as LoadingPage; loading = grid.Children[2] as LoadingPage;
playlistLoading = playlists.Children[1] as LoadingPage; playlistLoading = playlists.Children[1] as LoadingPage;
videoList = videos.Children[2] as VideoGrid; 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) private void content_SelectionChanged(object sender, SelectionChangedEventArgs e)
{ {
toVideos.FontWeight = FontWeights.Normal; if (content.SelectedIndex == 1 && !playlistLoaded)
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(); 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;
} }
private async void showMorePlaylists_Click() private async void showMorePlaylists_Click()
@@ -297,6 +250,22 @@ namespace FoxTube.Pages
SecretsVault.Authorize(); 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) private void refresh_Click(object sender, RoutedEventArgs e)
{ {
Initialize(channelId); Initialize(channelId);
+5 -5
View File
@@ -13,7 +13,7 @@
<RowDefinition Height="auto"/> <RowDefinition Height="auto"/>
<RowDefinition/> <RowDefinition/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid Background="Red"> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="auto"/> <RowDefinition Height="auto"/>
<RowDefinition Height="30"/> <RowDefinition Height="30"/>
@@ -22,15 +22,15 @@
<Button HorizontalAlignment="Right" Name="send" Click="send_Click" VerticalAlignment="Top" <Button HorizontalAlignment="Right" Name="send" Click="send_Click" VerticalAlignment="Top"
Height="32" Width="32" Height="32" Width="32"
Margin="0,5,5,0" Padding="0" Margin="0,5,5,0" Padding="0"
Background="Transparent" Foreground="White" Background="Transparent"
FontFamily="Segoe MDL2 Assets" FontFamily="Segoe MDL2 Assets"
Content="&#xE122;" FontSize="30" ToolTipService.ToolTip="Post comment"/> Content="&#xE122;" FontSize="30" ToolTipService.ToolTip="Post comment"/>
<ProgressBar Name="sending" IsIndeterminate="True" Foreground="Red" Visibility="Collapsed" VerticalAlignment="Bottom" HorizontalAlignment="Stretch"/> <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"> <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"/> <TextBlock Text="Sort by: " VerticalAlignment="Center" Margin="0,0,5,0"/>
<Button Name="orderBtn" Background="Transparent" Content="Relevance" Foreground="DeepSkyBlue" Padding="0" VerticalAlignment="Center"> <Button Name="orderBtn" Background="Transparent" Content="Relevance" Foreground="Blue" Padding="0" VerticalAlignment="Center">
<Button.Flyout> <Button.Flyout>
<MenuFlyout> <MenuFlyout>
+2 -14
View File
@@ -11,25 +11,13 @@
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" Name="grid"> <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" Name="grid">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition/> <RowDefinition/>
<RowDefinition Height="auto"/> <RowDefinition Height="auto"/>
</Grid.RowDefinitions> </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"/> <AppBarButton Icon="Refresh" Label="Refresh page" Name="refresh" Click="refresh_Click"/>
</CommandBar> </CommandBar>
</Grid> </Grid>
+8 -37
View File
@@ -80,7 +80,7 @@ namespace FoxTube
else else
trendMore.Complete(true); 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); VideoCard vCard = new VideoCard(vid.Id);
recGrid.Add(vCard); recGrid.Add(vCard);
@@ -99,8 +99,6 @@ namespace FoxTube
if(SecretsVault.IsAuthorized) if(SecretsVault.IsAuthorized)
{ {
navigation.Visibility = Visibility.Visible;
//Initializing recommended tab //Initializing recommended tab
StackPanel rs = new StackPanel(); StackPanel rs = new StackPanel();
rs.Children.Add(recGrid); rs.Children.Add(recGrid);
@@ -111,8 +109,8 @@ namespace FoxTube
pivot.Items.Add(new PivotItem() pivot.Items.Add(new PivotItem()
{ {
Margin = new Thickness(0, -48, 0, 0), Content = rg,
Content = rg Header = "Recommended"
}); });
//Initializing trending tab //Initializing trending tab
@@ -125,8 +123,8 @@ namespace FoxTube
pivot.Items.Add(new PivotItem() pivot.Items.Add(new PivotItem()
{ {
Margin = new Thickness(0, -48, 0, 0), Content = tg,
Content = tg Header = "Trending"
}); });
//Initializing subscriptions tab //Initializing subscriptions tab
@@ -139,8 +137,8 @@ namespace FoxTube
pivot.Items.Add(new PivotItem() pivot.Items.Add(new PivotItem()
{ {
Margin = new Thickness(0, -48, 0, 0), Content = g,
Content = g Header = "Subscriptions"
}); });
LoadRecommendations(); LoadRecommendations();
@@ -156,7 +154,6 @@ namespace FoxTube
pivot.Items.Add(new PivotItem() pivot.Items.Add(new PivotItem()
{ {
Margin = new Thickness(0, -48, 0, 0),
Content = tg 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) private void refresh_Click(object sender, RoutedEventArgs e)
{ {
Initialize(); Initialize();
@@ -189,32 +168,24 @@ namespace FoxTube
private void pivot_SelectionChanged(object sender, SelectionChangedEventArgs e) private void pivot_SelectionChanged(object sender, SelectionChangedEventArgs e)
{ {
toRecommended.FontWeight = FontWeights.Normal;
toTrending.FontWeight = FontWeights.Normal;
tosubs.FontWeight = FontWeights.Normal;
switch(pivot.SelectedIndex) switch(pivot.SelectedIndex)
{ {
case 2: case 2:
tosubs.FontWeight = FontWeights.Bold;
if (!subsLoaded) if (!subsLoaded)
LoadSubscriptions(); LoadSubscriptions();
break; break;
case 1: case 1:
toTrending.FontWeight = FontWeights.Bold;
if (!trendLoaded) if (!trendLoaded)
LoadTrending(); LoadTrending();
break; break;
case 0: case 0:
if (pivot.Items.Count > 1) if (pivot.Items.Count > 1)
{ {
toRecommended.FontWeight = FontWeights.Bold;
if (!recLoaded) if (!recLoaded)
LoadRecommendations(); LoadRecommendations();
} }
else else
{ {
toTrending.FontWeight = FontWeights.Bold;
if (!trendLoaded) if (!trendLoaded)
LoadTrending(); LoadTrending();
} }
@@ -236,7 +207,7 @@ namespace FoxTube
else else
trendMore.Complete(true); 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); VideoCard vCard = new VideoCard(vid.Id);
trendGrid.Add(vCard); trendGrid.Add(vCard);
+47 -162
View File
@@ -24,36 +24,58 @@
</VisualState> </VisualState>
</VisualStateGroup> </VisualStateGroup>
</VisualStateManager.VisualStateGroups> </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"> <NavigationView PaneTitle="FoxTube" OpenPaneLength="300" Name="nav" IsPaneOpen="False" SelectionChanged="nav_SelectionChanged">
<Grid Width="50">
<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" <Button Name="notificationMenu" ToolTipService.ToolTip="Notifications" Click="notificationMenu_Click"
FontFamily="Segoe MDL2 Assets" Content="&#xED0D;" Foreground="White" FontFamily="Segoe MDL2 Assets" Content="&#xED0D;"
Width="50" Height="50" Background="Transparent"/> 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" <Button Name="feedback" ToolTipService.ToolTip="Send feedback" Click="feedback_Click"
FontFamily="Segoe MDL2 Assets" Content="&#xED15;" Foreground="White" FontFamily="Segoe MDL2 Assets" Content="&#xED15;"
Width="50" Height="50" Background="Transparent"/> Width="50" Height="50" Background="Transparent"/>
<Button Name="account" ToolTipService.ToolTip="Sign in" <Button Name="account" ToolTipService.ToolTip="Sign in"
FontFamily="Segoe MDL2 Assets" Content="&#xE8FA;" Foreground="White" FontFamily="Segoe MDL2 Assets" Content="&#xE8FA;"
Width="50" Height="50" Background="Transparent"> Width="50" Height="50" Background="Transparent">
<Button.Flyout> <Button.Flyout>
<MenuFlyout> <MenuFlyout>
@@ -64,10 +86,7 @@
</Button> </Button>
<Button Width="50" Background="Transparent" Height="50" Visibility="Visible" Name="avatar" ToolTipService.ToolTip="My account"> <Button Width="50" Background="Transparent" Height="50" Visibility="Visible" Name="avatar" ToolTipService.ToolTip="My account">
<Grid>
<Ellipse Height="30" Fill="White"/>
<PersonPicture Width="30"/> <PersonPicture Width="30"/>
</Grid>
<Button.Flyout> <Button.Flyout>
<MenuFlyout> <MenuFlyout>
<MenuFlyoutItem Text="My channel" Name="myChannel" Click="myChannel_Click"/> <MenuFlyoutItem Text="My channel" Name="myChannel" Click="myChannel_Click"/>
@@ -76,149 +95,15 @@
</MenuFlyout> </MenuFlyout>
</Button.Flyout> </Button.Flyout>
</Button> </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>
</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"/>
</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;"/>
</Grid>
</Grid> </Grid>
</NavigationView.Header>
<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> <Grid>
<Frame Name="content"/> <Frame Name="content"/>
<Frame Name="videoPlaceholder"/> <Frame Name="videoPlaceholder"/>
<Frame Name="popupPlaceholder" Visibility="Collapsed"/>
</Grid> </Grid>
</SplitView.Content>
</SplitView> </NavigationView>
</Grid> </Grid>
</Page> </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. /// An empty page that can be used on its own or navigated to within a Frame.
/// </summary> /// </summary>
public enum RightPaneState { Full, Collapsed, Hidden }
public sealed partial class MainPage : Page public sealed partial class MainPage : Page
{ {
public DownloadAgent Agent = new DownloadAgent(); public DownloadAgent Agent = new DownloadAgent();
RightPaneState paneState = RightPaneState.Full;
bool isForcedCollapsed = false;
ApplicationDataContainer settings = ApplicationData.Current.LocalSettings; ApplicationDataContainer settings = ApplicationData.Current.LocalSettings;
NotificationsCenter notificationsCenter = new NotificationsCenter(); NotificationsCenter notificationsCenter = new NotificationsCenter();
SuggestionsQueries suggestions = new SuggestionsQueries();
public MainPage() public MainPage()
{ {
this.InitializeComponent(); this.InitializeComponent();
@@ -89,8 +83,6 @@ namespace FoxTube
if (settings.Values["defaultDownload"] == null) if (settings.Values["defaultDownload"] == null)
settings.Values.Add("defaultDownload", Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\DownloadedVideos"); settings.Values.Add("defaultDownload", Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\DownloadedVideos");
notificationPane.Child = notificationsCenter;
SecretsVault.AuthorizationStateChanged += Vault_AuthorizationStateChanged; SecretsVault.AuthorizationStateChanged += Vault_AuthorizationStateChanged;
SecretsVault.SubscriptionsChanged += SecretsVault_SubscriptionsChanged; SecretsVault.SubscriptionsChanged += SecretsVault_SubscriptionsChanged;
SecretsVault.CheckAuthorization(); SecretsVault.CheckAuthorization();
@@ -98,27 +90,41 @@ namespace FoxTube
content.Navigate(typeof(Home)); 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) 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; Subscription s = args[1] as Subscription;
StackPanel panel = new StackPanel() { Orientation = Orientation.Horizontal }; StackPanel panel = new StackPanel() { Orientation = Orientation.Horizontal };
panel.Children.Add(new PersonPicture() panel.Children.Add(new PersonPicture()
{ {
Height = 25, Height = 20,
Margin = new Thickness(0, 0, 17, 0), Margin = new Thickness(0, 0, 13, 0),
ProfilePicture = new BitmapImage(new Uri(s.Snippet.Thumbnails.Medium.Url)) ProfilePicture = new BitmapImage(new Uri(s.Snippet.Thumbnails.Medium.Url))
}); });
panel.Children.Add(new TextBlock() panel.Children.Add(new TextBlock() { Text = s.Snippet.Title });
{ nav.MenuItems.Add(new NavigationViewItem() { Content = panel });
VerticalAlignment = VerticalAlignment.Center,
Text = s.Snippet.Title
});
subscriptionsList.Items.Add(new ListBoxItem() { Content = panel });
} }
else if ((string)args[0] == "remove" && (int)args[1] < 10) 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) private async void Vault_AuthorizationStateChanged(object sender, EventArgs e)
@@ -144,7 +150,7 @@ namespace FoxTube
if (SecretsVault.Subscriptions.Count > 0) if (SecretsVault.Subscriptions.Count > 0)
{ {
subscriptionsList.Visibility = Visibility.Visible; subsHeader.Visibility = Visibility.Visible;
int l = SecretsVault.Subscriptions.Count; int l = SecretsVault.Subscriptions.Count;
int n = 10; int n = 10;
for(int k = 0; k < l && k < n; k++) for(int k = 0; k < l && k < n; k++)
@@ -154,18 +160,14 @@ namespace FoxTube
StackPanel panel = new StackPanel() { Orientation = Orientation.Horizontal }; StackPanel panel = new StackPanel() { Orientation = Orientation.Horizontal };
panel.Children.Add(new PersonPicture() panel.Children.Add(new PersonPicture()
{ {
Height = 25, Height = 20,
Margin = new Thickness(0, 0, 17, 0), Margin = new Thickness(0, 0, 13, 0),
ProfilePicture = new BitmapImage(new Uri(s.Snippet.Thumbnails.Medium.Url)) ProfilePicture = new BitmapImage(new Uri(s.Snippet.Thumbnails.Medium.Url))
}); });
panel.Children.Add(new TextBlock() panel.Children.Add(new TextBlock() { Text = s.Snippet.Title });
{ nav.MenuItems.Add(new NavigationViewItem() { Content = panel });
VerticalAlignment = VerticalAlignment.Center,
Text = s.Snippet.Title
});
subscriptionsList.Items.Add(new ListBoxItem() { Content = panel });
} }
catch { n++; } catch { continue; }
} }
} }
else else
@@ -179,9 +181,9 @@ namespace FoxTube
toSubscriptions.Visibility = Visibility.Collapsed; toSubscriptions.Visibility = Visibility.Collapsed;
toChannel.Visibility = Visibility.Collapsed; toChannel.Visibility = Visibility.Collapsed;
subscriptionsList.Visibility = Visibility.Collapsed; subsHeader.Visibility = Visibility.Collapsed;
for(int k = 1; k < subscriptionsList.Items.Count; k++) for(int k = 7; k < nav.MenuItems.Count; k++)
subscriptionsList.Items.RemoveAt(k); nav.MenuItems.RemoveAt(k);
} }
content.CacheSize = 0; content.CacheSize = 0;
@@ -191,36 +193,12 @@ namespace FoxTube
(videoPlaceholder.Content as VideoPage).refresh_Click(this, null); (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() public void GotNotification()
{ {
notificationMenu.Content = ""; notificationMenu.Content = "\xED0C";
} }
void MainListSelected(object sender, SelectionChangedEventArgs e) /*void MainListSelected(object sender, SelectionChangedEventArgs e)
{ {
try try
{ {
@@ -283,12 +261,12 @@ namespace FoxTube
GoToChannel(SecretsVault.Subscriptions[subscriptionsList.SelectedIndex - 1].Snippet.ResourceId.ChannelId); GoToChannel(SecretsVault.Subscriptions[subscriptionsList.SelectedIndex - 1].Snippet.ResourceId.ChannelId);
} }
catch { } catch { }
} }*/
public void notificationMenu_Click(object sender, RoutedEventArgs e) public void notificationMenu_Click(object sender, RoutedEventArgs e)
{ {
notificationMenu.Content = ""; notificationMenu.Content = "\xED0D";
notificationPane.IsOpen = !notificationPane.IsOpen; //notificationPane.IsOpen = !notificationPane.IsOpen;
} }
private void feedback_Click(object sender, RoutedEventArgs e) private void feedback_Click(object sender, RoutedEventArgs e)
@@ -301,20 +279,6 @@ namespace FoxTube
content.Navigate(typeof(Settings), $"feedback&isProblem={isProblem}&meta={meta}"); 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) 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")); 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(); SecretsVault.Deauthenticate();
} }
private void searchField_TextChanged(object sender, TextChangedEventArgs e) public void GoToSearch(string keyword = null)
{ {
if (searchField.Text.Length > 2) if(keyword != null)
suggestions.BuildList(searchField.Text); search.Text = keyword;
else
suggestions.Hide();
}
private void searchField_GotFocus(object sender, RoutedEventArgs e) if (!string.IsNullOrWhiteSpace(search.Text))
{
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 (!(content.Content is Search)) if (!(content.Content is Search))
content.Navigate(typeof(Search), searchField.Text); content.Navigate(typeof(Search), search.Text);
else if ((content.Content as Search).Term != searchField.Text) else if ((content.Content as Search).Term != search.Text)
(content.Content as Search).Initialize(searchField.Text); (content.Content as Search).Initialize(search.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);
} }
} }
@@ -432,16 +321,11 @@ namespace FoxTube
public void GoToVideo(string id) public void GoToVideo(string id)
{ {
menu.DisplayMode = SplitViewDisplayMode.CompactOverlay; nav.IsPaneOpen = false;
menu.IsPaneOpen = false;
isForcedCollapsed = true;
videoPlaceholder.Content = null; videoPlaceholder.Content = null;
videoPlaceholder.Width = double.NaN; MaximizeVideo();
videoPlaceholder.Height = double.NaN; Fullscreen(false);
videoPlaceholder.VerticalAlignment = VerticalAlignment.Stretch;
videoPlaceholder.HorizontalAlignment = HorizontalAlignment.Stretch;
videoPlaceholder.Margin = new Thickness(0);
videoPlaceholder.Navigate(typeof(VideoPage), id); videoPlaceholder.Navigate(typeof(VideoPage), id);
} }
@@ -462,51 +346,11 @@ namespace FoxTube
{ {
if (videoPlaceholder.Content != null) if (videoPlaceholder.Content != null)
(videoPlaceholder.Content as VideoPage).player.UpdateSize(); (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() public void MinimizeAsInitializer()
{ {
try try { (videoPlaceholder.Content as VideoPage).player.minimize_Click(this, null); }
{
(videoPlaceholder.Content as VideoPage).player.minimize_Click(this, null);
}
catch { } catch { }
} }
@@ -532,15 +376,15 @@ namespace FoxTube
{ {
if(on) if(on)
{ {
grid.RowDefinitions[0].Height = new GridLength(0); nav.AlwaysShowHeader = false;
menu.CompactPaneLength = 0; nav.CompactPaneLength = 0;
menu.OpenPaneLength = 0; nav.OpenPaneLength = 0;
} }
else else
{ {
grid.RowDefinitions[0].Height = new GridLength(50); nav.AlwaysShowHeader = true;
menu.CompactPaneLength = 50; nav.CompactPaneLength = 48;
menu.OpenPaneLength = 250; nav.OpenPaneLength = 300;
} }
} }
@@ -554,5 +398,32 @@ namespace FoxTube
videoPlaceholder.Content = null; videoPlaceholder.Content = null;
MaximizeVideo(); 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)
{
}
} }
} }
+17 -67
View File
@@ -10,82 +10,32 @@
mc:Ignorable="d"> mc:Ignorable="d">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid.RowDefinitions> <Pivot SelectedIndex="0" Name="pivot" IsHeaderItemsCarouselEnabled="False">
<RowDefinition Height="47"/> <PivotItem Header="General">
<RowDefinition Height="*"/> <ScrollViewer>
</Grid.RowDefinitions> <settingspages:General/>
<ScrollViewer Grid.Row="1"> </ScrollViewer>
<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>
<PivotItem Name="feedbackHub" Margin="0,-48,0,0"> <PivotItem Header="Leave a feedback">
<ScrollViewer>
<settingspages:Feedback/> <settingspages:Feedback/>
</ScrollViewer>
</PivotItem> </PivotItem>
<PivotItem Margin="0,-48,0,0"> <PivotItem Header="About us">
<ScrollViewer>
<settingspages:About/> <settingspages:About/>
</ScrollViewer>
</PivotItem> </PivotItem>
<PivotItem Margin="0,-48,0,0"> <PivotItem Header="Help us translate this app">
<ScrollViewer>
<settingspages:Translate/> <settingspages:Translate/>
</ScrollViewer>
</PivotItem> </PivotItem>
<PivotItem Margin="0,-48,0,0"> <PivotItem Header="Inbox">
<ScrollViewer>
<settingspages:Inbox/> <settingspages:Inbox/>
</ScrollViewer>
</PivotItem> </PivotItem>
</Pivot> </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>
</Grid> </Grid>
</Page> </Page>
+4 -111
View File
@@ -27,28 +27,9 @@ namespace FoxTube
/// </summary> /// </summary>
public sealed partial class Settings : Page public sealed partial class Settings : Page
{ {
ApplicationDataContainer settings = ApplicationData.Current.LocalSettings;
public Settings() public Settings()
{ {
this.InitializeComponent(); 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) protected override void OnNavigatedTo(NavigationEventArgs e)
@@ -58,7 +39,7 @@ namespace FoxTube
{ {
if((e.Parameter as string).Contains("feedback")) if((e.Parameter as string).Contains("feedback"))
{ {
toFeedback_Click(this, null); pivot.SelectedIndex = 1;
if ((string)e.Parameter != "feedback") 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]); ((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) switch(e.Parameter as string)
{ {
case "about": case "about":
toAbout_Click(this, null); pivot.SelectedIndex = 2;
break; break;
case "translate": case "translate":
toTranslate_Click(this, null); pivot.SelectedIndex = 3;
break; break;
case "inbox": case "inbox":
toInbox_Click(this, null); pivot.SelectedIndex = 4;
break; 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;
}
}
}
+3 -27
View File
@@ -94,31 +94,8 @@
</CommandBar> </CommandBar>
<Grid Grid.Column="1" Name="tabsPlaceholder"> <Grid Grid.Column="1" Name="tabsPlaceholder">
<Grid Name="tabs"> <Pivot Grid.Row="1" Name="pivot" SelectedIndex="0" IsHeaderItemsCarouselEnabled="False">
<Grid.RowDefinitions> <PivotItem Header="Suggestions">
<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> <ScrollViewer>
<StackPanel> <StackPanel>
<ui:AdControl <ui:AdControl
@@ -129,12 +106,11 @@
</StackPanel> </StackPanel>
</ScrollViewer> </ScrollViewer>
</PivotItem> </PivotItem>
<PivotItem Margin="0,-48,0,0" Name="commentsPlaceholder"> <PivotItem Header="Comments" Name="commentsPlaceholder">
<pages:CommentsPage/> <pages:CommentsPage/>
</PivotItem> </PivotItem>
</Pivot> </Pivot>
</Grid> </Grid>
</Grid>
<local:LoadingPage Grid.ColumnSpan="2" Visibility="Collapsed"/> <local:LoadingPage Grid.ColumnSpan="2" Visibility="Collapsed"/>
</Grid> </Grid>
+9 -79
View File
@@ -79,13 +79,12 @@ namespace FoxTube.Pages
pivot.Items.Insert(0, new PivotItem() pivot.Items.Insert(0, new PivotItem()
{ {
Content = descriptionPanel, Content = descriptionPanel,
Margin = new Thickness(0, -48, 0, 0) Header = "Description"
}); });
tabsPlaceholder.Children.Remove(tabs); tabsPlaceholder.Children.Remove(pivot);
mainContent.Children.Add(tabs); mainContent.Children.Add(pivot);
toDescription.Visibility = Visibility.Visible;
grid.ColumnDefinitions[1].Width = new GridLength(0); grid.ColumnDefinitions[1].Width = new GridLength(0);
pivot.SelectedIndex = 0; pivot.SelectedIndex = 0;
@@ -287,17 +286,15 @@ namespace FoxTube.Pages
if (e.NewSize.Width > 1000 && e.PreviousSize.Width <= 1000 && !isExtended) if (e.NewSize.Width > 1000 && e.PreviousSize.Width <= 1000 && !isExtended)
{ {
if (mainContent.Children.Contains(tabs)) if (mainContent.Children.Contains(pivot))
{ {
mainContent.Children.Remove(tabs); mainContent.Children.Remove(pivot);
tabsPlaceholder.Children.Add(tabs); tabsPlaceholder.Children.Add(pivot);
(pivot.Items[0] as PivotItem).Content = null;
pivot.Items.RemoveAt(0); pivot.Items.RemoveAt(0);
mainContent.Children.Add(descriptionPanel); mainContent.Children.Add(descriptionPanel);
} }
toDescription.Visibility = Visibility.Collapsed;
grid.ColumnDefinitions[1].Width = new GridLength(400); grid.ColumnDefinitions[1].Width = new GridLength(400);
} }
else if (e.NewSize.Width <= 1000 & e.PreviousSize.Width > 1000) else if (e.NewSize.Width <= 1000 & e.PreviousSize.Width > 1000)
@@ -308,39 +305,17 @@ namespace FoxTube.Pages
pivot.Items.Insert(0, new PivotItem() pivot.Items.Insert(0, new PivotItem()
{ {
Content = descriptionPanel, Content = descriptionPanel,
Margin = new Thickness(0, -48, 0, 0) Header = "Description"
}); });
tabsPlaceholder.Children.Remove(tabs); tabsPlaceholder.Children.Remove(pivot);
mainContent.Children.Add(tabs); mainContent.Children.Add(pivot);
} }
toDescription.Visibility = Visibility.Visible;
grid.ColumnDefinitions[1].Width = new GridLength(0); grid.ColumnDefinitions[1].Width = new GridLength(0);
} }
pivot.SelectedIndex = 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) private async void Share(DataTransferManager sender, DataRequestedEventArgs args)
@@ -387,51 +362,6 @@ namespace FoxTube.Pages
DataTransferManager.ShowShareUI(); 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) private async void dislike_Click(object sender, RoutedEventArgs e)
{ {
if (SecretsVault.IsAuthorized) if (SecretsVault.IsAuthorized)