Archived
1
0

Dark theme, navigation

This commit is contained in:
Michael Gordeev
2018-08-10 20:50:52 +03:00
parent 6969af84a8
commit b712bfb74e
32 changed files with 359 additions and 418 deletions
+2 -27
View File
@@ -2,33 +2,8 @@
x:Class="FoxTube.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:FoxTube"
RequestedTheme="Light">
xmlns:local="using:FoxTube">
<Application.Resources>
<!--<Style TargetType="ListBoxItem">
<Setter Property="Height" Value="50"/>
</Style>-->
<Style TargetType="TextBlock" x:Key="ItemIcon">
<Setter Property="FontFamily" Value="Segoe MDL2 Assets"/>
<Setter Property="FontSize" Value="16"/>
<Setter Property="Padding" Value="5,4,17,6"/>
</Style>
<Style TargetType="TextBlock" x:Key="MenuItem">
<Setter Property="Margin" Value="5,0,0,0"/>
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
<Style TargetType="ToggleButton" x:Key="hPanel">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToggleButton">
<ToggleButton />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="HyperlinkButton" x:Key="Pivot">
</Style>
<Color x:Key="SystemAccentColor">Red</Color>
</Application.Resources>
</Application>
+16
View File
@@ -8,6 +8,7 @@ using Windows.ApplicationModel.Activation;
using Windows.ApplicationModel.Core;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.Storage;
using Windows.UI.Core;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
@@ -28,8 +29,23 @@ namespace FoxTube
/// Initializes the singleton application object. This is the first line of authored code
/// executed, and as such is the logical equivalent of main() or WinMain().
/// </summary>
ApplicationDataContainer settings = ApplicationData.Current.LocalSettings;
public App()
{
try
{
switch((int)settings.Values["themeMode"])
{
case 0:
RequestedTheme = ApplicationTheme.Light;
break;
case 1:
RequestedTheme = ApplicationTheme.Dark;
break;
case 2:
break;
}
} catch { }
this.InitializeComponent();
this.Suspending += OnSuspending;
}
+2
View File
@@ -6,6 +6,8 @@ using System.Threading.Tasks;
namespace FoxTube
{
public delegate void Event();
public delegate void ObjectEventHandler(object sender, params object[] args);
public class SearchParameters
+18 -1
View File
@@ -35,7 +35,7 @@ namespace FoxTube
public static string AccountId { get; private set; }
public static bool IsAuthorized { get; private set; } = false;
public static Google.Apis.YouTube.v3.Data.Channel UserChannel { get; private set; }
public static Channel UserChannel { get; private set; }
public static List<PlaylistItem> WatchLater { get; private set; } = new List<PlaylistItem>();
public static List<PlaylistItem> UserHistory { get; private set; } = new List<PlaylistItem>();
public static List<Subscription> Subscriptions { get; private set; } = new List<Subscription>();
@@ -180,6 +180,7 @@ namespace FoxTube
if(await Credential.RevokeTokenAsync(CancellationToken.None))
{
Credential = null;
IsAuthorized = false;
AuthorizationStateChanged.Invoke(null, null);
settings.Values["authorized"] = false;
}
@@ -192,5 +193,21 @@ namespace FoxTube
else
Authorize();
}
public static bool AdsDisabled { get; private set; } = true;
public static void CheckAddons()
{
//TO-DO: Check addons list
bool purchased = true;
if(!purchased)
{
AdsDisabled = false;
NotPurchased.Invoke();
}
}
public static event Event NotPurchased;
}
}
+2 -2
View File
@@ -12,7 +12,7 @@
d:DesignWidth="384">
<Button Padding="0" Background="Transparent" Click="Button_Click" VerticalContentAlignment="Stretch" VerticalAlignment="Stretch">
<Grid Background="WhiteSmoke" BorderBrush="LightGray" BorderThickness="1">
<Grid Background="{ThemeResource SystemControlBackgroundChromeMediumBrush}">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition Height="auto"/>
@@ -33,7 +33,7 @@
<ColumnDefinition/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<Ellipse Height="80" Width="80" Margin="0,-45,0,0" VerticalAlignment="Bottom" Fill="WhiteSmoke"/>
<Ellipse Height="80" Width="80" Margin="0,-45,0,0" VerticalAlignment="Bottom" Fill="{ThemeResource SystemControlBackgroundChromeMediumBrush}"/>
<PersonPicture Name="avatar" Grid.Column="0" Height="74" Margin="3,-45,3,3" VerticalAlignment="Bottom" BorderBrush="White" BorderThickness="10"/>
<TextBlock Name="title" Grid.Column="1" Text="[Channel name]" Margin="5" TextWrapping="WrapWholeWords" MaxLines="2"/>
+2 -2
View File
@@ -9,7 +9,7 @@
mc:Ignorable="d"
d:DesignWidth="400">
<Grid Background="WhiteSmoke" Margin="2" Name="grid">
<Grid Background="{ThemeResource AppBarBackgroundThemeBrush}" Margin="2" Name="grid">
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition Height="0"/>
@@ -80,7 +80,7 @@
</Grid>
</Grid>
<TextBox Grid.Row="1" Name="reply" TextChanged="reply_TextChanged" BorderThickness="0" Background="LightGray" AcceptsReturn="True" MaxLength="500"
<TextBox Grid.Row="1" Name="reply" TextChanged="reply_TextChanged" BorderThickness="0" Background="{ThemeResource SystemControlBackgroundChromeMediumLowBrush}" AcceptsReturn="True" MaxLength="500"
Padding="5" Margin="0,0,32,0"
PlaceholderText="Enter your reply..."/>
<Button Grid.Row="1" Name="send" Click="send_Click" IsEnabled="False" HorizontalAlignment="Right" VerticalAlignment="Top"
+1 -1
View File
@@ -10,7 +10,7 @@
d:DesignWidth="1500">
<!--<Button HorizontalAlignment="Stretch" Background="WhiteSmoke" Height="100" Padding="0" HorizontalContentAlignment="Stretch"/>-->
<Grid Background="WhiteSmoke" Height="100">
<Grid Background="{ThemeResource SystemControlBackgroundChromeMediumBrush}" Height="100">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition/>
+2 -2
View File
@@ -13,7 +13,7 @@
d:DesignWidth="384">
<Button Padding="0" Background="Transparent" Click="Button_Click">
<Grid Background="WhiteSmoke" BorderBrush="LightGray" BorderThickness="1">
<Grid Background="{ThemeResource SystemControlBackgroundChromeMediumBrush}">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="75"/>
@@ -38,7 +38,7 @@
<ColumnDefinition Width="60"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Ellipse Grid.Column="0" Height="50" Width="50" Margin="5,-30,5,10" Fill="WhiteSmoke"/>
<Ellipse Grid.Column="0" Height="50" Width="50" Margin="5,-30,5,10" Fill="{ThemeResource SystemControlBackgroundChromeMediumBrush}"/>
<PersonPicture Name="avatar" Grid.Column="0" Height="46" Margin="5,-30,5,0" BorderBrush="White" BorderThickness="10"/>
<TextBlock Name="channelName" Grid.Column="1" Text="[Channel name]" Foreground="Gray" Margin="0,2,0,0" FontSize="12"/>
-2
View File
@@ -17,8 +17,6 @@ using Windows.UI.Xaml.Navigation;
namespace FoxTube.Controls
{
public delegate void Event();
public sealed partial class ShowMore : UserControl
{
public event Event Clicked;
-30
View File
@@ -1,30 +0,0 @@
<UserControl
x:Class="FoxTube.Controls.SuggestionsQueries"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:FoxTube.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="450"
d:DesignWidth="350">
<Grid Background="WhiteSmoke" Name="grid">
<StackPanel Width="350">
<StackPanel Width="350" Name="searchStandby" Visibility="Visible" Margin="10">
<TextBlock Text="Loading results... Please, wait."/>
<ProgressBar IsIndeterminate="True"/>
</StackPanel>
<StackPanel Name="suggestions"/>
<StackPanel>
<StackPanel Orientation="Horizontal" Margin="10,0,10,0">
<TextBlock Foreground="Gray" Text="History"/>
<Line VerticalAlignment="Center" X1="0" X2="500" StrokeThickness="2" Stroke="Gray" Margin="5,0,0,0"/>
</StackPanel>
<StackPanel Name="history">
</StackPanel>
</StackPanel>
</StackPanel>
</Grid>
</UserControl>
-113
View File
@@ -1,113 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using System.Threading.Tasks;
using System.Xml;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.Storage;
using Windows.UI;
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 User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236
namespace FoxTube.Controls
{
public sealed partial class SuggestionsQueries : UserControl
{
ApplicationDataContainer settings = ApplicationData.Current.LocalSettings;
List<string> lastRequests = new List<string>();
public SuggestionsQueries()
{
this.InitializeComponent();
for (int k = 0; k < 5; k++)
if (settings.Values["history" + k] != null)
lastRequests.Add((string)settings.Values["history" + k]);
}
private void Item_Click(object sender, RoutedEventArgs e)
{
string term = (sender as Button).Content as string;
if (!lastRequests.Contains(term))
AddToHistory(term);
Methods.MainPage.GoToSearch(term);
}
public async void BuildList(string keyword)
{
(grid.Children[0] as StackPanel).Visibility = Visibility.Visible;
searchStandby.Visibility = Visibility.Visible;
suggestions.Children.Clear();
foreach(string s in lastRequests)
{
Button item = new Button()
{
HorizontalAlignment = HorizontalAlignment.Stretch,
HorizontalContentAlignment = HorizontalAlignment.Left,
Background = new SolidColorBrush(Colors.Transparent),
Content = s
};
item.Click += Item_Click;
history.Children.Add(item);
}
XmlDocument doc = new XmlDocument();
await Task.Run(() =>
{
doc.Load(string.Format("http://suggestqueries.google.com/complete/search?output=toolbar&hl={0}&q={1}",
(settings.Values["region"] as string)[0] + (settings.Values["region"] as string)[1],
keyword));
});
if(doc["toplevel"].HasChildNodes)
for (int k = 0; k < 5; k++)
try
{
Button item = new Button()
{
HorizontalAlignment = HorizontalAlignment.Stretch,
HorizontalContentAlignment = HorizontalAlignment.Left,
Background = new SolidColorBrush(Colors.Transparent),
Content = doc["toplevel"].ChildNodes[k]["suggestion"].GetAttribute("data")
};
item.Click += Item_Click;
suggestions.Children.Add(item);
} catch { break; }
else
suggestions.Children.Add(new Button()
{
Content = "No suggestions found.",
IsEnabled = false,
Foreground = new SolidColorBrush(Colors.Gray),
Background = new SolidColorBrush(Colors.Transparent)
});
searchStandby.Visibility = Visibility.Collapsed;
}
public void AddToHistory(string keyword)
{
lastRequests.Insert(0, keyword);
if (lastRequests.Count > 5)
lastRequests.RemoveAt(5);
for(int k = 0; k < 5; k++)
try { settings.Values["history" + k] = lastRequests[k]; }
catch { settings.Values.Add("history" + k, lastRequests[k]); }
}
public void Hide()
{
(grid.Children[0] as StackPanel).Visibility = Visibility.Collapsed;
}
}
}
+5 -5
View File
@@ -12,18 +12,18 @@
d:DesignWidth="384">
<Button Padding="0" Background="Transparent" Click="Button_Click">
<Grid Background="WhiteSmoke" BorderBrush="LightGray" BorderThickness="1">
<Grid Background="{ThemeResource SystemControlBackgroundChromeMediumBrush}">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="75"/>
</Grid.RowDefinitions>
<Image Name="thumbnail" Source="/Assets/videoThumbSample.png" Stretch="Fill"/>
<Grid Background="#7FFFFFFF" Name="watched" Visibility="Collapsed">
<StackPanel Margin="5" Background="WhiteSmoke" VerticalAlignment="Top" HorizontalAlignment="Left" Padding="5,2,5,2" BorderBrush="Gray" BorderThickness="1">
<Grid Background="{ThemeResource ButtonBackgroundThemeBrush}" Name="watched" Visibility="Collapsed">
<StackPanel Margin="5" Background="{ThemeResource SystemControlBackgroundChromeMediumBrush}" VerticalAlignment="Top" HorizontalAlignment="Left" Padding="5,2,5,2" BorderBrush="Gray" BorderThickness="1">
<TextBlock Text="Watched" Foreground="Gray" FontSize="12"/>
</StackPanel>
</Grid>
<StackPanel Margin="0,0,5,5" Background="WhiteSmoke" VerticalAlignment="Bottom" HorizontalAlignment="Right" Padding="5,2,5,3">
<StackPanel Margin="0,0,5,5" Background="{ThemeResource SystemControlBackgroundChromeMediumBrush}" VerticalAlignment="Bottom" HorizontalAlignment="Right" Padding="5,2,5,3">
<TextBlock Name="info" Text="[Duration] | [Published at]" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="Gray" FontSize="12"/>
</StackPanel>
<StackPanel Name="liveTag" Margin="0,0,5,30" Background="Red" BorderBrush="White" BorderThickness="1" VerticalAlignment="Bottom" HorizontalAlignment="Right" Padding="5,2,5,3" Orientation="Horizontal" Visibility="Collapsed">
@@ -40,7 +40,7 @@
<ColumnDefinition Width="60"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Ellipse Grid.Column="0" Height="50" Width="50" Margin="5,-30,5,10" Fill="WhiteSmoke"/>
<Ellipse Grid.Column="0" Height="50" Width="50" Margin="5,-30,5,10" Fill="{ThemeResource SystemControlBackgroundChromeMediumBrush}"/>
<PersonPicture Name="avatar" Grid.Column="0" Height="46" Margin="5,-30,5,0" BorderBrush="White" BorderThickness="10"/>
<TextBlock Name="channelName" Grid.Column="1" Text="[Channel name]" Foreground="Gray" Margin="0,2,0,0" FontSize="12"/>
+7 -5
View File
@@ -12,14 +12,15 @@ namespace FoxTube.Controls
{
public sealed partial class VideoCard : UserControl
{
public string playlistId;
public string videoId;
Google.Apis.YouTube.v3.Data.Video item;
Video item;
bool embed = true;
public VideoCard(string id)
public VideoCard(string id, string playlist = null)
{
this.InitializeComponent();
Initialize(id);
Initialize(id, playlist);
}
private void UserControl_SizeChanged(object sender, SizeChangedEventArgs e)
@@ -27,7 +28,7 @@ namespace FoxTube.Controls
Height = e.NewSize.Width * 0.75;
}
public async void Initialize(string id)
public async void Initialize(string id, string playlist = null)
{
YouTubeService ytService = SecretsVault.NoAuthService;
@@ -37,6 +38,7 @@ namespace FoxTube.Controls
item = response.Items[0];
videoId = id;
playlistId = playlist;
title.Text = item.Snippet.Title;
channelName.Text = item.Snippet.ChannelTitle;
@@ -104,7 +106,7 @@ namespace FoxTube.Controls
await dialog.ShowAsync();
}
else
Methods.MainPage.GoToVideo(videoId);
Methods.MainPage.GoToVideo(videoId, playlistId);
}
}
}
-7
View File
@@ -115,9 +115,6 @@
<Compile Include="Controls\ShowMore.xaml.cs">
<DependentUpon>ShowMore.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\SuggestionsQueries.xaml.cs">
<DependentUpon>SuggestionsQueries.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\ChannelPage.xaml.cs">
<DependentUpon>ChannelPage.xaml</DependentUpon>
</Compile>
@@ -298,10 +295,6 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Controls\SuggestionsQueries.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Pages\ChannelPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
+1 -1
View File
@@ -69,7 +69,7 @@ namespace FoxTube.Pages
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
if (e.Parameter == null)
if ((string)e.Parameter == null)
loading.Error("NullReferenceException", "Unable to initialize search. Search term is not stated.");
else
Initialize(e.Parameter as string);
+2 -2
View File
@@ -8,7 +8,7 @@
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid Background="White" Name="grid">
<Grid Name="grid">
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition/>
@@ -30,7 +30,7 @@
<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: " VerticalAlignment="Center" Margin="0,0,5,0"/>
<Button Name="orderBtn" Background="Transparent" Content="Relevance" Foreground="Blue" Padding="0" VerticalAlignment="Center">
<Button Name="orderBtn" Background="Transparent" Content="Relevance" Foreground="Red" Padding="0" VerticalAlignment="Center">
<Button.Flyout>
<MenuFlyout>
+1
View File
@@ -95,6 +95,7 @@ namespace FoxTube
public void Initialize()
{
GC.Collect();
pivot.Items.Clear();
if(SecretsVault.IsAuthorized)
+2 -3
View File
@@ -5,10 +5,9 @@
xmlns:local="using:FoxTube"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="White">
mc:Ignorable="d">
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="White">
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<ProgressRing Name="ring" IsActive="True" Foreground="Red" Width="100" Height="100"/>
<StackPanel Name="wifiTrouble" Visibility="Collapsed" VerticalAlignment="Center">
+28 -37
View File
@@ -6,52 +6,45 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ads="using:Microsoft.Advertising.WinRT.UI"
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
xmlns:pages="using:FoxTube.Pages"
mc:Ignorable="d"
SizeChanged="Page_SizeChanged">
<Grid Name="grid" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup>
<VisualState>
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="600"/>
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="openSearch.Visibility" Value="Collapsed"/>
<Setter Target="compactSearch.Visibility" Value="Visible"/>
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<NavigationView PaneTitle="FoxTube" OpenPaneLength="300" Name="nav" IsPaneOpen="False" SelectionChanged="nav_SelectionChanged">
<NavigationView SelectedItem="toHome" BackRequested="nav_BackRequested" 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="Contact" Content="My channel" Name="toChannel" Visibility="Collapsed"/>
<NavigationViewItem Icon="People" Content="Subscriptions" Name="toSubscriptions" Visibility="Collapsed"/>
<NavigationViewItemHeader Content="My library" Name="libHeader" Visibility="Collapsed"/>
<NavigationViewItem Content="History" Name="toHistory" Visibility="Collapsed">
<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"/>
<NavigationViewItem Icon="Like" Content="Liked videos" Name="toLiked" Visibility="Collapsed"/>
<NavigationViewItem Icon="Clock" Content="Watch later" Name="toLater" Visibility="Collapsed"/>
<NavigationViewItem Icon="Download" Content="Downloads" Name="toDownloads" Visibility="Collapsed"/>
<NavigationViewItemHeader Content="Subscriptions" Name="subsHeader" Visibility="Collapsed"/>
</NavigationView.MenuItems>
<NavigationView.PaneFooter>
<NavigationViewList>
<NavigationViewItem Content="My channel" Icon="Contact" Name="toChannel"/>
<!--<NavigationViewItem>
<StackPanel>
<Button Visibility="Visible" Name="feedback" Click="feedback_Click" Height="40" HorizontalAlignment="Stretch" Background="Transparent" HorizontalContentAlignment="Left">
<StackPanel Orientation="Horizontal">
<PersonPicture Height="20" Margin="-2,0,14,0"/>
<TextBlock Text="My channel"/>
<FontIcon Glyph="&#xED15;" FontSize="16" Margin="6,0,16,0"/>
<TextBlock Text="Give a feedback"/>
</StackPanel>
</NavigationViewItem>-->
<NavigationViewItem Icon="Shop" Content="Remove ads"/>
</NavigationViewList>
</Button>
<Button Visibility="Collapsed" Name="removeAds" Height="40" HorizontalAlignment="Stretch" Background="Transparent" HorizontalContentAlignment="Left">
<StackPanel Orientation="Horizontal">
<FontIcon Glyph="&#xE14D;" FontSize="16" Margin="6,0,16,0"/>
<TextBlock Text="Remove ads"/>
</StackPanel>
</Button>
</StackPanel>
</NavigationView.PaneFooter>
<NavigationView.AutoSuggestBox>
@@ -70,10 +63,6 @@
FontFamily="Segoe MDL2 Assets" Content="&#xED0D;"
Width="50" Height="50" Background="Transparent"/>
<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;"
Width="50" Height="50" Background="Transparent">
@@ -85,7 +74,7 @@
</Button.Flyout>
</Button>
<Button Width="50" Background="Transparent" Height="50" Visibility="Visible" Name="avatar" ToolTipService.ToolTip="My account">
<Button Width="50" Background="Transparent" Height="50" Visibility="Collapsed" Name="avatar" ToolTipService.ToolTip="My account">
<PersonPicture Width="30"/>
<Button.Flyout>
<MenuFlyout>
@@ -100,8 +89,10 @@
</NavigationView.Header>
<Grid>
<Frame Name="content"/>
<Frame Name="videoPlaceholder"/>
<Frame Name="content" Navigated="content_Navigated"/>
<controls:DropShadowPanel Color="Black" BlurRadius="0" ShadowOpacity=".7" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Frame Name="videoPlaceholder"/>
</controls:DropShadowPanel>
</Grid>
</NavigationView>
+138 -108
View File
@@ -38,6 +38,7 @@ using Google.Apis.Oauth2.v2;
using Google.Apis.Oauth2.v2.Data;
using FoxTube.Controls;
using FoxTube.Pages;
using Microsoft.Toolkit.Uwp.UI.Controls;
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409
@@ -72,6 +73,8 @@ namespace FoxTube
settings.Values.Add("moblieWarning", false);
if (settings.Values["videoAutoplay"] == null)
settings.Values.Add("videoAutoplay", false);
if (settings.Values["themeMode"] == null)
settings.Values.Add("themeMode", 2);
if (settings.Values["volume"] == null)
settings.Values.Add("volume", 100);
@@ -86,8 +89,8 @@ namespace FoxTube
SecretsVault.AuthorizationStateChanged += Vault_AuthorizationStateChanged;
SecretsVault.SubscriptionsChanged += SecretsVault_SubscriptionsChanged;
SecretsVault.CheckAuthorization();
if(!SecretsVault.IsAuthorized)
content.Navigate(typeof(Home));
if (!SecretsVault.IsAuthorized)
nav.SelectedItem = toHome;
}
protected override void OnNavigatedTo(NavigationEventArgs e)
@@ -100,6 +103,7 @@ namespace FoxTube
{
var titleBar = ApplicationView.GetForCurrentView().TitleBar;
titleBar.ButtonForegroundColor = Colors.Black;
titleBar.ButtonBackgroundColor = Colors.Transparent;
titleBar.ButtonHoverBackgroundColor = Colors.IndianRed;
titleBar.ButtonPressedBackgroundColor = Colors.DarkRed;
@@ -110,7 +114,7 @@ namespace FoxTube
private void SecretsVault_SubscriptionsChanged(object sender, params object[] args)
{
if ((string)args[0] == "add" && nav.MenuItems.Count < 16)
if ((string)args[0] == "add" && nav.MenuItems.Count < 19)
{
Subscription s = args[1] as Subscription;
StackPanel panel = new StackPanel() { Orientation = Orientation.Horizontal };
@@ -121,10 +125,14 @@ namespace FoxTube
ProfilePicture = new BitmapImage(new Uri(s.Snippet.Thumbnails.Medium.Url))
});
panel.Children.Add(new TextBlock() { Text = s.Snippet.Title });
nav.MenuItems.Add(new NavigationViewItem() { Content = panel });
nav.MenuItems.Add(new NavigationViewItem()
{
Content = panel,
Name = (nav.MenuItems.Count - 9).ToString()
});
}
else if ((string)args[0] == "remove" && (int)args[1] < 10)
nav.MenuItems.RemoveAt((int)args[1]);
nav.MenuItems.RemoveAt((int)args[1] + 9);
}
private async void Vault_AuthorizationStateChanged(object sender, EventArgs e)
@@ -137,23 +145,24 @@ namespace FoxTube
Userinfoplus info = await new Oauth2Service(SecretsVault.Initializer).Userinfo.Get().ExecuteAsync();
ToolTipService.SetToolTip(avatar, new ToolTip() { Content = info.Name });
((avatar.Content as Grid).Children[1] as PersonPicture).ProfilePicture = new BitmapImage(new Uri(info.Picture));
(avatar.Content as PersonPicture).ProfilePicture = new BitmapImage(new Uri(info.Picture));
}
catch { }
avatar.Visibility = Visibility.Visible;
toChannel.Visibility = Visibility.Visible;
toSubscriptions.Visibility = Visibility.Visible;
libHeader.Visibility = Visibility.Visible;
toHistory.Visibility = Visibility.Visible;
toLiked.Visibility = Visibility.Visible;
toLater.Visibility = Visibility.Visible;
toSubscriptions.Visibility = Visibility.Visible;
toChannel.Visibility = Visibility.Visible;
toDownloads.Visibility = Visibility.Visible;
subsHeader.Visibility = Visibility.Visible;
if (SecretsVault.Subscriptions.Count > 0)
{
subsHeader.Visibility = Visibility.Visible;
int l = SecretsVault.Subscriptions.Count;
int n = 10;
for(int k = 0; k < l && k < n; k++)
for(int k = 0; k < SecretsVault.Subscriptions.Count && k < 10; k++)
try
{
Subscription s = SecretsVault.Subscriptions[k];
@@ -165,7 +174,11 @@ namespace FoxTube
ProfilePicture = new BitmapImage(new Uri(s.Snippet.Thumbnails.Medium.Url))
});
panel.Children.Add(new TextBlock() { Text = s.Snippet.Title });
nav.MenuItems.Add(new NavigationViewItem() { Content = panel });
nav.MenuItems.Add(new NavigationViewItem()
{
Content = panel,
Name = k.ToString()
});
}
catch { continue; }
}
@@ -175,22 +188,26 @@ namespace FoxTube
account.Visibility = Visibility.Visible;
avatar.Visibility = Visibility.Collapsed;
toChannel.Visibility = Visibility.Collapsed;
toSubscriptions.Visibility = Visibility.Collapsed;
libHeader.Visibility = Visibility.Collapsed;
toHistory.Visibility = Visibility.Collapsed;
toLiked.Visibility = Visibility.Collapsed;
toLater.Visibility = Visibility.Collapsed;
toSubscriptions.Visibility = Visibility.Collapsed;
toChannel.Visibility = Visibility.Collapsed;
toDownloads.Visibility = Visibility.Collapsed;
subsHeader.Visibility = Visibility.Collapsed;
subsHeader.Visibility = Visibility.Collapsed;
for(int k = 7; k < nav.MenuItems.Count; k++)
for(int k = 9; k < nav.MenuItems.Count; k++)
nav.MenuItems.RemoveAt(k);
}
content.CacheSize = 0;
nav.SelectedItem = toHome;
content.Navigate(typeof(Home));
content.CacheSize = 0;
if (videoPlaceholder.Content != null)
(videoPlaceholder.Content as VideoPage).refresh_Click(this, null);
GoToVideo((videoPlaceholder.Content as VideoPage).videoId);
}
public void GotNotification()
@@ -198,75 +215,9 @@ namespace FoxTube
notificationMenu.Content = "\xED0C";
}
/*void MainListSelected(object sender, SelectionChangedEventArgs e)
{
try
{
if (mainList.SelectedItem == null)
return;
subscriptionsList.SelectedItem = null;
serviceList.SelectedItem = null;
object s = mainList.SelectedItem;
if (s == toHistory)
content.Navigate(typeof(Settings));
else if (s == toLiked)
content.Navigate(typeof(PlaylistPage), SecretsVault.UserChannel.ContentDetails.RelatedPlaylists.Likes);
else if (s == toLater)
content.Navigate(typeof(PlaylistPage), SecretsVault.UserChannel.ContentDetails.RelatedPlaylists.WatchLater);
else if (s == toSubscriptions)
content.Navigate(typeof(Settings));
else if (s == toDownloads)
content.Navigate(typeof(Downloads));
else
content.Navigate(typeof(Home));
}
catch { }
}
void ServiceListSelected(object sender, SelectionChangedEventArgs e)
{
try
{
if (serviceList.SelectedItem == null)
return;
mainList.SelectedItem = null;
subscriptionsList.SelectedItem = null;
object s = serviceList.SelectedItem;
if (s == toChannel)
content.Navigate(typeof(Channel), SecretsVault.AccountId);
else if (s == toRemoveAds)
content.Navigate(typeof(Settings), "adblock");
else
content.Navigate(typeof(Settings));
}
catch { }
}
void SubscriptionSelected(object sender, SelectionChangedEventArgs e)
{
try
{
if (subscriptionsList.SelectedItem == null)
return;
mainList.SelectedItem = null;
serviceList.SelectedItem = null;
GoToChannel(SecretsVault.Subscriptions[subscriptionsList.SelectedIndex - 1].Snippet.ResourceId.ChannelId);
}
catch { }
}*/
public void notificationMenu_Click(object sender, RoutedEventArgs e)
{
notificationMenu.Content = "\xED0D";
//notificationPane.IsOpen = !notificationPane.IsOpen;
}
private void feedback_Click(object sender, RoutedEventArgs e)
@@ -319,7 +270,7 @@ namespace FoxTube
content.Navigate(typeof(ChannelPage), id);
}
public void GoToVideo(string id)
public void GoToVideo(string id, string playlistId = null)
{
nav.IsPaneOpen = false;
@@ -327,7 +278,7 @@ namespace FoxTube
MaximizeVideo();
Fullscreen(false);
videoPlaceholder.Navigate(typeof(VideoPage), id);
videoPlaceholder.Navigate(typeof(VideoPage), new string[2] { id, playlistId });
}
public void GoToDeveloper(string id)
@@ -356,34 +307,45 @@ namespace FoxTube
public void MinimizeVideo()
{
videoPlaceholder.Width = 432;
videoPlaceholder.Height = 243;
videoPlaceholder.VerticalAlignment = VerticalAlignment.Bottom;
videoPlaceholder.HorizontalAlignment = HorizontalAlignment.Right;
videoPlaceholder.Margin = new Thickness(0, 0, 25, 50);
DropShadowPanel ph = videoPlaceholder.Parent as DropShadowPanel;
ph.BlurRadius = 20;
ph.Width = 432;
ph.Height = 243;
ph.VerticalAlignment = VerticalAlignment.Bottom;
ph.HorizontalAlignment = HorizontalAlignment.Right;
ph.Margin = new Thickness(0, 0, 25, 50);
if (content.CanGoBack)
nav.IsBackEnabled = true;
else
nav.IsBackEnabled = false;
}
public void MaximizeVideo()
{
videoPlaceholder.Width = double.NaN;
videoPlaceholder.Height = double.NaN;
videoPlaceholder.VerticalAlignment = VerticalAlignment.Stretch;
videoPlaceholder.HorizontalAlignment = HorizontalAlignment.Stretch;
videoPlaceholder.Margin = new Thickness(0);
DropShadowPanel ph = videoPlaceholder.Parent as DropShadowPanel;
ph.BlurRadius = 0;
ph.Width = double.NaN;
ph.Height = double.NaN;
ph.VerticalAlignment = VerticalAlignment.Stretch;
ph.HorizontalAlignment = HorizontalAlignment.Stretch;
ph.Margin = new Thickness(0);
nav.IsBackEnabled = true;
}
public void Fullscreen(bool on)
{
if(on)
{
nav.AlwaysShowHeader = false;
nav.CompactPaneLength = 0;
nav.OpenPaneLength = 0;
nav.Margin = new Thickness(-48, -93, 0, 0);
nav.OpenPaneLength = 48;
}
else
{
nav.AlwaysShowHeader = true;
nav.CompactPaneLength = 48;
nav.Margin = new Thickness(0);
nav.OpenPaneLength = 300;
}
}
@@ -397,6 +359,11 @@ namespace FoxTube
}
videoPlaceholder.Content = null;
MaximizeVideo();
if (content.CanGoBack)
nav.IsBackEnabled = true;
else
nav.IsBackEnabled = false;
}
private void search_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
@@ -409,21 +376,84 @@ namespace FoxTube
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}");
doc.Load($"http://suggestqueries.google.com/complete/search?output=toolbar&hl={(settings.Values["region"] as string).Remove(2)}&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; }
List<string> suggestions = new List<string>();
for (int i = 0; i < doc["toplevel"].ChildNodes.Count && i < 5; i++)
suggestions.Add(doc["toplevel"].ChildNodes[i]["suggestion"].GetAttribute("data"));
search.ItemsSource = suggestions;
}
}
private void nav_SelectionChanged(NavigationView sender, NavigationViewSelectionChangedEventArgs args)
{
if (args.IsSettingsSelected)
content.Navigate(typeof(Settings));
else
{
if (args.SelectedItem == toHome)
content.Navigate(typeof(Home));
else if (args.SelectedItem == toHistory)
content.Navigate(typeof(Settings));
else if (args.SelectedItem == toLiked)
content.Navigate(typeof(PlaylistPage), SecretsVault.UserChannel.ContentDetails.RelatedPlaylists.Likes);
else if (args.SelectedItem == toLater)
content.Navigate(typeof(PlaylistPage), SecretsVault.UserChannel.ContentDetails.RelatedPlaylists.WatchLater);
else if (args.SelectedItem == toSubscriptions)
content.Navigate(typeof(Settings));
else if (args.SelectedItem == toDownloads)
content.Navigate(typeof(Downloads));
else if (args.SelectedItem == toChannel)
content.Navigate(typeof(Channel), SecretsVault.UserChannel.Id);
else
content.Navigate(typeof(ChannelPage), SecretsVault.Subscriptions[Convert.ToInt32((args.SelectedItem as NavigationViewItem).Name)].Snippet.ResourceId.ChannelId);
}
}
private void content_Navigated(object sender, NavigationEventArgs e)
{
Dictionary<Type, Action> switchCase = new Dictionary<Type, Action>()
{
{ typeof(Settings), () => header.Text = "Settings" },
{ typeof(ChannelPage), () => header.Text = "Channel" },
{ typeof(PlaylistPage), () => header.Text = "Playlist" },
{ typeof(Search), () => header.Text = "Search" },
{ typeof(History), () => header.Text = "History" },
{ typeof(Home), () => header.Text = "Home" },
{ typeof(Downloads), () => header.Text = "Downloads" }
};
switchCase[e.SourcePageType]();
if (content.CanGoBack)
nav.IsBackEnabled = true;
else
nav.IsBackEnabled = false;
if (videoPlaceholder.Content != null && (videoPlaceholder.Parent as DropShadowPanel).HorizontalAlignment == HorizontalAlignment.Stretch)
MinimizeAsInitializer();
}
private void toChannel_Click(object sender, RoutedEventArgs e)
{
nav.SelectedItem = null;
GoToChannel(SecretsVault.UserChannel.Id);
}
private void nav_BackRequested(NavigationView sender, NavigationViewBackRequestedEventArgs args)
{
if (videoPlaceholder.Content != null)
{
DropShadowPanel panel = videoPlaceholder.Parent as DropShadowPanel;
if (panel.HorizontalAlignment == HorizontalAlignment.Stretch)
MinimizeAsInitializer();
else
content.GoBack();
}
else
content.GoBack();
}
}
}
+2 -2
View File
@@ -91,7 +91,7 @@ namespace FoxTube.Pages
list.Clear();
foreach (PlaylistItem i in response.Items)
list.Add(new VideoCard(i.ContentDetails.VideoId));
list.Add(new VideoCard(i.ContentDetails.VideoId, playlistId));
while (response.NextPageToken != null)
{
@@ -99,7 +99,7 @@ namespace FoxTube.Pages
response = await listRequest.ExecuteAsync();
foreach (PlaylistItem i in response.Items)
list.Add(new VideoCard(i.ContentDetails.VideoId));
list.Add(new VideoCard(i.ContentDetails.VideoId, playlistId));
}
loading.Close();
+7 -2
View File
@@ -29,6 +29,7 @@ namespace FoxTube
public sealed partial class Search : Page
{
public string Term;
bool isChannel = false;
SearchResource.ListRequest request;
string nextToken;
ApplicationDataContainer settings = ApplicationData.Current.LocalSettings;
@@ -65,8 +66,11 @@ namespace FoxTube
break;
case "youtube#channel":
ChannelCard cCard = new ChannelCard(result.Id.ChannelId/*, result.Snippet.LiveBroadcastContent*/);
list.Add(cCard);
if(!isChannel)
{
ChannelCard cCard = new ChannelCard(result.Id.ChannelId/*, result.Snippet.LiveBroadcastContent*/);
list.Add(cCard);
}
break;
case "youtube#playlist":
@@ -110,6 +114,7 @@ namespace FoxTube
request = SecretsVault.Service.Search.List("id");
if (!string.IsNullOrWhiteSpace(channelId))
{
isChannel = true;
request.ChannelId = channelId;
(grid.Children[1] as CommandBar).Visibility = Visibility.Collapsed;
}
+1 -1
View File
@@ -10,7 +10,7 @@
mc:Ignorable="d">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Pivot SelectedIndex="0" Name="pivot" IsHeaderItemsCarouselEnabled="False">
<Pivot SelectedIndex="0" Name="pivot" IsHeaderItemsCarouselEnabled="False" SelectionChanged="pivot_SelectionChanged">
<PivotItem Header="General">
<ScrollViewer>
<settingspages:General/>
+10
View File
@@ -27,6 +27,7 @@ namespace FoxTube
/// </summary>
public sealed partial class Settings : Page
{
bool inboxLoaded = false;
public Settings()
{
this.InitializeComponent();
@@ -60,5 +61,14 @@ namespace FoxTube
}
}
}
private void pivot_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (pivot.SelectedIndex == 4 && !inboxLoaded)
{
(((pivot.Items[4] as PivotItem).Content as ScrollViewer).Content as Inbox).LoadItems();
inboxLoaded = true;
}
}
}
}
+9 -9
View File
@@ -37,17 +37,17 @@
<TextBlock TextWrapping="WrapWholeWords" Visibility="Collapsed" Text="Special thanks to contributors for motivating me, testers and translators for making this app better everyday and you for using this app;)" Margin="0,0,0,10"/>
<TextBlock Text="Contacts" FontSize="22" FontWeight="SemiBold"/>
<TextBlock>Twitter: <Hyperlink NavigateUri="https://twitter.com/XFox_Mike" Foreground="Red">@XFox_Mike</Hyperlink></TextBlock>
<TextBlock>Vkontakte: <Hyperlink NavigateUri="https://vk.com/XFox.Mike" Foreground="Red">@XFox.Mike</Hyperlink></TextBlock>
<TextBlock>YouTube: <Hyperlink NavigateUri="https://youtube.com/c/FoxGameStudioChannel" Foreground="Red">@FoxGameStudioChannel</Hyperlink></TextBlock>
<TextBlock>E-mail: <Hyperlink NavigateUri="mailto:michael.xfox@outlook.com" Foreground="Red">michael.xfox@outlook.com</Hyperlink></TextBlock>
<TextBlock Margin="0,0,0,10">My blog (Russian language only): <Hyperlink NavigateUri="https://michael-xfox.com" Foreground="Red">https://michael-xfox.com</Hyperlink></TextBlock>
<TextBlock>Twitter: <Hyperlink NavigateUri="https://twitter.com/XFox_Mike">@XFox_Mike</Hyperlink></TextBlock>
<TextBlock>Vkontakte: <Hyperlink NavigateUri="https://vk.com/XFox.Mike">@XFox.Mike</Hyperlink></TextBlock>
<TextBlock>YouTube: <Hyperlink NavigateUri="https://youtube.com/c/FoxGameStudioChannel">@FoxGameStudioChannel</Hyperlink></TextBlock>
<TextBlock>E-mail: <Hyperlink NavigateUri="mailto:michael.xfox@outlook.com">michael.xfox@outlook.com</Hyperlink></TextBlock>
<TextBlock Margin="0,0,0,10">My blog (Russian language only): <Hyperlink NavigateUri="https://michael-xfox.com">https://michael-xfox.com</Hyperlink></TextBlock>
<TextBlock Text="Legal stuff" FontSize="22" FontWeight="SemiBold"/>
<HyperlinkButton Foreground="Red" Content="Our Privacy Policy" NavigateUri="https://michael-xfox.com/foxtubepp.txt" Padding="0,5,0,0"/>
<HyperlinkButton Foreground="Red" Content="YouTube Privacy Policy" NavigateUri="https://youtube.com/t/privacy" Padding="0"/>
<HyperlinkButton Foreground="Red" Content="YouTube Terms of use" NavigateUri="https://youtube.com/t/terms" Padding="0"/>
<HyperlinkButton Foreground="Red" Content="YouTube Community Guidelines" NavigateUri="https://youtube.com/t/community_guidelines" Padding="0,0,0,10"/>
<HyperlinkButton Content="Our Privacy Policy" NavigateUri="https://michael-xfox.com/foxtubepp.txt" Padding="0,5,0,0"/>
<HyperlinkButton Content="YouTube Privacy Policy" NavigateUri="https://youtube.com/t/privacy" Padding="0"/>
<HyperlinkButton Content="YouTube Terms of use" NavigateUri="https://youtube.com/t/terms" Padding="0"/>
<HyperlinkButton Content="YouTube Community Guidelines" NavigateUri="https://youtube.com/t/community_guidelines" Padding="0,0,0,10"/>
<TextBlock Text="© 2018 Michael Gordeev"/>
<TextBlock Text="© 2018 YouTube, LLC"/>
</StackPanel>
+1 -1
View File
@@ -52,7 +52,7 @@
</StackPanel>
</StackPanel>
<StackPanel Orientation="Horizontal">
<Button Content="Submit feedback" Name="submit" Margin="0,10,10,10" Click="submit_Click" Background="Red" Foreground="White"/>
<Button Content="Submit feedback" Name="submit" Margin="0,10,10,10" Click="submit_Click" Background="{ThemeResource SystemControlForegroundAccentBrush}" Foreground="White"/>
<ProgressRing VerticalAlignment="Center" Name="ring" Foreground="Red"/>
</StackPanel>
</StackPanel>
+6
View File
@@ -39,5 +39,11 @@
<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"/>
<TextBlock Text="Color mode" FontSize="22"/>
<RadioButton Content="Light" Name="light" GroupName="color" Checked="RadioButton_Checked"/>
<RadioButton Content="Dark" Name="dark" GroupName="color" Checked="RadioButton_Checked"/>
<RadioButton Content="Windows default" Name="system" GroupName="color" Checked="RadioButton_Checked"/>
<HyperlinkButton Content="Windows color settings" NavigateUri="ms-settings:colors"/>
</StackPanel>
</Page>
+36 -8
View File
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
@@ -39,6 +40,19 @@ namespace FoxTube.Pages.SettingsPages
safeSearch.SelectedIndex = (int)settings.Values["safeSearch"];
switch((int)settings.Values["themeMode"])
{
case 0:
light.IsChecked = true;
break;
case 1:
dark.IsChecked = true;
break;
case 2:
system.IsChecked = true;
break;
}
foreach (CultureInfo culture in CultureInfo.GetCultures(CultureTypes.AllCultures))
{
region.Items.Add(culture.DisplayName);
@@ -63,14 +77,9 @@ namespace FoxTube.Pages.SettingsPages
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;
settings.Values["newVideoNotification"] = newVideo.IsOn;
settings.Values["moblieWarning"] = mobileWarning.IsOn;
settings.Values["videoAutoplay"] = autoplay.IsOn;
}
private void region_SelectionChanged(object sender, SelectionChangedEventArgs e)
@@ -82,5 +91,24 @@ namespace FoxTube.Pages.SettingsPages
{
settings.Values["safeSearch"] = safeSearch.SelectedIndex;
}
private void RadioButton_Checked(object sender, RoutedEventArgs e)
{
if (sender == light)
{
settings.Values["themeMode"] = 0;
Application.Current.RequestedTheme = ApplicationTheme.Light;
}
if (sender == dark)
{
settings.Values["themeMode"] = 1;
Application.Current.RequestedTheme = ApplicationTheme.Dark;
}
if (sender == system)
{
settings.Values["themeMode"] = 2;
Application.Current.RequestedTheme = ApplicationTheme.;
}
}
}
}
+1 -1
View File
@@ -54,7 +54,7 @@
<ColumnDefinition Width="0"/>
</Grid.ColumnDefinitions>
<ScrollViewer>
<StackPanel VerticalAlignment="Stretch" Background="#FFF2F2F2">
<StackPanel VerticalAlignment="Stretch">
<ComboBox Header="Filter" Margin="10" HorizontalAlignment="Stretch" SelectedIndex="0" Name="filter" SelectionChanged="filter_SelectionChanged">
<ComboBoxItem Content="All"/>
<ComboBoxItem Content="Messages"/>
-29
View File
@@ -11,39 +11,10 @@
mc:Ignorable="d">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup>
<VisualState>
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="728"/>
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="ad.Width" Value="728"/>
<Setter Target="ad.Height" Value="90"/>
</VisualState.Setters>
</VisualState>
<VisualState>
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="640"/>
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="ad.Width" Value="640"/>
<Setter Target="ad.Height" Value="100"/>
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<ui:AdControl VerticalAlignment="Top" Name="ad"
ApplicationId="3f83fe91-d6be-434d-a0ae-7351c5a997f1"
AdUnitId="test"
Height="50"
Width="300"/>
<controls:AdaptiveGridView Name="list" OneRowModeEnabled="False" DesiredWidth="384" SelectionMode="None" Grid.Row="1"/>
<TextBlock Name="empty" Text="&#xD8;" FontSize="200" Foreground="Gray" VerticalAlignment="Center" HorizontalAlignment="Center" Grid.RowSpan="2"/>
</Grid>
+26 -7
View File
@@ -97,18 +97,37 @@
<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>
<StackPanel Name="relatedVideos"/>
</ScrollViewer>
</PivotItem>
<PivotItem Header="Comments" Name="commentsPlaceholder">
<pages:CommentsPage/>
</PivotItem>
<PivotItem Header="Playlist" Name="playlist">
<StackPanel>
<StackPanel Padding="8" Background="WhiteSmoke">
<TextBlock Text="Music" FontSize="26" TextWrapping="WrapWholeWords" Name="playlistName"/>
<TextBlock Text="DAGames" Name="playlistChannel"/>
<TextBlock Text="15/155" Name="playlistCounter"/>
</StackPanel>
<ScrollViewer>
<StackPanel Name="playlistList">
<Button HorizontalAlignment="Stretch" Height="75" HorizontalContentAlignment="Stretch" Background="Transparent">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBlock Text="15" VerticalAlignment="Center" Margin="0,0,8,0"/>
<Image Grid.Column="1" Source="/Assets/videoThumbSample.png"/>
<TextBlock Grid.Column="2" Margin="8,0,0,0" VerticalAlignment="Center" TextWrapping="WrapWholeWords" Text="Title"/>
</Grid>
</Button>
</StackPanel>
</ScrollViewer>
</StackPanel>
</PivotItem>
</Pivot>
</Grid>
+29 -8
View File
@@ -46,7 +46,8 @@ namespace FoxTube.Pages
{
ApplicationDataContainer settings = ApplicationData.Current.LocalSettings;
string videoId;
public string videoId;
string playlistId = null;
Video item;
List<string> downloads = new List<string>();
@@ -99,21 +100,40 @@ namespace FoxTube.Pages
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
if (e.Parameter == null)
if (e.Parameter == null || string.IsNullOrWhiteSpace((e.Parameter as string[])[0]))
loading.Error("NullReferenceException", "Unable to initialize page. Video ID is not stated.");
else
Initialize(e.Parameter as string);
Initialize(e.Parameter as string[]);
}
public async void Initialize(string id)
public async void Initialize(string[] ids)
{
loading.Refresh();
try
{
videoId = id;
videoId = ids[0];
if (ids[1] != null)
{
PlaylistsResource.ListRequest playlistRequest = SecretsVault.Service.Playlists.List("snippet,contentDetails");
playlistRequest.Id = ids[1];
Playlist playlistItem = (await playlistRequest.ExecuteAsync()).Items[0];
playlistName.Text = playlistItem.Snippet.Title;
playlistChannel.Text = playlistItem.Snippet.ChannelTitle;
PlaylistItemsResource.ListRequest listRequest = SecretsVault.Service.PlaylistItems.List("snippet");
listRequest.PlaylistId = ids[1];
PlaylistItemListResponse listResponse = await listRequest.ExecuteAsync();
//Initialize playlist tab
}
else
pivot.Items.Remove(playlist);
VideosResource.ListRequest request = SecretsVault.Service.Videos.List("snippet,statistics,status,contentDetails");
request.Id = id;
request.Id = ids[0];
item = (await request.ExecuteAsync()).Items[0];
title.Text = item.Snippet.Title;
@@ -135,7 +155,7 @@ namespace FoxTube.Pages
if (SecretsVault.IsAuthorized)
{
VideoGetRatingResponse ratingResponse = await SecretsVault.Service.Videos.GetRating(id).ExecuteAsync();
VideoGetRatingResponse ratingResponse = await SecretsVault.Service.Videos.GetRating(ids[0]).ExecuteAsync();
if (ratingResponse.Items[0].Rating == "like")
{
userRating = Rating.Like;
@@ -274,7 +294,7 @@ namespace FoxTube.Pages
public void refresh_Click(object sender, RoutedEventArgs e)
{
player = new VideoPlayer();
Initialize(videoId);
Initialize(new string[2] { videoId, playlistId });
}
private void grid_SizeChanged(object sender, SizeChangedEventArgs e)
@@ -291,6 +311,7 @@ namespace FoxTube.Pages
mainContent.Children.Remove(pivot);
tabsPlaceholder.Children.Add(pivot);
(pivot.Items[0] as PivotItem).Content = null;
pivot.Items.RemoveAt(0);
mainContent.Children.Add(descriptionPanel);
}