Development 1.1
This commit is contained in:
+1
-1
@@ -66,7 +66,7 @@ namespace FoxTube
|
|||||||
// When the navigation stack isn't restored navigate to the first page,
|
// When the navigation stack isn't restored navigate to the first page,
|
||||||
// configuring the new page by passing required information as a navigation
|
// configuring the new page by passing required information as a navigation
|
||||||
// parameter
|
// parameter
|
||||||
rootFrame.Navigate(typeof(SubLayer), e.Arguments);
|
rootFrame.Navigate(typeof(MainPage), e.Arguments);
|
||||||
}
|
}
|
||||||
// Ensure the current window is active
|
// Ensure the current window is active
|
||||||
Window.Current.Activate();
|
Window.Current.Activate();
|
||||||
|
|||||||
@@ -0,0 +1,74 @@
|
|||||||
|
using System;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using Windows.UI;
|
||||||
|
using Windows.UI.Xaml;
|
||||||
|
using Windows.UI.Xaml.Controls;
|
||||||
|
using Windows.UI.Xaml.Documents;
|
||||||
|
using Windows.UI.Xaml.Media;
|
||||||
|
|
||||||
|
namespace FoxTube
|
||||||
|
{
|
||||||
|
class Methods
|
||||||
|
{
|
||||||
|
public static MainPage MainPage
|
||||||
|
{
|
||||||
|
get { return (Window.Current.Content as Frame).Content as MainPage; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string GetAgo(DateTime dateTime)
|
||||||
|
{
|
||||||
|
TimeSpan span = DateTime.Now - dateTime;
|
||||||
|
if (span.TotalMinutes < 1)
|
||||||
|
return "Just now";
|
||||||
|
else if (span.Minutes == 1)
|
||||||
|
return "1 minute ago";
|
||||||
|
else if (span.TotalMinutes > 60)
|
||||||
|
return span.Minutes + " minutes ago";
|
||||||
|
else if (span.Hours == 1)
|
||||||
|
return "1 hour ago";
|
||||||
|
else if (span.TotalHours > 24)
|
||||||
|
return span.Hours + " hours ago";
|
||||||
|
else if (span.Days == 1)
|
||||||
|
return "1 day ago";
|
||||||
|
else if (span.TotalDays > 7)
|
||||||
|
return span.Days + " days ago";
|
||||||
|
else if (span.Days == 7)
|
||||||
|
return "1 week ago";
|
||||||
|
else if (span.Days > 30)
|
||||||
|
return (int)(span.Days / 7) + " weeks ago";
|
||||||
|
else if (span.Days == 30)
|
||||||
|
return "1 month ago";
|
||||||
|
else if (span.Days > 365)
|
||||||
|
return (int)(span.Days / 30) + " months ago";
|
||||||
|
else if (span.Days == 365)
|
||||||
|
return "1 year ago";
|
||||||
|
else
|
||||||
|
return (int)(span.Days / 365) + " years ago";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void FormatText(ref TextBlock block, string text)
|
||||||
|
{
|
||||||
|
block.Inlines.Clear();
|
||||||
|
|
||||||
|
Regex regx = new Regex(@"(http(s)?://[\S]+|www.[\S]+|[\S]+@[\S]+)", RegexOptions.IgnoreCase);
|
||||||
|
Regex isWWW = new Regex(@"(http[s]?://[\S]+|www.[\S]+)");
|
||||||
|
Regex isEmail = new Regex(@"[\S]+@[\S]+");
|
||||||
|
foreach (var item in regx.Split(text))
|
||||||
|
{
|
||||||
|
if (isWWW.IsMatch(item))
|
||||||
|
{
|
||||||
|
Hyperlink link = new Hyperlink { NavigateUri = new Uri(item.ToLower().StartsWith("http") ? item : $"http://{item}"), Foreground = new SolidColorBrush(Colors.Red) };
|
||||||
|
link.Inlines.Add(new Run { Text = item });
|
||||||
|
block.Inlines.Add(link);
|
||||||
|
}
|
||||||
|
else if (isEmail.IsMatch(item))
|
||||||
|
{
|
||||||
|
Hyperlink link = new Hyperlink { NavigateUri = new Uri($"mailto:{item}"), Foreground = new SolidColorBrush(Colors.Red) };
|
||||||
|
link.Inlines.Add(new Run { Text = item });
|
||||||
|
block.Inlines.Add(link);
|
||||||
|
}
|
||||||
|
else block.Inlines.Add(new Run { Text = item });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,135 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Windows.UI.Xaml;
|
||||||
|
using Windows.UI.Xaml.Controls;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using Windows.UI.Xaml.Media;
|
||||||
|
using Windows.UI;
|
||||||
|
using Windows.UI.Xaml.Documents;
|
||||||
|
using System.Net;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
|
using Google.Apis.Auth.OAuth2;
|
||||||
|
using Google.Apis.Auth.OAuth2.Flows;
|
||||||
|
using Google.Apis.Services;
|
||||||
|
using Google.Apis.Util.Store;
|
||||||
|
using Google.Apis.YouTube.v3;
|
||||||
|
using Google.Apis.Auth.OAuth2.Responses;
|
||||||
|
|
||||||
|
namespace FoxTube
|
||||||
|
{
|
||||||
|
public class SecretsVault
|
||||||
|
{
|
||||||
|
#region Static Information
|
||||||
|
public static NetworkCredential EmailCredential { get => new NetworkCredential("youwillneverknowthisadress@gmail.com", "thisisthepassword12345"); }
|
||||||
|
private static string YoutubeApi { get => "AIzaSyBgHrCnrlzlVmk0cJKL8RqP9Y8x6XSuk_0"; }
|
||||||
|
private static string ApplicationName { get => "FoxTube"; }
|
||||||
|
private static ClientSecrets Secrets
|
||||||
|
{
|
||||||
|
get => new ClientSecrets()
|
||||||
|
{
|
||||||
|
ClientId = "349735264870-2ekqlm0a4mkg3mmrfcv90s3qp3o15dq0.apps.googleusercontent.com",
|
||||||
|
ClientSecret = "BkVZOAaCU2Zclf0Zlicg6y2_"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
public static bool IsAuthorized { get => Methods.MainPage.Vault.IsLoged; }
|
||||||
|
|
||||||
|
public static YouTubeService NoAuthService
|
||||||
|
{
|
||||||
|
get => new YouTubeService(new BaseClientService.Initializer()
|
||||||
|
{
|
||||||
|
ApiKey = YoutubeApi,
|
||||||
|
ApplicationName = ApplicationName
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public static YouTubeService Service
|
||||||
|
{
|
||||||
|
get => new YouTubeService(new BaseClientService.Initializer()
|
||||||
|
{
|
||||||
|
HttpClientInitializer = Methods.MainPage.Vault.Credential,
|
||||||
|
ApplicationName = ApplicationName
|
||||||
|
});
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Object containers
|
||||||
|
public bool IsLoged = false;
|
||||||
|
public TokenResponse Token;
|
||||||
|
private UserCredential Credential;
|
||||||
|
public event EventHandler AuthorizationStateChanged;
|
||||||
|
|
||||||
|
public SecretsVault()
|
||||||
|
{
|
||||||
|
CheckAuthorization();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task Authorize()
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
Credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(Secrets, new[] { Google.Apis.Oauth2.v2.Oauth2Service.Scope.UserinfoProfile, YouTubeService.Scope.YoutubeForceSsl }, "user", CancellationToken.None);
|
||||||
|
AuthorizationStateChanged.Invoke(this, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async void CheckAuthorization()
|
||||||
|
{
|
||||||
|
var token = await new AuthorizationCodeFlow(new GoogleAuthorizationCodeFlow.Initializer()
|
||||||
|
{
|
||||||
|
ClientSecrets = Secrets,
|
||||||
|
DataStore = null
|
||||||
|
}).LoadTokenAsync("user", CancellationToken.None);
|
||||||
|
if (token == null)
|
||||||
|
IsLoged = false;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IsLoged = true;
|
||||||
|
Credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(Secrets, new[] { Google.Apis.Oauth2.v2.Oauth2Service.Scope.UserinfoProfile, YouTubeService.Scope.YoutubeForceSsl }, "user", CancellationToken.None);
|
||||||
|
AuthorizationStateChanged.Invoke(this, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region User credentials
|
||||||
|
private List<UserCredential> credentials = new List<UserCredential>(); //Test variable simulating actual credentials storage
|
||||||
|
|
||||||
|
public void AddAccount()
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
credentials.Add(
|
||||||
|
new UserCredential(
|
||||||
|
new AuthorizationCodeFlow(
|
||||||
|
new GoogleAuthorizationCodeFlow.Initializer()
|
||||||
|
{
|
||||||
|
ClientSecrets = Secrets,
|
||||||
|
DataStore = null //TO-DO: Replace with new PasswordsVaultDataStore()
|
||||||
|
}),
|
||||||
|
"userId",
|
||||||
|
new TokenResponse()
|
||||||
|
{
|
||||||
|
AccessToken = "done",
|
||||||
|
ExpiresInSeconds = 1,
|
||||||
|
IdToken = "done",
|
||||||
|
TokenType = "done",
|
||||||
|
RefreshToken = "done",
|
||||||
|
Scope = "youtube"
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DeleteAccount(int index)
|
||||||
|
{
|
||||||
|
credentials.RemoveAt(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
public UserCredential RetrieveAccount(int index)
|
||||||
|
{
|
||||||
|
return credentials[index];
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -59,7 +59,7 @@ namespace FoxTube
|
|||||||
|
|
||||||
private void Button_Click(object sender, RoutedEventArgs e)
|
private void Button_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
SecretsVault.SubLayer.Main.GoToChannel(channelId);
|
Methods.MainPage.GoToChannel(channelId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
<UserControl
|
||||||
|
x:Class="FoxTube.Controls.CommentCard"
|
||||||
|
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"
|
||||||
|
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignWidth="400">
|
||||||
|
|
||||||
|
<Grid Background="WhiteSmoke" Margin="2" Name="grid">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="auto"/>
|
||||||
|
<RowDefinition Height="0"/> <!--32-->
|
||||||
|
<RowDefinition Height="auto"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="60"/>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<PersonPicture Tapped="avatar_Tapped" Name="avatar" Height="50" Margin="5" VerticalAlignment="Top"/>
|
||||||
|
<Grid Grid.Column="1" Margin="5">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="auto"/>
|
||||||
|
<RowDefinition/>
|
||||||
|
<RowDefinition Height="auto"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<TextBlock Name="meta" Foreground="Gray" FontSize="13" Text="[Author's name] | [Published time span] [?](edited)"/>
|
||||||
|
<TextBlock Name="text" IsTextSelectionEnabled="True" TextWrapping="WrapWholeWords" Grid.Row="1" Text="[Content]"/>
|
||||||
|
|
||||||
|
<StackPanel Grid.Row="2" Orientation="Horizontal">
|
||||||
|
<Button Name="upvote" Background="Transparent" Foreground="Gray" Padding="0"
|
||||||
|
VerticalContentAlignment="Center" HorizontalContentAlignment="Center"
|
||||||
|
Height="35" Width="35"
|
||||||
|
FontFamily="Segoe MDL2 Assets" Content="" FontSize="20"/>
|
||||||
|
<TextBlock Name="rating" Foreground="Gray" VerticalAlignment="Center" Text="123"/>
|
||||||
|
|
||||||
|
<Button Visibility="Collapsed" Name="downvote" Background="Transparent" Foreground="Gray" Padding="0"
|
||||||
|
VerticalContentAlignment="Center" HorizontalContentAlignment="Center"
|
||||||
|
Height="35" Width="35"
|
||||||
|
FontFamily="Segoe MDL2 Assets" Content="" FontSize="20"/>
|
||||||
|
|
||||||
|
<Button Click="showReplies_Click" Name="showReplies" Background="Transparent" Foreground="Gray" Padding="0" Margin="10,0,0,0"
|
||||||
|
VerticalContentAlignment="Center" HorizontalContentAlignment="Center"
|
||||||
|
Height="35">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<TextBlock FontFamily="Segoe MDL2 Assets" Text="" Margin="0,0,5,0" FontSize="20"/>
|
||||||
|
<TextBlock Text="123"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<Button Click="replyBtn_Click" Name="replyBtn" Background="Transparent" Foreground="Gray" Padding="0" Margin="10,0,0,0"
|
||||||
|
VerticalContentAlignment="Center" HorizontalContentAlignment="Center"
|
||||||
|
Height="35">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<TextBlock FontFamily="Segoe MDL2 Assets" Text="" FontSize="20"/>
|
||||||
|
<TextBlock Text="Reply"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Button>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<TextBox Grid.Row="1" BorderThickness="0" Background="LightGray"
|
||||||
|
Padding="5" Margin="0,0,32,0"
|
||||||
|
PlaceholderText="Enter your reply..."/>
|
||||||
|
<Button Grid.Row="1" HorizontalAlignment="Right"
|
||||||
|
VerticalContentAlignment="Center" HorizontalContentAlignment="Center"
|
||||||
|
Width="32" Height="32" Padding="0"
|
||||||
|
Background="Red" Foreground="White"
|
||||||
|
FontFamily="Segoe MDL2 Assets"
|
||||||
|
Content="" />
|
||||||
|
|
||||||
|
<StackPanel Grid.Row="2">
|
||||||
|
<StackPanel Margin="60,0,0,0" Name="replies"/>
|
||||||
|
<HyperlinkButton Visibility="Collapsed" HorizontalAlignment="Center" Name="more" Click="more_Click" Foreground="Red" Content="Show more replies"/>
|
||||||
|
<ProgressBar IsIndeterminate="True" Foreground="Red" Name="moreLoading" Visibility="Collapsed"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
@@ -0,0 +1,159 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Runtime.InteropServices.WindowsRuntime;
|
||||||
|
using Windows.Foundation;
|
||||||
|
using Windows.Foundation.Collections;
|
||||||
|
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;
|
||||||
|
|
||||||
|
using Google.Apis.YouTube.v3;
|
||||||
|
using Google.Apis.YouTube.v3.Data;
|
||||||
|
using Windows.UI.Xaml.Media.Imaging;
|
||||||
|
using Windows.System;
|
||||||
|
|
||||||
|
// The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236
|
||||||
|
|
||||||
|
namespace FoxTube.Controls
|
||||||
|
{
|
||||||
|
public sealed partial class CommentCard : UserControl
|
||||||
|
{
|
||||||
|
Comment item;
|
||||||
|
string NextPageToken;
|
||||||
|
|
||||||
|
public CommentCard(CommentThread comment)
|
||||||
|
{
|
||||||
|
this.InitializeComponent();
|
||||||
|
Initialize(comment);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async void Initialize(CommentThread comment)
|
||||||
|
{
|
||||||
|
item = comment.Snippet.TopLevelComment;
|
||||||
|
|
||||||
|
replyBtn.Visibility = comment.Snippet.CanReply == true ? Visibility.Visible : Visibility.Collapsed;
|
||||||
|
if (!comment.Snippet.TotalReplyCount.HasValue || comment.Snippet.TotalReplyCount.Value == 0)
|
||||||
|
showReplies.Visibility = Visibility.Collapsed;
|
||||||
|
else
|
||||||
|
((showReplies.Content as StackPanel).Children[1] as TextBlock).Text = comment.Snippet.TotalReplyCount.ToString();
|
||||||
|
if (comment.Snippet.TopLevelComment.Snippet.CanRate == false)
|
||||||
|
{
|
||||||
|
upvote.Visibility = Visibility.Collapsed;
|
||||||
|
downvote.Visibility = Visibility.Collapsed;
|
||||||
|
rating.Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
rating.Text = comment.Snippet.TopLevelComment.Snippet.LikeCount.HasValue ? comment.Snippet.TopLevelComment.Snippet.LikeCount.ToString() : "";
|
||||||
|
|
||||||
|
meta.Text = string.Format("{0} | {1} {2}", comment.Snippet.TopLevelComment.Snippet.AuthorDisplayName, Methods.GetAgo(comment.Snippet.TopLevelComment.Snippet.PublishedAt.Value), comment.Snippet.TopLevelComment.Snippet.UpdatedAt != comment.Snippet.TopLevelComment.Snippet.PublishedAt ? "(edited)" : "");
|
||||||
|
Methods.FormatText(ref text, comment.Snippet.TopLevelComment.Snippet.TextDisplay);
|
||||||
|
|
||||||
|
try { avatar.ProfilePicture = new BitmapImage(new Uri(comment.Snippet.TopLevelComment.Snippet.AuthorProfileImageUrl)); }
|
||||||
|
catch { }
|
||||||
|
|
||||||
|
if (comment.Replies != null && comment.Replies.Comments.Count > 0)
|
||||||
|
{
|
||||||
|
if (comment.Replies.Comments.Count <= 5)
|
||||||
|
foreach (Comment reply in comment.Replies.Comments)
|
||||||
|
replies.Children.Add(new CommentCard(reply));
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var request = SecretsVault.NoAuthService.Comments.List("snippet");
|
||||||
|
request.ParentId = item.Id;
|
||||||
|
var response = await request.ExecuteAsync();
|
||||||
|
|
||||||
|
if(response.NextPageToken != null)
|
||||||
|
{
|
||||||
|
NextPageToken = response.NextPageToken;
|
||||||
|
more.Visibility = Visibility.Visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (Comment c in response.Items)
|
||||||
|
replies.Children.Add(new CommentCard(c));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public CommentCard(Comment comment)
|
||||||
|
{
|
||||||
|
this.InitializeComponent();
|
||||||
|
Initialize(comment);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Initialize(Comment comment)
|
||||||
|
{
|
||||||
|
item = comment;
|
||||||
|
|
||||||
|
replyBtn.Visibility = Visibility.Collapsed;
|
||||||
|
showReplies.Visibility = Visibility.Collapsed;
|
||||||
|
downvote.Visibility = Visibility.Collapsed;
|
||||||
|
|
||||||
|
if (comment.Snippet.CanRate == false)
|
||||||
|
{
|
||||||
|
upvote.Visibility = Visibility.Collapsed;
|
||||||
|
rating.Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
rating.Text = comment.Snippet.LikeCount.HasValue ? comment.Snippet.LikeCount.ToString() : "";
|
||||||
|
|
||||||
|
meta.Text = string.Format("{0} | {1} {2}", comment.Snippet.AuthorDisplayName, Methods.GetAgo(comment.Snippet.PublishedAt.Value), comment.Snippet.UpdatedAt.HasValue ? "(edited)" : "");
|
||||||
|
text.Text = comment.Snippet.TextDisplay;
|
||||||
|
|
||||||
|
try { avatar.ProfilePicture = new BitmapImage(new Uri(comment.Snippet.AuthorProfileImageUrl)); }
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
|
|
||||||
|
private void replyBtn_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (grid.RowDefinitions[1].Height == new GridLength(0))
|
||||||
|
grid.RowDefinitions[1].Height = GridLength.Auto;
|
||||||
|
else
|
||||||
|
grid.RowDefinitions[1].Height = new GridLength(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showReplies_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (grid.RowDefinitions[2].Height == new GridLength(0))
|
||||||
|
grid.RowDefinitions[2].Height = GridLength.Auto;
|
||||||
|
else
|
||||||
|
grid.RowDefinitions[2].Height = new GridLength(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void avatar_Tapped(object sender, TappedRoutedEventArgs e)
|
||||||
|
{
|
||||||
|
Methods.MainPage.GoToChannel(item.Snippet.AuthorChannelId.ToString().Split('"')[3]);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void text_LinkClicked(object sender, Microsoft.Toolkit.Uwp.UI.Controls.LinkClickedEventArgs e)
|
||||||
|
{
|
||||||
|
await Launcher.LaunchUriAsync(new Uri(e.Link));
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void more_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
more.Visibility = Visibility.Collapsed;
|
||||||
|
moreLoading.Visibility = Visibility.Visible;
|
||||||
|
|
||||||
|
var request = SecretsVault.NoAuthService.Comments.List("snippet");
|
||||||
|
request.ParentId = item.Id;
|
||||||
|
request.PageToken = NextPageToken;
|
||||||
|
var response = await request.ExecuteAsync();
|
||||||
|
|
||||||
|
foreach (Comment c in response.Items)
|
||||||
|
replies.Children.Add(new CommentCard(c));
|
||||||
|
|
||||||
|
if (response.NextPageToken != null)
|
||||||
|
{
|
||||||
|
NextPageToken = response.NextPageToken;
|
||||||
|
more.Visibility = Visibility.Visible;
|
||||||
|
}
|
||||||
|
moreLoading.Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
<UserControl
|
||||||
|
x:Class="FoxTube.NotificationsCenter"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
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"
|
||||||
|
d:DesignHeight="450"
|
||||||
|
d:DesignWidth="350">
|
||||||
|
|
||||||
|
|
||||||
|
<StackPanel Background="WhiteSmoke" Padding="0,10,0,0">
|
||||||
|
<Grid>
|
||||||
|
<TextBlock Text="Notifications" HorizontalAlignment="Center" VerticalAlignment="Center" FontWeight="Bold"/>
|
||||||
|
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
|
||||||
|
<Button Visibility="Collapsed" Background="Transparent" Foreground="Gray" FontFamily="Segoe MDL2 Assets" Content="" Height="50" Width="50" ToolTipService.ToolTip="Clear all" Name="clear" Click="clear_Click"/>
|
||||||
|
<Button Background="Transparent" Foreground="Gray" FontFamily="Segoe MDL2 Assets" Content="" Height="50" Width="50" ToolTipService.ToolTip="Close" Name="close" Click="close_Click"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
<TextBlock Text="You have no any notification" Name="noNotifications" Foreground="Gray" FontStyle="Italic" Padding="10" Visibility="Visible"/>
|
||||||
|
<ScrollViewer>
|
||||||
|
<StackPanel Name="array"/>
|
||||||
|
</ScrollViewer>
|
||||||
|
</StackPanel>
|
||||||
|
</UserControl>
|
||||||
@@ -0,0 +1,161 @@
|
|||||||
|
using Microsoft.Toolkit.Uwp.Notifications;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Runtime.InteropServices.WindowsRuntime;
|
||||||
|
using Windows.Foundation;
|
||||||
|
using Windows.Foundation.Collections;
|
||||||
|
using Windows.UI;
|
||||||
|
using Windows.UI.Notifications;
|
||||||
|
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
|
||||||
|
{
|
||||||
|
public sealed partial class NotificationsCenter : UserControl
|
||||||
|
{
|
||||||
|
List<Notification> notifications = new List<Notification>();
|
||||||
|
|
||||||
|
public NotificationsCenter()
|
||||||
|
{
|
||||||
|
this.InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void clear_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
array.Children.Clear();
|
||||||
|
notifications.Clear();
|
||||||
|
clear.Visibility = Visibility.Collapsed;
|
||||||
|
noNotifications.Visibility = Visibility.Visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void close_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
Methods.MainPage.ClosePopups();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void AddNotification(Notification notification, bool needNotify = true)
|
||||||
|
{
|
||||||
|
notifications.Add(notification);
|
||||||
|
Methods.MainPage.GotNotification();
|
||||||
|
noNotifications.Visibility = Visibility.Collapsed;
|
||||||
|
clear.Visibility = Visibility.Visible;
|
||||||
|
|
||||||
|
StackPanel stackPanel = new StackPanel() { Margin = new Thickness(10, 0, 0, 0) };
|
||||||
|
//Channel
|
||||||
|
stackPanel.Children.Add(new TextBlock()
|
||||||
|
{
|
||||||
|
FontSize = 14,
|
||||||
|
FontStyle = Windows.UI.Text.FontStyle.Italic,
|
||||||
|
Foreground = new SolidColorBrush(Colors.Gray),
|
||||||
|
Text = notification.Header
|
||||||
|
});
|
||||||
|
//Content
|
||||||
|
stackPanel.Children.Add(new TextBlock()
|
||||||
|
{
|
||||||
|
TextWrapping = TextWrapping.WrapWholeWords,
|
||||||
|
Text = notification.message,
|
||||||
|
});
|
||||||
|
//Time
|
||||||
|
stackPanel.Children.Add(new TextBlock()
|
||||||
|
{
|
||||||
|
FontSize = 13,
|
||||||
|
Foreground = new SolidColorBrush(Colors.Gray),
|
||||||
|
Text = notification.returnTimecode()
|
||||||
|
});
|
||||||
|
PersonPicture avatar = new PersonPicture()
|
||||||
|
{
|
||||||
|
Height = 50,
|
||||||
|
VerticalAlignment = VerticalAlignment.Top
|
||||||
|
};
|
||||||
|
|
||||||
|
Grid grid = new Grid();
|
||||||
|
grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(50) });
|
||||||
|
grid.ColumnDefinitions.Add(new ColumnDefinition());
|
||||||
|
|
||||||
|
grid.Children.Add(avatar);
|
||||||
|
Grid.SetColumn(stackPanel, 1);
|
||||||
|
grid.Children.Add(stackPanel);
|
||||||
|
|
||||||
|
Button item = new Button()
|
||||||
|
{
|
||||||
|
HorizontalAlignment = HorizontalAlignment.Stretch,
|
||||||
|
HorizontalContentAlignment = HorizontalAlignment.Left,
|
||||||
|
Background = new SolidColorBrush(Colors.Transparent),
|
||||||
|
Content = grid
|
||||||
|
};
|
||||||
|
item.Click += Notification_Click;
|
||||||
|
|
||||||
|
array.Children.Add(item);
|
||||||
|
|
||||||
|
//Sending notification
|
||||||
|
if (needNotify)
|
||||||
|
{
|
||||||
|
if (notification.Type == NotificationType.Update)
|
||||||
|
{
|
||||||
|
ToastContent toast = new ToastContent()
|
||||||
|
{
|
||||||
|
Visual = new ToastVisual()
|
||||||
|
{
|
||||||
|
BindingGeneric = new ToastBindingGeneric()
|
||||||
|
{
|
||||||
|
Children =
|
||||||
|
{
|
||||||
|
new AdaptiveText()
|
||||||
|
{
|
||||||
|
Text = notification.Header,
|
||||||
|
HintMaxLines = 2
|
||||||
|
},
|
||||||
|
new AdaptiveText()
|
||||||
|
{
|
||||||
|
Text = notification.message
|
||||||
|
}
|
||||||
|
},
|
||||||
|
HeroImage = new ToastGenericHeroImage()
|
||||||
|
{
|
||||||
|
Source = notification.Thumbnail
|
||||||
|
},
|
||||||
|
AppLogoOverride = new ToastGenericAppLogo()
|
||||||
|
{
|
||||||
|
Source = notification.Avatar,
|
||||||
|
HintCrop = ToastGenericAppLogoCrop.Circle
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Actions = new ToastActionsCustom()
|
||||||
|
{
|
||||||
|
Buttons =
|
||||||
|
{
|
||||||
|
new ToastButton("View full post", "action=viewupdatenotification")
|
||||||
|
{
|
||||||
|
ActivationType = ToastActivationType.Foreground
|
||||||
|
},
|
||||||
|
new ToastButton("Manage notifications", "action=notificationsettings")
|
||||||
|
{
|
||||||
|
ActivationType = ToastActivationType.Foreground
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Launch = "action=viewupdatenotification"
|
||||||
|
};
|
||||||
|
ToastNotificationManager.CreateToastNotifier().Show(new ToastNotification(toast.GetXml()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Notification_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
Debug.WriteLine("Cliked notification index" + ((sender as Button).Parent as StackPanel).Children.IndexOf(sender as Button));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -13,14 +13,13 @@
|
|||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Image Name="thumbnail" Source="Assets/videoThumbSample.png"/>
|
<Image Name="thumbnail" Source="Assets/videoThumbSample.png"/>
|
||||||
<!--<Image Source="https://i.ytimg.com/vi/XZQQcYnkumA/mqdefault.jpg"/>-->
|
|
||||||
<Grid HorizontalAlignment="Right" Width="100">
|
<Grid HorizontalAlignment="Right" Width="100">
|
||||||
<Grid.Background>
|
<Grid.Background>
|
||||||
<AcrylicBrush TintColor="#7F000000" BackgroundSource="Backdrop" AlwaysUseFallback="False" TintOpacity="1" Opacity="0.97"/>
|
<AcrylicBrush TintColor="#7F000000" BackgroundSource="Backdrop" AlwaysUseFallback="False" TintOpacity="1" Opacity="0.97"/>
|
||||||
</Grid.Background>
|
</Grid.Background>
|
||||||
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
|
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
|
||||||
<TextBlock HorizontalAlignment="Center" FontFamily="Segoe MDL2 Assets" Foreground="White" Text="" FontSize="30"/>
|
<TextBlock HorizontalAlignment="Center" FontFamily="Segoe MDL2 Assets" Foreground="White" Text="" FontSize="30"/>
|
||||||
<TextBlock Foreground="White" Text="30" HorizontalAlignment="Center" FontSize="20" Name="thumbCount"/>
|
<TextBlock Foreground="White" Text="[N/A]" HorizontalAlignment="Center" FontSize="20" Name="thumbCount"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
@@ -30,8 +29,8 @@
|
|||||||
<RowDefinition Height="75"/>
|
<RowDefinition Height="75"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<StackPanel Orientation="Vertical">
|
<StackPanel Orientation="Vertical">
|
||||||
<TextBlock Name="title" TextWrapping="WrapWholeWords" Text="Subnautica - SAY GOODBYE TO SUBNAUTICA! We're Back Home! - Subnautica Ending (Full Release Gameplay)" FontSize="20" MaxLines="2"/>
|
<TextBlock Name="title" TextWrapping="WrapWholeWords" Text="[Title]" FontSize="20" MaxLines="2"/>
|
||||||
<TextBlock Name="info" Text="09-May-18 18:31 | 30 videos" Foreground="Gray"/>
|
<TextBlock Name="info" Text="[Published at] | [Video count]" Foreground="Gray"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<Grid Grid.Row="1" Name="authorData">
|
<Grid Grid.Row="1" Name="authorData">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
@@ -40,8 +39,8 @@
|
|||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<PersonPicture Name="avatar" Width="75" HorizontalAlignment="Left"/>
|
<PersonPicture Name="avatar" Width="75" HorizontalAlignment="Left"/>
|
||||||
<StackPanel Orientation="Vertical" Grid.Column="1" Padding="10,5,5,5" VerticalAlignment="Center">
|
<StackPanel Orientation="Vertical" Grid.Column="1" Padding="10,5,5,5" VerticalAlignment="Center">
|
||||||
<TextBlock Name="channelName" Text="IGP" FontSize="18"/>
|
<TextBlock Name="channelName" Text="[Channel name]" FontSize="18"/>
|
||||||
<TextBlock Name="channelSubs" Text="120,452 subscribers" Foreground="Gray"/>
|
<TextBlock Name="channelSubs" Text="[Subscribers]" Foreground="Gray"/>
|
||||||
<HyperlinkButton Name="channelLink" Content="Go to channel" Padding="0" Click="channelLink_Click"/>
|
<HyperlinkButton Name="channelLink" Content="Go to channel" Padding="0" Click="channelLink_Click"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
@@ -37,7 +37,7 @@ namespace FoxTube
|
|||||||
|
|
||||||
public async void Initialize(string id, bool hideAuthor)
|
public async void Initialize(string id, bool hideAuthor)
|
||||||
{
|
{
|
||||||
PlaylistsResource.ListRequest request = SecretsVault.YoutubeService.Playlists.List("snippet,contentDetails");
|
PlaylistsResource.ListRequest request = SecretsVault.NoAuthService.Playlists.List("snippet,contentDetails");
|
||||||
request.Id = id;
|
request.Id = id;
|
||||||
PlaylistListResponse response = await request.ExecuteAsync();
|
PlaylistListResponse response = await request.ExecuteAsync();
|
||||||
|
|
||||||
@@ -54,7 +54,7 @@ namespace FoxTube
|
|||||||
authorData.Visibility = Visibility.Collapsed;
|
authorData.Visibility = Visibility.Collapsed;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var request1 = SecretsVault.YoutubeService.Channels.List("snippet,contentDetails,statistics");
|
var request1 = SecretsVault.NoAuthService.Channels.List("snippet,contentDetails,statistics");
|
||||||
request1.Id = item.Snippet.ChannelId;
|
request1.Id = item.Snippet.ChannelId;
|
||||||
ChannelListResponse response1 = await request1.ExecuteAsync();
|
ChannelListResponse response1 = await request1.ExecuteAsync();
|
||||||
|
|
||||||
@@ -63,13 +63,12 @@ namespace FoxTube
|
|||||||
avatar.ProfilePicture = new BitmapImage(new Uri(item1.Snippet.Thumbnails.Medium.Url));
|
avatar.ProfilePicture = new BitmapImage(new Uri(item1.Snippet.Thumbnails.Medium.Url));
|
||||||
channelName.Text = item1.Snippet.Title;
|
channelName.Text = item1.Snippet.Title;
|
||||||
channelSubs.Text = string.Format("{0} subscribers", item1.Statistics.SubscriberCount);
|
channelSubs.Text = string.Format("{0} subscribers", item1.Statistics.SubscriberCount);
|
||||||
channelLink.NavigateUri = new Uri("https://www.youtube.com/channel/" + item.Snippet.ChannelId);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void channelLink_Click(object sender, RoutedEventArgs e)
|
private void channelLink_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
((Window.Current.Content as Frame).Content as MainPage).GoToChannel(item.Snippet.ChannelId);
|
Methods.MainPage.GoToChannel(item.Snippet.ChannelId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -21,19 +21,13 @@
|
|||||||
<Grid Grid.Row="0" Background="Black">
|
<Grid Grid.Row="0" Background="Black">
|
||||||
<Image Name="thumbnail" Source="Assets/videoThumbSample.png" Stretch="Fill"/>
|
<Image Name="thumbnail" Source="Assets/videoThumbSample.png" Stretch="Fill"/>
|
||||||
<StackPanel Margin="0,0,5,5" Background="WhiteSmoke" VerticalAlignment="Bottom" HorizontalAlignment="Right" Padding="5,2,5,0" Height="20">
|
<StackPanel Margin="0,0,5,5" Background="WhiteSmoke" VerticalAlignment="Bottom" HorizontalAlignment="Right" Padding="5,2,5,0" Height="20">
|
||||||
<TextBlock Name="info" Text="1:00:00 | 59 minute ago" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="Gray" FontSize="12"/>
|
<TextBlock Name="info" Text="[Duration] | [Published at]" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="Gray" FontSize="12"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel Name="liveTag" Margin="0,0,5,30" Background="Red" BorderBrush="White" BorderThickness="1" VerticalAlignment="Bottom" HorizontalAlignment="Right" Padding="5,0,5,0" Height="20" Orientation="Horizontal" Visibility="Collapsed">
|
<StackPanel Name="liveTag" Margin="0,0,5,30" Background="Red" BorderBrush="White" BorderThickness="1" VerticalAlignment="Bottom" HorizontalAlignment="Right" Padding="5,0,5,0" Height="20" Orientation="Horizontal" Visibility="Collapsed">
|
||||||
<TextBlock Text=" " VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="White" FontSize="12" FontFamily="Segoe MDL2 Assets" Margin="0,1,0,0" FontWeight="Black"/>
|
<TextBlock Text=" " VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="White" FontSize="12" FontFamily="Segoe MDL2 Assets" Margin="0,1,0,0" FontWeight="Black"/>
|
||||||
<TextBlock Text="LIVE" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="White" FontSize="12" FontWeight="Bold"/>
|
<TextBlock Name="liveContent" Text="LIVE" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="White" FontSize="12" FontWeight="Bold"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
<!--<StackPanel Grid.Row="0" Background="Red">
|
|
||||||
<Image Source="https://i.ytimg.com/vi/f8iOcZ43YT0/hqdefault.jpg"/>
|
|
||||||
<StackPanel Margin="0,0,2,0" Background="WhiteSmoke" HorizontalAlignment="Right" Padding="5,0,3,0" Height="20">
|
|
||||||
<TextBlock Text="1:00:00" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="Gray" Margin="0,2,2,0" FontSize="12"/>
|
|
||||||
</StackPanel>
|
|
||||||
</StackPanel>-->
|
|
||||||
<Grid Grid.Row="1">
|
<Grid Grid.Row="1">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="2*"/>
|
<RowDefinition Height="2*"/>
|
||||||
@@ -42,17 +36,16 @@
|
|||||||
<Grid Grid.Row="0">
|
<Grid Grid.Row="0">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="60"/>
|
<ColumnDefinition Width="60"/>
|
||||||
<ColumnDefinition Width="2*"/>
|
|
||||||
<ColumnDefinition Width="*"/>
|
<ColumnDefinition Width="*"/>
|
||||||
</Grid.ColumnDefinitions>
|
</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="WhiteSmoke"/>
|
||||||
<PersonPicture Name="avatar" Grid.Column="0" Height="46" Margin="5,-30,5,0" BorderBrush="White" BorderThickness="10" ProfilePicture="https://yt3.ggpht.com/-UOhOJaAitUc/AAAAAAAAAAI/AAAAAAAAAAA/z3WPfWpVuZw/s88-c-k-no-mo-rj-c0xffffff/photo.jpg"/>
|
<PersonPicture Name="avatar" Grid.Column="0" Height="46" Margin="5,-30,5,0" BorderBrush="White" BorderThickness="10"/>
|
||||||
|
|
||||||
<TextBlock Name="channelName" Grid.Column="1" Text="IGP" Foreground="Gray" Margin="0,2,0,0" FontSize="12"/>
|
<TextBlock Name="channelName" Grid.Column="1" Text="[Channel name]" Foreground="Gray" Margin="0,2,0,0" FontSize="12"/>
|
||||||
<TextBlock Grid.Column="2" Name="views" Text="1M views" HorizontalAlignment="Right" Foreground="Gray" Margin="0,2,2,0" FontSize="12"/>
|
<TextBlock Grid.Column="1" Name="views" Text="[Views]" HorizontalAlignment="Right" Foreground="Gray" Margin="0,2,2,0" FontSize="12"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
<StackPanel Grid.Row="1">
|
<StackPanel Grid.Row="1">
|
||||||
<TextBlock Name="title" Text="Subnautica - SAY GOODBYE TO SUBNAUTICA! We're Back Home! - Subnautica Ending (Full Release Gameplay)" TextWrapping="WrapWholeWords" Margin="5" FontSize="14" MaxLines="2"/>
|
<TextBlock Name="title" Text="[Title]" TextWrapping="WrapWholeWords" Margin="5" FontSize="14" MaxLines="2"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
@@ -19,6 +19,7 @@ using Google.Apis.YouTube.v3;
|
|||||||
using Google.Apis.YouTube.v3.Data;
|
using Google.Apis.YouTube.v3.Data;
|
||||||
using Windows.UI.Xaml.Media.Imaging;
|
using Windows.UI.Xaml.Media.Imaging;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
|
using Windows.System;
|
||||||
|
|
||||||
// The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236
|
// The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236
|
||||||
|
|
||||||
@@ -28,6 +29,8 @@ namespace FoxTube
|
|||||||
{
|
{
|
||||||
public string videoId;
|
public string videoId;
|
||||||
Google.Apis.YouTube.v3.Data.Video item;
|
Google.Apis.YouTube.v3.Data.Video item;
|
||||||
|
|
||||||
|
bool embed = false;
|
||||||
public VideoCard(string id)
|
public VideoCard(string id)
|
||||||
{
|
{
|
||||||
this.InitializeComponent();
|
this.InitializeComponent();
|
||||||
@@ -41,9 +44,9 @@ namespace FoxTube
|
|||||||
|
|
||||||
public async void Initialize(string id)
|
public async void Initialize(string id)
|
||||||
{
|
{
|
||||||
YouTubeService ytService = SecretsVault.YoutubeService;
|
YouTubeService ytService = SecretsVault.NoAuthService;
|
||||||
|
|
||||||
VideosResource.ListRequest request = ytService.Videos.List("snippet,contentDetails,statistics");
|
VideosResource.ListRequest request = ytService.Videos.List("snippet,contentDetails,statistics,liveStreamingDetails");
|
||||||
request.Id = id;
|
request.Id = id;
|
||||||
VideoListResponse response = await request.ExecuteAsync();
|
VideoListResponse response = await request.ExecuteAsync();
|
||||||
|
|
||||||
@@ -54,12 +57,34 @@ namespace FoxTube
|
|||||||
title.Text = item.Snippet.Title;
|
title.Text = item.Snippet.Title;
|
||||||
views.Text = string.Format("{0} views", item.Statistics.ViewCount);
|
views.Text = string.Format("{0} views", item.Statistics.ViewCount);
|
||||||
|
|
||||||
TimeSpan duration = XmlConvert.ToTimeSpan(item.ContentDetails.Duration);
|
string duration;
|
||||||
|
if (item.ContentDetails.Duration != null || item.ContentDetails.Duration != "")
|
||||||
|
{
|
||||||
|
TimeSpan ts = XmlConvert.ToTimeSpan(item.ContentDetails.Duration);
|
||||||
|
duration = string.Format("{0}{1:00}:{2:00} | ", ts.Hours == 0 ? "" : ts.Hours + ":", ts.Minutes, ts.Seconds);
|
||||||
|
}
|
||||||
|
else duration = string.Empty;
|
||||||
|
|
||||||
info.Text = string.Format("{0}{1:00}:{2:00} | {3}", duration.Hours == 0? "" : duration.Hours + ":", duration.Minutes, duration.Seconds, item.Snippet.PublishedAt);
|
info.Text = string.Format("{0}{1} | {2}", duration, Methods.GetAgo(item.Snippet.PublishedAt.Value), (item.LiveStreamingDetails != null && item.LiveStreamingDetails.ConcurrentViewers.HasValue) ? item.LiveStreamingDetails.ConcurrentViewers + " viewers" : item.Statistics.ViewCount + " views");
|
||||||
thumbnail.Source = new BitmapImage(new Uri(item.Snippet.Thumbnails.Medium.Url));
|
thumbnail.Source = new BitmapImage(new Uri(item.Snippet.Thumbnails.Medium.Url));
|
||||||
if (item.Snippet.LiveBroadcastContent == "live")
|
if (item.Snippet.LiveBroadcastContent == "live")
|
||||||
|
{
|
||||||
|
embed = true;
|
||||||
liveTag.Visibility = Visibility.Visible;
|
liveTag.Visibility = Visibility.Visible;
|
||||||
|
}
|
||||||
|
else if (item.Snippet.LiveBroadcastContent == "upcoming")
|
||||||
|
{
|
||||||
|
embed = true;
|
||||||
|
TimeSpan span;
|
||||||
|
if (item.LiveStreamingDetails.ScheduledStartTime != null && (item.LiveStreamingDetails.ScheduledStartTime - DateTime.Now).Value.TotalMilliseconds > 0)
|
||||||
|
{
|
||||||
|
span = (TimeSpan)(item.LiveStreamingDetails.ScheduledStartTime - DateTime.Now);
|
||||||
|
liveContent.Text = "Goes live in " + string.Format("{0}{1:00}:{2:00}:{3:00}", span.Days != 0 ? span.Days + ":" : "", span.Hours, span.Minutes, span.Seconds);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
liveContent.Text = "Upcoming";
|
||||||
|
liveTag.Visibility = Visibility.Visible;
|
||||||
|
}
|
||||||
|
|
||||||
var request1 = ytService.Channels.List("snippet,contentDetails,statistics");
|
var request1 = ytService.Channels.List("snippet,contentDetails,statistics");
|
||||||
request1.Id = item.Snippet.ChannelId;
|
request1.Id = item.Snippet.ChannelId;
|
||||||
@@ -71,9 +96,12 @@ namespace FoxTube
|
|||||||
channelName.Text = item1.Snippet.Title;
|
channelName.Text = item1.Snippet.Title;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Button_Click(object sender, RoutedEventArgs e)
|
private async void Button_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
SecretsVault.SubLayer.Main.GoToVideo(videoId);
|
if (embed)
|
||||||
|
await Launcher.LaunchUriAsync(new Uri(string.Format("https://www.youtube.com/watch?v={0}", videoId)));
|
||||||
|
else
|
||||||
|
Methods.MainPage.GoToVideo(videoId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -18,12 +18,12 @@
|
|||||||
<RowDefinition Height="75"/>
|
<RowDefinition Height="75"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<StackPanel Orientation="Vertical">
|
<StackPanel Orientation="Vertical">
|
||||||
<TextBlock Name="title" TextWrapping="WrapWholeWords" Text="Subnautica - SAY GOODBYE TO SUBNAUTICA! We're Back Home! - Subnautica Ending (Full Release Gameplay)" FontSize="20" MaxLines="2"/>
|
<TextBlock Name="title" TextWrapping="WrapWholeWords" Text="[Title]" FontSize="20" MaxLines="2"/>
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<TextBlock Name="info" Text="1:00:00 | 59 minute ago | 1,052,421 views" Foreground="Gray"/>
|
<TextBlock Name="info" Text="[Duration] | [Published at] | [views]" Foreground="Gray"/>
|
||||||
<StackPanel Name="liveTag" Margin="5,0,0,0" BorderBrush="Red" BorderThickness="2" VerticalAlignment="Center" HorizontalAlignment="Right" Padding="5,0,5,0" Height="20" Orientation="Horizontal" Visibility="Collapsed">
|
<StackPanel Name="liveTag" Margin="5,0,0,0" BorderBrush="Red" BorderThickness="2" VerticalAlignment="Center" HorizontalAlignment="Right" Padding="5,0,5,0" Height="20" Orientation="Horizontal" Visibility="Collapsed">
|
||||||
<TextBlock Text=" " VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="Red" FontSize="12" FontFamily="Segoe MDL2 Assets" Margin="0,1,0,0" FontWeight="Black"/>
|
<TextBlock Text=" " VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="Red" FontSize="12" FontFamily="Segoe MDL2 Assets" Margin="0,1,0,0" FontWeight="Black"/>
|
||||||
<TextBlock Text="LIVE" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="Red" FontSize="12" FontWeight="Bold"/>
|
<TextBlock Name="liveContent" Text="LIVE" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="Red" FontSize="12" FontWeight="Bold"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<!--<TextBlock MaxLines="4" Foreground="Gray" Margin="0,5,0,0" Text="Bendy and the Ink Machine: Chapter 4 Gameplay Part 1 - The Most Horrific Thing Yet! Bertrum Boss Fight! - Welcome back to Bendy and the Ink Machine! Today in Bendy and the Ink Machine, we check out Chapter 4, the latest and most terrifying chapter yet! We discover new secrets and find a man alive...kind of. Let's play Bendy and the Ink Machine Chapter 4!"/>-->
|
<!--<TextBlock MaxLines="4" Foreground="Gray" Margin="0,5,0,0" Text="Bendy and the Ink Machine: Chapter 4 Gameplay Part 1 - The Most Horrific Thing Yet! Bertrum Boss Fight! - Welcome back to Bendy and the Ink Machine! Today in Bendy and the Ink Machine, we check out Chapter 4, the latest and most terrifying chapter yet! We discover new secrets and find a man alive...kind of. Let's play Bendy and the Ink Machine Chapter 4!"/>-->
|
||||||
@@ -35,8 +35,8 @@
|
|||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<PersonPicture Name="avatar" Width="75" HorizontalAlignment="Left"/>
|
<PersonPicture Name="avatar" Width="75" HorizontalAlignment="Left"/>
|
||||||
<StackPanel Orientation="Vertical" Grid.Column="1" Padding="10,5,5,5" VerticalAlignment="Center">
|
<StackPanel Orientation="Vertical" Grid.Column="1" Padding="10,5,5,5" VerticalAlignment="Center">
|
||||||
<TextBlock Name="channelName" Text="IGP" FontSize="18"/>
|
<TextBlock Name="channelName" Text="[Channel name]" FontSize="18"/>
|
||||||
<TextBlock Name="channelSubs" Text="120,452 subscribers" Foreground="Gray"/>
|
<TextBlock Name="channelSubs" Text="[Subscribers]" Foreground="Gray"/>
|
||||||
<HyperlinkButton Name="channelLink" Content="Go to channel" Padding="0" Click="channelLink_Click"/>
|
<HyperlinkButton Name="channelLink" Content="Go to channel" Padding="0" Click="channelLink_Click"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
@@ -21,6 +21,7 @@ using System.Threading.Tasks;
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using Google.Apis.Util.Store;
|
using Google.Apis.Util.Store;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
|
using Windows.System;
|
||||||
|
|
||||||
// The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236
|
// The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236
|
||||||
|
|
||||||
@@ -30,6 +31,8 @@ namespace FoxTube
|
|||||||
{
|
{
|
||||||
public string videoId;
|
public string videoId;
|
||||||
Google.Apis.YouTube.v3.Data.Video item;
|
Google.Apis.YouTube.v3.Data.Video item;
|
||||||
|
|
||||||
|
bool embed = false;
|
||||||
public VideoCardWide(string id)
|
public VideoCardWide(string id)
|
||||||
{
|
{
|
||||||
this.InitializeComponent();
|
this.InitializeComponent();
|
||||||
@@ -38,9 +41,9 @@ namespace FoxTube
|
|||||||
|
|
||||||
public async void Initialize(string id)
|
public async void Initialize(string id)
|
||||||
{
|
{
|
||||||
YouTubeService ytService = SecretsVault.YoutubeService;
|
YouTubeService ytService = SecretsVault.NoAuthService;
|
||||||
|
|
||||||
VideosResource.ListRequest request = ytService.Videos.List("snippet,contentDetails,statistics");
|
VideosResource.ListRequest request = ytService.Videos.List("snippet,contentDetails,statistics,liveStreamingDetails");
|
||||||
request.Id = id;
|
request.Id = id;
|
||||||
VideoListResponse response = await request.ExecuteAsync();
|
VideoListResponse response = await request.ExecuteAsync();
|
||||||
|
|
||||||
@@ -50,12 +53,34 @@ namespace FoxTube
|
|||||||
|
|
||||||
title.Text = item.Snippet.Title;
|
title.Text = item.Snippet.Title;
|
||||||
|
|
||||||
TimeSpan duration = XmlConvert.ToTimeSpan(item.ContentDetails.Duration);
|
string duration;
|
||||||
|
if (item.ContentDetails.Duration != null || item.ContentDetails.Duration != "")
|
||||||
|
{
|
||||||
|
TimeSpan ts = XmlConvert.ToTimeSpan(item.ContentDetails.Duration);
|
||||||
|
duration = string.Format("{0}{1:00}:{2:00} | ", ts.Hours == 0 ? "" : ts.Hours + ":", ts.Minutes, ts.Seconds);
|
||||||
|
}
|
||||||
|
else duration = string.Empty;
|
||||||
|
|
||||||
info.Text = string.Format("{0}{1:00}:{2:00} | {3} | {4} views", duration.Hours == 0 ? "" : duration.Hours + ":", duration.Minutes, duration.Seconds, item.Snippet.PublishedAt, item.Statistics.ViewCount);
|
info.Text = string.Format("{0}{1} | {2}", duration, Methods.GetAgo(item.Snippet.PublishedAt.Value), (item.LiveStreamingDetails != null && item.LiveStreamingDetails.ConcurrentViewers.HasValue) ? item.LiveStreamingDetails.ConcurrentViewers + " viewers" : item.Statistics.ViewCount + " views");
|
||||||
thumbnail.Source = new BitmapImage(new Uri(item.Snippet.Thumbnails.Medium.Url));
|
thumbnail.Source = new BitmapImage(new Uri(item.Snippet.Thumbnails.Medium.Url));
|
||||||
if (item.Snippet.LiveBroadcastContent == "live")
|
if (item.Snippet.LiveBroadcastContent == "live")
|
||||||
|
{
|
||||||
|
embed = true;
|
||||||
liveTag.Visibility = Visibility.Visible;
|
liveTag.Visibility = Visibility.Visible;
|
||||||
|
}
|
||||||
|
else if(item.Snippet.LiveBroadcastContent == "upcoming")
|
||||||
|
{
|
||||||
|
embed = true;
|
||||||
|
TimeSpan span;
|
||||||
|
if (item.LiveStreamingDetails.ScheduledStartTime != null && (item.LiveStreamingDetails.ScheduledStartTime - DateTime.Now).Value.TotalMilliseconds > 0)
|
||||||
|
{
|
||||||
|
span = (TimeSpan)(item.LiveStreamingDetails.ScheduledStartTime - DateTime.Now);
|
||||||
|
liveContent.Text = "Goes live in " + string.Format("{0}{1:00}:{2:00}:{3:00}", span.Days != 0 ? span.Days + ":" : "", span.Hours, span.Minutes, span.Seconds);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
liveContent.Text = "Upcoming";
|
||||||
|
liveTag.Visibility = Visibility.Visible;
|
||||||
|
}
|
||||||
|
|
||||||
var request1 = ytService.Channels.List("snippet,contentDetails,statistics");
|
var request1 = ytService.Channels.List("snippet,contentDetails,statistics");
|
||||||
request1.Id = item.Snippet.ChannelId;
|
request1.Id = item.Snippet.ChannelId;
|
||||||
@@ -70,12 +95,15 @@ namespace FoxTube
|
|||||||
|
|
||||||
private void channelLink_Click(object sender, RoutedEventArgs e)
|
private void channelLink_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
SecretsVault.SubLayer.Main.GoToChannel(item.Snippet.ChannelId);
|
Methods.MainPage.GoToChannel(item.Snippet.ChannelId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Button_Click(object sender, RoutedEventArgs e)
|
private async void Button_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
SecretsVault.SubLayer.Main.GoToVideo(videoId);
|
if (embed)
|
||||||
|
await Launcher.LaunchUriAsync(new Uri(string.Format("https://www.youtube.com/watch?v={0}", videoId)));
|
||||||
|
else
|
||||||
|
Methods.MainPage.GoToVideo(videoId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -9,46 +9,63 @@
|
|||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="1080"
|
d:DesignHeight="1080"
|
||||||
d:DesignWidth="1920"
|
d:DesignWidth="1920"
|
||||||
SizeChanged="UserControl_SizeChanged"
|
|
||||||
Tapped="UserControl_Tapped"
|
Tapped="UserControl_Tapped"
|
||||||
|
DoubleTapped="UserControl_DoubleTapped"
|
||||||
PointerMoved="UserControl_PointerMoved"
|
PointerMoved="UserControl_PointerMoved"
|
||||||
PointerExited="UserControl_PointerExited"
|
PointerExited="UserControl_PointerExited"
|
||||||
PointerEntered="UserControl_PointerEntered">
|
PointerEntered="UserControl_PointerEntered">
|
||||||
|
|
||||||
<Grid Background="White">
|
<Grid Background="White" Name="grid">
|
||||||
<MediaElement CurrentStateChanged="videoSource_CurrentStateChanged" AutoPlay="False" Name="videoSource" AreTransportControlsEnabled="False" PosterSource="ms-appx:///Assets/videoThumbSample.png"/>
|
<MediaElement CurrentStateChanged="videoSource_CurrentStateChanged" AutoPlay="False" Name="videoSource" AreTransportControlsEnabled="False" PosterSource="ms-appx:///Assets/videoThumbSample.png"/>
|
||||||
<TextBox Name="subtitleCapture" Visibility="Collapsed" Text="This is subtitle capture" Background="#99000000" VerticalAlignment="Bottom" HorizontalAlignment="Center" Foreground="White" FontSize="24" Padding="10" Margin="0,0,0,100"/>
|
<TextBox Name="subtitleCapture" Visibility="Collapsed" Text="This is subtitle capture" Background="#99000000" VerticalAlignment="Bottom" HorizontalAlignment="Center" Foreground="White" FontSize="24" Padding="10" Margin="0,0,0,100"/>
|
||||||
<Grid Name="controls" Visibility="Visible">
|
<Grid Name="controls" Visibility="Visible">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="50"/>
|
<RowDefinition Height="auto"/>
|
||||||
<RowDefinition/>
|
<RowDefinition/>
|
||||||
<RowDefinition Height="50"/>
|
<RowDefinition Height="auto"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Grid Grid.Row="0" Name="header" Background="#7F000000">
|
<Grid Grid.Row="0" Name="header" Height="50" Background="#7F000000">
|
||||||
<!--<Grid.Background>
|
<Grid.ColumnDefinitions>
|
||||||
<AcrylicBrush TintColor="Black" TintOpacity="0.795" BackgroundSource="Backdrop" AlwaysUseFallback="False" Opacity="0.8"/>
|
<ColumnDefinition Width="auto"/>
|
||||||
</Grid.Background>-->
|
<ColumnDefinition/>
|
||||||
<StackPanel Orientation="Horizontal">
|
<ColumnDefinition Width="auto"/>
|
||||||
<Button Visibility="Collapsed" Background="Transparent" FontFamily="Segoe MDL2 Assets" Content="" Foreground="White" Width="50" Height="50" FontSize="25" ToolTipService.ToolTip="Minimize"/>
|
</Grid.ColumnDefinitions>
|
||||||
<TextBlock Name="title" Text="This is Video title" Foreground="White" VerticalAlignment="Center" TextWrapping="WrapWholeWords" FontSize="20" Margin="10,0,0,0" MaxLines="1" ToolTipService.ToolTip="Title"/>
|
<Button Click="minimize_Click" Name="minimize" Background="Transparent" FontFamily="Segoe MDL2 Assets" Content="" Foreground="White" Width="50" Height="50" FontSize="25" ToolTipService.ToolTip="Minimize"/>
|
||||||
|
<StackPanel Grid.Column="1" Margin="10,0,10,0" VerticalAlignment="Center">
|
||||||
|
<TextBlock Name="title" Text="[Title]" Foreground="White" VerticalAlignment="Center" TextWrapping="WrapWholeWords" FontSize="20" MaxLines="1" ToolTipService.ToolTip="Title"/>
|
||||||
|
<TextBlock Foreground="Gray" Text="[Channel name]" Name="channelName" FontStyle="Italic"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
<StackPanel Grid.Column="2" Orientation="Horizontal" HorizontalAlignment="Right">
|
||||||
<Button Visibility="Collapsed" Background="Transparent" FontFamily="Segoe MDL2 Assets" Content="" Foreground="White" Width="50" Height="50" FontSize="25" ToolTipService.ToolTip="Cast to device"/>
|
<Button Name="closeHeader" Click="close_Click" Background="Transparent" FontFamily="Segoe MDL2 Assets" Content="" Foreground="White" Width="50" Height="50" FontSize="25" ToolTipService.ToolTip="Close video"/>
|
||||||
|
<Button Name="cast" Click="cast_Click" Background="Transparent" FontFamily="Segoe MDL2 Assets" Content="" Foreground="White" Width="50" Height="50" FontSize="25" ToolTipService.ToolTip="Cast to device"/>
|
||||||
<Button Name="miniView" Click="miniView_Click" Background="Transparent" FontFamily="Segoe MDL2 Assets" Content="" Foreground="White" Width="50" Height="50" FontSize="25" ToolTipService.ToolTip="Compact view mode" HorizontalAlignment="Center" Margin="0,0,0,0" VerticalAlignment="Center"/>
|
<Button Name="miniView" Click="miniView_Click" Background="Transparent" FontFamily="Segoe MDL2 Assets" Content="" Foreground="White" Width="50" Height="50" FontSize="25" ToolTipService.ToolTip="Compact view mode" HorizontalAlignment="Center" Margin="0,0,0,0" VerticalAlignment="Center"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Button Visibility="Collapsed" Margin="0,35,0,0" VerticalAlignment="Top" HorizontalAlignment="Right" Name="miniViewExit" Grid.Row="1" Click="miniView_Click" Background="Transparent" FontFamily="Segoe MDL2 Assets" Content="" Foreground="White" Width="50" Height="50" FontSize="25" ToolTipService.ToolTip="Compact view mode"/>
|
|
||||||
<StackPanel Name="touchCentral" Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center" Visibility="Collapsed">
|
<Grid Name="touchCentral" Background="#7F000000" Visibility="Collapsed" Grid.Row="1">
|
||||||
|
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||||
<Button VerticalAlignment="Center" Content="" FontFamily="Segoe MDL2 Assets" Background="Transparent" FontSize="40" Foreground="WhiteSmoke" Name="touchBack10" Click="back10_Click"/>
|
<Button VerticalAlignment="Center" Content="" FontFamily="Segoe MDL2 Assets" Background="Transparent" FontSize="40" Foreground="WhiteSmoke" Name="touchBack10" Click="back10_Click"/>
|
||||||
<Button VerticalAlignment="Center" Content="" FontFamily="Segoe MDL2 Assets" Background="Transparent" FontSize="100" Foreground="WhiteSmoke" Name="touchPlay" Click="play_Click"/>
|
<Button VerticalAlignment="Center" Content="" FontFamily="Segoe MDL2 Assets" Background="Transparent" FontSize="100" Foreground="WhiteSmoke" Name="touchPlay" Click="play_Click"/>
|
||||||
<Button VerticalAlignment="Center" Content="" FontFamily="Segoe MDL2 Assets" Background="Transparent" FontSize="40" Foreground="WhiteSmoke" Name="touchFwd30" Click="fwd30_Click"/>
|
<Button VerticalAlignment="Center" Content="" FontFamily="Segoe MDL2 Assets" Background="Transparent" FontSize="40" Foreground="WhiteSmoke" Name="touchFwd30" Click="fwd30_Click"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
<Button Visibility="Collapsed" Margin="0,32,0,0" VerticalAlignment="Top" HorizontalAlignment="Right" Name="miniViewExit" Grid.Row="1" Click="miniView_Click" Background="Transparent" FontFamily="Segoe MDL2 Assets" Content="" Foreground="White" Width="45" Height="45" FontSize="25" ToolTipService.ToolTip="Exit compact view mode"/>
|
||||||
|
<Button Visibility="Collapsed" VerticalAlignment="Top" HorizontalAlignment="Right" Name="close" Click="close_Click" Background="Transparent" FontFamily="Segoe MDL2 Assets" Content="" Foreground="White" Width="45" Height="45" FontSize="25" ToolTipService.ToolTip="Close video"/>
|
||||||
|
<Button Visibility="Collapsed"
|
||||||
|
VerticalAlignment="Top" HorizontalAlignment="Left"
|
||||||
|
Name="maximize" Click="maximize_Click"
|
||||||
|
Background="Transparent" FontFamily="Segoe MDL2 Assets" Foreground="White" FontSize="25"
|
||||||
|
Content=""
|
||||||
|
Width="45" Height="45"
|
||||||
|
ToolTipService.ToolTip="Maximize"/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
<Button Name="skipAd" Visibility="Collapsed" Margin="0,0,0,25" Grid.Row="1" HorizontalAlignment="Right" Foreground="White" VerticalAlignment="Bottom" Padding="10" BorderBrush="Black" BorderThickness="2" Background="#7E000000">
|
<Button Name="skipAd" Visibility="Collapsed" Margin="0,0,0,25" Grid.Row="1" HorizontalAlignment="Right" Foreground="White" VerticalAlignment="Bottom" Padding="10" BorderBrush="Black" BorderThickness="2" Background="#7E000000">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<TextBlock FontFamily="Segoe MDL2 Assets" FontSize="30" Margin="0,0,10,0" Text="" VerticalAlignment="Center"/>
|
<TextBlock FontFamily="Segoe MDL2 Assets" FontSize="30" Margin="0,0,10,0" Text="" VerticalAlignment="Center"/>
|
||||||
<TextBlock Text="Skip ad" FontSize="30" TextWrapping="WrapWholeWords" MaxWidth="250"/>
|
<TextBlock Text="Skip ad" FontSize="30" TextWrapping="WrapWholeWords" MaxWidth="250"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<StackPanel Name="schedulePanel" Visibility="Collapsed" VerticalAlignment="Bottom" HorizontalAlignment="Right" Grid.Row="1" BorderBrush="Black" BorderThickness="2" Background="#7E000000" Padding="10" Margin="25" Orientation="Horizontal">
|
<StackPanel Name="schedulePanel" Visibility="Collapsed" VerticalAlignment="Bottom" HorizontalAlignment="Right" Grid.Row="1" BorderBrush="Black" BorderThickness="2" Background="#7E000000" Padding="10" Margin="25" Orientation="Horizontal">
|
||||||
<TextBlock FontFamily="Segoe MDL2 Assets" FontSize="30" Margin="0,0,10,0" Foreground="White" Text=""/>
|
<TextBlock FontFamily="Segoe MDL2 Assets" FontSize="30" Margin="0,0,10,0" Foreground="White" Text=""/>
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
@@ -59,13 +76,10 @@
|
|||||||
|
|
||||||
<TextBlock Name="countdownHeader" Foreground="White" FontWeight="Bold" Text="Stream will be started in:" Margin="0,10,0,0"/>
|
<TextBlock Name="countdownHeader" Foreground="White" FontWeight="Bold" Text="Stream will be started in:" Margin="0,10,0,0"/>
|
||||||
<TextBlock Foreground="White" Name="streamCountdown" FontWeight="SemiBold" FontSize="20" Text="1:10:31:48"/>
|
<TextBlock Foreground="White" Name="streamCountdown" FontWeight="SemiBold" FontSize="20" Text="1:10:31:48"/>
|
||||||
<ToggleButton Content="Enable notification" Foreground="White" Margin="5"/>
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<Grid Grid.Row="2" Name="mainControls" Background="#7F000000">
|
|
||||||
<!--<Grid.Background>
|
<Grid Grid.Row="2" Height="50" Name="mainControls" Background="#7F000000">
|
||||||
<AcrylicBrush TintColor="Black" TintOpacity="0.795" BackgroundSource="Backdrop" AlwaysUseFallback="False" Opacity="0.8"/>
|
|
||||||
</Grid.Background>-->
|
|
||||||
<ProgressBar Name="bufferingBar" VerticalAlignment="Top" Margin="0,-4,0,0" IsIndeterminate="True" Visibility="Visible"/>
|
<ProgressBar Name="bufferingBar" VerticalAlignment="Top" Margin="0,-4,0,0" IsIndeterminate="True" Visibility="Visible"/>
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
@@ -97,8 +111,8 @@
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Button>
|
</Button>
|
||||||
<Grid Name="seekPanel" Grid.Column="1">
|
<Grid Name="seekPanel" Grid.Column="1">
|
||||||
<TextBlock Name="elapsedTime" Foreground="White" Text="18:28" VerticalAlignment="Bottom" HorizontalAlignment="Left" Margin="10,0,10,0" ToolTipService.ToolTip="Time elapsed"/>
|
<TextBlock Name="elapsedTime" Foreground="White" Text="[Elapsed]" VerticalAlignment="Bottom" HorizontalAlignment="Left" Margin="10,0,10,0" ToolTipService.ToolTip="Time elapsed"/>
|
||||||
<TextBlock Name="remainingTime" Foreground="White" Text="18:28" VerticalAlignment="Bottom" HorizontalAlignment="Right" Margin="10,0,10,0" ToolTipService.ToolTip="Time remaining"/>
|
<TextBlock Name="remainingTime" Foreground="White" Text="[Remaining]" VerticalAlignment="Bottom" HorizontalAlignment="Stretch" Margin="1430,0,10,0" ToolTipService.ToolTip="Time remaining"/>
|
||||||
<Slider PointerCaptureLost="seek_PointerCaptureLost" ValueChanged="seek_ValueChanged" Name="seek" VerticalAlignment="Top" ToolTipService.ToolTip="Seek" IsThumbToolTipEnabled="False" HorizontalAlignment="Stretch"/>
|
<Slider PointerCaptureLost="seek_PointerCaptureLost" ValueChanged="seek_ValueChanged" Name="seek" VerticalAlignment="Top" ToolTipService.ToolTip="Seek" IsThumbToolTipEnabled="False" HorizontalAlignment="Stretch"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
@@ -124,12 +138,12 @@
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Popup>
|
</Popup>
|
||||||
|
|
||||||
<Popup Grid.Column="2" IsOpen="False" Margin="0,-73,0,0" IsLightDismissEnabled="True" Name="qualityPane">
|
<Popup Grid.Column="2" IsOpen="False" Margin="0,-75,0,0" IsLightDismissEnabled="True" Name="qualityPane">
|
||||||
<StackPanel Background="#7F000000" Width="252" Padding="10">
|
<StackPanel Background="#7F000000" Width="252" Height="75" Padding="10">
|
||||||
<TextBlock Text="Quality" Foreground="White"/>
|
<TextBlock Text="Quality" Foreground="White"/>
|
||||||
<Line X1="0" X2="232" Stroke="White" StrokeThickness="2"/>
|
<Line X1="0" X2="232" Stroke="White" StrokeThickness="2"/>
|
||||||
<ComboBox Width="232" Name="quality" SelectionChanged="quality_SelectionChanged" SelectedIndex="0">
|
<ComboBox Width="232" Name="quality" SelectionChanged="quality_SelectionChanged">
|
||||||
<ComboBoxItem Content="Auto"/>
|
<!--<ComboBoxItem Content="Auto"/>-->
|
||||||
<ComboBoxItem Content="2160P"/>
|
<ComboBoxItem Content="2160P"/>
|
||||||
<ComboBoxItem Content="1080p"/>
|
<ComboBoxItem Content="1080p"/>
|
||||||
<ComboBoxItem Content="720p"/>
|
<ComboBoxItem Content="720p"/>
|
||||||
@@ -143,16 +157,18 @@
|
|||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<Grid Background="Gray" Name="meteredNotification" Visibility="Collapsed">
|
<Grid Background="Gray" Name="meteredNotification" Visibility="Collapsed">
|
||||||
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
|
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||||
<FontIcon FontFamily="Segoe MDL2 Assets" FontSize="72" Foreground="White" Glyph=""/>
|
<FontIcon FontFamily="Segoe MDL2 Assets" FontSize="72" Foreground="White" Glyph=""/>
|
||||||
<TextBlock Text="You are on a metered connection now. Additional charges may apply." FontSize="22" Foreground="White"/>
|
<TextBlock Text="You are on a metered connection now. Additional charges may apply." FontSize="22" Foreground="White"/>
|
||||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
||||||
<Button Content="Add to 'Watch later' playlist and go back" Margin="10" Background="Red" Foreground="White"/>
|
<Button Content="Add to 'Watch later' playlist and go back" Margin="10" Background="Red" Foreground="White" Name="addToLater"/>
|
||||||
<Button Name="meteredDismiss" Click="meteredDismiss_Click" Content="Continue" Margin="10"/>
|
<Button Name="meteredDismiss" Click="meteredDismiss_Click" Content="Continue" Margin="10" Foreground="White"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<Grid Name="matureBlock" Visibility="Collapsed" Background="#FF333333" Padding="25">
|
<Grid Name="matureBlock" Visibility="Collapsed" Background="#FF333333" Padding="25">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="auto"/>
|
<RowDefinition Height="auto"/>
|
||||||
@@ -169,13 +185,13 @@
|
|||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<TextBlock TextWrapping="WrapWholeWords" Foreground="White" Text="This content isn't advised for children. It can represent violance, blood or sexual scenes." FontSize="20"/>
|
<TextBlock TextWrapping="WrapWholeWords" Foreground="White" Text="This content isn't advised for children. It can represent violance, blood or sexual scenes." FontSize="20"/>
|
||||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Grid.Row="1" VerticalAlignment="Bottom">
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Grid.Row="1" VerticalAlignment="Bottom">
|
||||||
<CheckBox Foreground="White">
|
<CheckBox Foreground="White" Name="matureDisable">
|
||||||
<TextBlock Foreground="White" Text="Don't show me it again"/>
|
<TextBlock Foreground="White" Text="Don't show me it again"/>
|
||||||
</CheckBox>
|
</CheckBox>
|
||||||
<Button Content="Continue" Margin="5,0,0,0" Foreground="White" Background="Gray"/>
|
<Button Content="Continue" Name="matureDismiss" Click="matureDismiss_Click" Margin="5,0,0,0" Foreground="White" Background="Gray"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid BorderBrush="OrangeRed" BorderThickness="5" Margin="0,10,0,0" Visibility="Visible" Name="signReq" Grid.Row="1" VerticalAlignment="Top">
|
<Grid BorderBrush="OrangeRed" BorderThickness="5" Margin="0,10,0,0" Visibility="Collapsed" Name="signReq" Grid.Row="1" VerticalAlignment="Top">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="auto"/>
|
<ColumnDefinition Width="auto"/>
|
||||||
<ColumnDefinition/>
|
<ColumnDefinition/>
|
||||||
@@ -183,9 +199,9 @@
|
|||||||
<TextBlock FontFamily="Segoe MDL2 Assets" Text="" FontSize="40" Foreground="OrangeRed" Margin="5"/>
|
<TextBlock FontFamily="Segoe MDL2 Assets" Text="" FontSize="40" Foreground="OrangeRed" Margin="5"/>
|
||||||
<StackPanel HorizontalAlignment="Stretch" Grid.Column="1">
|
<StackPanel HorizontalAlignment="Stretch" Grid.Column="1">
|
||||||
<TextBlock Text="Sign in into your account to continue" Foreground="OrangeRed" FontWeight="Bold" FontSize="20"/>
|
<TextBlock Text="Sign in into your account to continue" Foreground="OrangeRed" FontWeight="Bold" FontSize="20"/>
|
||||||
<TextBlock Text="To watch this video you have to prove your age by sign in into your account which contains your age" Foreground="OrangeRed"/>
|
<TextBlock Text="To watch this video you have to confirm your age by sign in into your account which contains your age" Foreground="OrangeRed"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<Button Content="Sign in now" Foreground="White" Background="Gray" HorizontalAlignment="Right" Grid.Column="1" Margin="0,0,10,0"/>
|
<Button Name="signin" Click="signin_Click" Content="Sign in now" Foreground="White" Background="Gray" HorizontalAlignment="Right" Grid.Column="1" Margin="0,0,10,0"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
<StackPanel Orientation="Horizontal" BorderBrush="OrangeRed" BorderThickness="5" Visibility="Collapsed" Margin="0,10,0,0" Name="denied" Grid.Row="1" VerticalAlignment="Top">
|
<StackPanel Orientation="Horizontal" BorderBrush="OrangeRed" BorderThickness="5" Visibility="Collapsed" Margin="0,10,0,0" Name="denied" Grid.Row="1" VerticalAlignment="Top">
|
||||||
<TextBlock FontFamily="Segoe MDL2 Assets" Text="" FontSize="40" Foreground="OrangeRed" Margin="5"/>
|
<TextBlock FontFamily="Segoe MDL2 Assets" Text="" FontSize="40" Foreground="OrangeRed" Margin="5"/>
|
||||||
@@ -28,6 +28,9 @@ using Windows.Storage.Streams;
|
|||||||
using Windows.UI.ViewManagement;
|
using Windows.UI.ViewManagement;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
using Windows.ApplicationModel.Core;
|
using Windows.ApplicationModel.Core;
|
||||||
|
using Windows.UI;
|
||||||
|
using Windows.Graphics.Display;
|
||||||
|
using Windows.Media.Casting;
|
||||||
|
|
||||||
// The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236
|
// The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236
|
||||||
|
|
||||||
@@ -44,17 +47,19 @@ namespace FoxTube
|
|||||||
public event EventHandler SetFullSize;
|
public event EventHandler SetFullSize;
|
||||||
public event EventHandler NextClicked;
|
public event EventHandler NextClicked;
|
||||||
|
|
||||||
CoreCursor cursorBackup;
|
CoreCursor cursorBackup = Window.Current.CoreWindow.PointerCursor;
|
||||||
|
|
||||||
TimeSpan elapsed;
|
public TimeSpan elapsed;
|
||||||
TimeSpan remaining;
|
TimeSpan remaining;
|
||||||
TimeSpan total;
|
TimeSpan total;
|
||||||
|
|
||||||
Google.Apis.YouTube.v3.Data.Video item;
|
Google.Apis.YouTube.v3.Data.Video item;
|
||||||
|
|
||||||
SystemMediaTransportControls systemControls = SystemMediaTransportControls.GetForCurrentView();
|
SystemMediaTransportControls systemControls = SystemMediaTransportControls.GetForCurrentView();
|
||||||
|
LoadingPage LoadingScreen = new LoadingPage();
|
||||||
|
|
||||||
YouTubeQuality[] qualities = new YouTubeQuality[8]
|
List<YouTubeUri> qualityUris = new List<YouTubeUri>();
|
||||||
|
/*YouTubeQuality[] qualities = new YouTubeQuality[8]
|
||||||
{
|
{
|
||||||
YouTubeQuality.QualityHigh,
|
YouTubeQuality.QualityHigh,
|
||||||
YouTubeQuality.Quality2160P,
|
YouTubeQuality.Quality2160P,
|
||||||
@@ -64,13 +69,13 @@ namespace FoxTube
|
|||||||
YouTubeQuality.Quality360P,
|
YouTubeQuality.Quality360P,
|
||||||
YouTubeQuality.Quality240P,
|
YouTubeQuality.Quality240P,
|
||||||
YouTubeQuality.Quality144P
|
YouTubeQuality.Quality144P
|
||||||
};
|
};*/
|
||||||
|
|
||||||
ApplicationDataContainer settings = ApplicationData.Current.LocalSettings;
|
ApplicationDataContainer settings = ApplicationData.Current.LocalSettings;
|
||||||
Timer t = new Timer()
|
Timer t = new Timer()
|
||||||
{
|
{
|
||||||
Interval = 5000,
|
Interval = 5000,
|
||||||
Enabled = true
|
Enabled = false
|
||||||
};
|
};
|
||||||
Timer seekTimer = new Timer()
|
Timer seekTimer = new Timer()
|
||||||
{
|
{
|
||||||
@@ -80,36 +85,117 @@ namespace FoxTube
|
|||||||
|
|
||||||
Timer countdown;
|
Timer countdown;
|
||||||
|
|
||||||
public VideoPlayer(string id, string channelAvatar)
|
public VideoPlayer(Google.Apis.YouTube.v3.Data.Video meta, string channelAvatar)
|
||||||
{
|
{
|
||||||
this.InitializeComponent();
|
this.InitializeComponent();
|
||||||
|
if (!ApplicationView.GetForCurrentView().IsViewModeSupported(ApplicationViewMode.CompactOverlay))
|
||||||
|
miniView.Visibility = Visibility.Collapsed;
|
||||||
|
grid.Children.Add(LoadingScreen);
|
||||||
|
|
||||||
volume.Value = Convert.ToDouble(settings.Values["volume"]);
|
volume.Value = Convert.ToDouble(settings.Values["volume"]);
|
||||||
videoSource.AutoPlay = (bool)settings.Values["videoAutoplay"];
|
|
||||||
|
|
||||||
var connection = NetworkInformation.GetInternetConnectionProfile().GetConnectionCost();
|
var connection = NetworkInformation.GetInternetConnectionProfile().GetConnectionCost();
|
||||||
if ((bool)settings.Values["moblieWarning"] && (connection.NetworkCostType == NetworkCostType.Fixed || connection.NetworkCostType == NetworkCostType.Variable))
|
if ((bool)settings.Values["moblieWarning"] && (connection.NetworkCostType == NetworkCostType.Fixed || connection.NetworkCostType == NetworkCostType.Variable))
|
||||||
meteredNotification.Visibility = Visibility.Visible;
|
meteredNotification.Visibility = Visibility.Visible;
|
||||||
|
else
|
||||||
|
videoSource.AutoPlay = (bool)settings.Values["videoAutoplay"];
|
||||||
|
|
||||||
t.Elapsed += T_Elapsed;
|
t.Elapsed += T_Elapsed;
|
||||||
seekTimer.Elapsed += SeekTimer_Elapsed;
|
seekTimer.Elapsed += SeekTimer_Elapsed;
|
||||||
Initialize(id, channelAvatar);
|
Initialize(meta, channelAvatar);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async void Initialize(string id, string channelAvatar)
|
public async void Initialize(Google.Apis.YouTube.v3.Data.Video meta, string channelAvatar)
|
||||||
{
|
{
|
||||||
CheckQualityAvailability(id);
|
LoadingScreen.Visibility = Visibility.Visible;
|
||||||
|
|
||||||
videoId = id;
|
item = meta;
|
||||||
VideosResource.ListRequest request = SecretsVault.YoutubeService.Videos.List("snippet,contentDetails,statistics,liveStreamingDetails");
|
videoId = item.Id;
|
||||||
request.Id = id;
|
|
||||||
|
|
||||||
VideoListResponse response = await request.ExecuteAsync();
|
#region Checking qualities availability
|
||||||
|
YouTubeUri[] uris = await YouTube.GetUrisAsync(videoId);
|
||||||
|
List<YouTubeUri> temp = new List<YouTubeUri>();
|
||||||
|
|
||||||
item = response.Items[0];
|
Rect bounds = ApplicationView.GetForCurrentView().VisibleBounds;
|
||||||
|
double scaleFactor = DisplayInformation.GetForCurrentView().RawPixelsPerViewPixel;
|
||||||
|
Size size = new Size(bounds.Width * scaleFactor, bounds.Height * scaleFactor);
|
||||||
|
|
||||||
if(item.ContentDetails.ContentRating != null && item.ContentDetails.ContentRating.YtRating == "ytAgeRestricted")
|
foreach (YouTubeUri u in uris)
|
||||||
|
if (u.HasVideo && !u.Type.Contains("+mp4a"))
|
||||||
|
temp.Add(u);
|
||||||
|
|
||||||
|
foreach(YouTubeUri u in uris)
|
||||||
{
|
{
|
||||||
|
Debug.WriteLine("-----------------");
|
||||||
|
Debug.WriteLine("URI: " + u.Uri);
|
||||||
|
Debug.WriteLine("Has video: " + u.HasVideo);
|
||||||
|
Debug.WriteLine("Has audio: " + u.HasAudio);
|
||||||
|
Debug.WriteLine("Type: " + u.Type);
|
||||||
|
Debug.WriteLine("Video quality: " + u.VideoQuality);
|
||||||
|
Debug.WriteLine("Audio quality: " + u.AudioQuality);
|
||||||
|
Debug.WriteLine("-----------------");
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (YouTubeUri u in temp)
|
||||||
|
if (u != null)
|
||||||
|
Debug.WriteLine(u.VideoQuality);
|
||||||
|
else
|
||||||
|
Debug.WriteLine("null");
|
||||||
|
|
||||||
|
if (temp[0].VideoQuality != YouTubeQuality.Quality2160P)
|
||||||
|
{
|
||||||
|
temp.Insert(0, null);
|
||||||
|
(quality.Items[0] as ComboBoxItem).Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
if (temp[1].VideoQuality != YouTubeQuality.Quality1080P)
|
||||||
|
{
|
||||||
|
temp.Insert(1, null);
|
||||||
|
(quality.Items[1] as ComboBoxItem).Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
if (temp[2].VideoQuality != YouTubeQuality.Quality720P)
|
||||||
|
{
|
||||||
|
temp.Insert(2, null);
|
||||||
|
(quality.Items[2] as ComboBoxItem).Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
if (temp[3].VideoQuality != YouTubeQuality.Quality480P)
|
||||||
|
{
|
||||||
|
temp.Insert(3, null);
|
||||||
|
(quality.Items[3] as ComboBoxItem).Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
if (temp[4].VideoQuality != YouTubeQuality.Quality360P)
|
||||||
|
{
|
||||||
|
temp.Insert(4, null);
|
||||||
|
(quality.Items[4] as ComboBoxItem).Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
if (temp[5].VideoQuality != YouTubeQuality.Quality240P)
|
||||||
|
{
|
||||||
|
temp.Insert(5, null);
|
||||||
|
(quality.Items[5] as ComboBoxItem).Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
qualityUris = temp;
|
||||||
|
|
||||||
|
foreach (YouTubeUri u in qualityUris)
|
||||||
|
if (u != null)
|
||||||
|
Debug.WriteLine(u.VideoQuality);
|
||||||
|
else
|
||||||
|
Debug.WriteLine("null");
|
||||||
|
|
||||||
|
int k = (int)settings.Values["quality"];
|
||||||
|
if (qualityUris[k] == null)
|
||||||
|
for (int a = k - 1; a == 0; a--)
|
||||||
|
if (qualityUris[a] != null)
|
||||||
|
{
|
||||||
|
k = a;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
quality.SelectedIndex = k;
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
if(item.ContentDetails.ContentRating != null &&
|
||||||
|
item.ContentDetails.ContentRating.YtRating == "ytAgeRestricted" &&
|
||||||
|
settings.Values["showMature"] == null)
|
||||||
|
{
|
||||||
|
//TO-DO: insert authentication validation
|
||||||
matureBlock.Visibility = Visibility.Visible;
|
matureBlock.Visibility = Visibility.Visible;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -160,9 +246,9 @@ namespace FoxTube
|
|||||||
try { videoSource.PosterSource = new BitmapImage(new Uri(item.Snippet.Thumbnails.Maxres.Url)); }
|
try { videoSource.PosterSource = new BitmapImage(new Uri(item.Snippet.Thumbnails.Maxres.Url)); }
|
||||||
catch { }
|
catch { }
|
||||||
title.Text = item.Snippet.Title;
|
title.Text = item.Snippet.Title;
|
||||||
|
channelName.Text = item.Snippet.ChannelTitle;
|
||||||
|
|
||||||
YouTubeUri uri = await YouTube.GetVideoUriAsync(id, qualities[quality.SelectedIndex]);
|
//videoSource.Source = qualityUris[quality.SelectedIndex].Uri;
|
||||||
videoSource.Source = uri.Uri;
|
|
||||||
|
|
||||||
total = XmlConvert.ToTimeSpan(item.ContentDetails.Duration);
|
total = XmlConvert.ToTimeSpan(item.ContentDetails.Duration);
|
||||||
seek.Maximum = total.TotalSeconds;
|
seek.Maximum = total.TotalSeconds;
|
||||||
@@ -184,6 +270,9 @@ namespace FoxTube
|
|||||||
systemControls.DisplayUpdater.Update();
|
systemControls.DisplayUpdater.Update();
|
||||||
|
|
||||||
systemControls.ButtonPressed += SystemControls_Engaged;
|
systemControls.ButtonPressed += SystemControls_Engaged;
|
||||||
|
|
||||||
|
t.Start();
|
||||||
|
LoadingScreen.Visibility = Visibility.Collapsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void Countdown_Elapsed(object sender, ElapsedEventArgs e)
|
private async void Countdown_Elapsed(object sender, ElapsedEventArgs e)
|
||||||
@@ -205,6 +294,78 @@ namespace FoxTube
|
|||||||
|
|
||||||
async void CheckQualityAvailability(string id)
|
async void CheckQualityAvailability(string id)
|
||||||
{
|
{
|
||||||
|
YouTubeUri[] uris = await YouTube.GetUrisAsync(id);
|
||||||
|
List<YouTubeUri> temp = new List<YouTubeUri>();
|
||||||
|
|
||||||
|
Rect bounds = ApplicationView.GetForCurrentView().VisibleBounds;
|
||||||
|
double scaleFactor = DisplayInformation.GetForCurrentView().RawPixelsPerViewPixel;
|
||||||
|
Size size = new Size(bounds.Width * scaleFactor, bounds.Height * scaleFactor);
|
||||||
|
|
||||||
|
foreach (YouTubeUri u in uris)
|
||||||
|
if(u.HasVideo && !u.Type.Contains("+mp4a"))
|
||||||
|
temp.Add(u);
|
||||||
|
|
||||||
|
if(temp[0].VideoQuality != YouTubeQuality.Quality2160P && size.Height >= 2160)
|
||||||
|
{
|
||||||
|
temp.Insert(0, null);
|
||||||
|
(quality.Items[0] as ComboBoxItem).Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
if(temp[1].VideoQuality != YouTubeQuality.Quality1080P && size.Height >= 1080)
|
||||||
|
{
|
||||||
|
temp.Insert(1, null);
|
||||||
|
(quality.Items[1] as ComboBoxItem).Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
if (temp[2].VideoQuality != YouTubeQuality.Quality720P && size.Height >= 720)
|
||||||
|
{
|
||||||
|
temp.Insert(2, null);
|
||||||
|
(quality.Items[2] as ComboBoxItem).Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
if (temp[3].VideoQuality != YouTubeQuality.Quality480P && size.Height >= 480)
|
||||||
|
{
|
||||||
|
temp.Insert(3, null);
|
||||||
|
(quality.Items[3] as ComboBoxItem).Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
if (temp[4].VideoQuality != YouTubeQuality.Quality360P && size.Height >= 360)
|
||||||
|
{
|
||||||
|
temp.Insert(4, null);
|
||||||
|
(quality.Items[4] as ComboBoxItem).Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
if (temp[5].VideoQuality != YouTubeQuality.Quality240P)
|
||||||
|
{
|
||||||
|
temp.Insert(5, null);
|
||||||
|
(quality.Items[5] as ComboBoxItem).Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
qualityUris = temp;
|
||||||
|
|
||||||
|
foreach (YouTubeUri u in qualityUris)
|
||||||
|
Debug.WriteLine(u.VideoQuality);
|
||||||
|
|
||||||
|
int k = (int)settings.Values["quality"];
|
||||||
|
if(qualityUris[k] == null)
|
||||||
|
for(int a = k - 1; a == 0; a--)
|
||||||
|
if (qualityUris[a] != null)
|
||||||
|
{
|
||||||
|
k = a;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
quality.SelectedIndex = k;
|
||||||
|
|
||||||
|
/*YouTubeUri[] ytu = await YouTube.GetUrisAsync(id);
|
||||||
|
foreach (YouTubeUri uri in ytu)
|
||||||
|
{
|
||||||
|
Debug.WriteLine("URI: " + uri.Uri);
|
||||||
|
Debug.WriteLine("Has video: " + uri.HasVideo);
|
||||||
|
Debug.WriteLine("Type: " + uri.Type);
|
||||||
|
Debug.WriteLine("Video quality: " + uri.VideoQuality);
|
||||||
|
Debug.WriteLine("------------------------------------");
|
||||||
|
}
|
||||||
|
throw new Exception();
|
||||||
|
List<YouTubeUri> uris = new List<YouTubeUri>();
|
||||||
|
|
||||||
|
for (int i = 0; i < uris.Count; i++)
|
||||||
|
if (!uris[i].HasAudio)
|
||||||
|
uris.RemoveAt(i);
|
||||||
|
|
||||||
for (int i = 0; i < 8; i++)
|
for (int i = 0; i < 8; i++)
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -228,7 +389,7 @@ namespace FoxTube
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else quality.SelectedIndex = k;
|
else quality.SelectedIndex = k;*/
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SystemControls_Engaged(SystemMediaTransportControls sender, SystemMediaTransportControlsButtonPressedEventArgs args)
|
private void SystemControls_Engaged(SystemMediaTransportControls sender, SystemMediaTransportControlsButtonPressedEventArgs args)
|
||||||
@@ -273,17 +434,19 @@ namespace FoxTube
|
|||||||
controls.Visibility = Visibility.Collapsed;
|
controls.Visibility = Visibility.Collapsed;
|
||||||
if(!miniViewed)
|
if(!miniViewed)
|
||||||
touchCentral.Visibility = Visibility.Collapsed;
|
touchCentral.Visibility = Visibility.Collapsed;
|
||||||
/*if (pointerCaptured)
|
if (pointerCaptured)
|
||||||
{
|
|
||||||
cursorBackup = Window.Current.CoreWindow.PointerCursor;
|
|
||||||
Window.Current.CoreWindow.PointerCursor = null;
|
Window.Current.CoreWindow.PointerCursor = null;
|
||||||
}*/
|
|
||||||
t.Stop();
|
t.Stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UserControl_SizeChanged(object sender, SizeChangedEventArgs e)
|
public void UpdateSize()
|
||||||
{
|
{
|
||||||
|
if(miniViewed)
|
||||||
|
{
|
||||||
|
Height = Window.Current.Bounds.Height;
|
||||||
|
Debug.WriteLine("Video player aspect ratio has been corrected.");
|
||||||
|
}
|
||||||
//Height = e.NewSize.Width / 16 * 9;
|
//Height = e.NewSize.Width / 16 * 9;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -351,28 +514,27 @@ namespace FoxTube
|
|||||||
ShowControls();
|
ShowControls();
|
||||||
}
|
}
|
||||||
|
|
||||||
async void ShowControls()
|
void ShowControls()
|
||||||
{
|
{
|
||||||
if(controls.Visibility == Visibility.Collapsed)
|
if(controls.Visibility == Visibility.Collapsed)
|
||||||
{
|
{
|
||||||
controls.Visibility = Visibility.Visible;
|
controls.Visibility = Visibility.Visible;
|
||||||
//await controls.Fade(value: 1).StartAsync();
|
//await controls.Fade(value: 1).StartAsync();
|
||||||
}
|
}
|
||||||
/*if (pointerCaptured)
|
if (pointerCaptured)
|
||||||
Window.Current.CoreWindow.PointerCursor = cursorBackup;*/
|
Window.Current.CoreWindow.PointerCursor = cursorBackup;
|
||||||
t.Stop();
|
t.Stop();
|
||||||
t.Start();
|
t.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void quality_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
private void quality_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
{
|
{
|
||||||
if(videoId != null)
|
if(videoSource.Source != null)
|
||||||
{
|
{
|
||||||
videoSource.Pause();
|
videoSource.Pause();
|
||||||
TimeSpan timecode = videoSource.Position;
|
TimeSpan timecode = videoSource.Position;
|
||||||
|
|
||||||
YouTubeUri url = await YouTube.GetVideoUriAsync(videoId, qualities[quality.SelectedIndex]);
|
videoSource.Source = qualityUris[quality.SelectedIndex].Uri;
|
||||||
videoSource.Source = url.Uri;
|
|
||||||
|
|
||||||
videoSource.Position = timecode;
|
videoSource.Position = timecode;
|
||||||
videoSource.Play();
|
videoSource.Play();
|
||||||
@@ -386,23 +548,26 @@ namespace FoxTube
|
|||||||
|
|
||||||
private void fullscreen_Click(object sender, RoutedEventArgs e)
|
private void fullscreen_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
TimeSpan elapsedBakcup = new TimeSpan(videoSource.Position.Ticks);
|
videoSource.IsFullWindow = !videoSource.IsFullWindow;
|
||||||
|
|
||||||
|
/*SetFullSize.Invoke(this, null);
|
||||||
if (fullScreen)
|
if (fullScreen)
|
||||||
{
|
{
|
||||||
//SecretsVault.SubLayer.ExitFullScreen();
|
|
||||||
SetFullSize.Invoke(this, null);
|
|
||||||
ApplicationView.GetForCurrentView().ExitFullScreenMode();
|
ApplicationView.GetForCurrentView().ExitFullScreenMode();
|
||||||
|
Width = SecretsVault.MainPage.Width;
|
||||||
|
Height = SecretsVault.MainPage.Height;
|
||||||
fullscreen.Content = "";
|
fullscreen.Content = "";
|
||||||
fullScreen = false;
|
fullScreen = false;
|
||||||
|
SecretsVault.MainPage.Fullscreen(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//SecretsVault.SubLayer.EnterFullScreen(this);
|
|
||||||
fullScreen = ApplicationView.GetForCurrentView().TryEnterFullScreenMode();
|
fullScreen = ApplicationView.GetForCurrentView().TryEnterFullScreenMode();
|
||||||
SetFullSize.Invoke(this, null);
|
Width = double.NaN;
|
||||||
|
Height = double.NaN;
|
||||||
fullscreen.Content = "";
|
fullscreen.Content = "";
|
||||||
}
|
SecretsVault.MainPage.Fullscreen(true);
|
||||||
videoSource.Position = elapsedBakcup;
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
private void play_Click(object sender, RoutedEventArgs e)
|
private void play_Click(object sender, RoutedEventArgs e)
|
||||||
@@ -463,7 +628,8 @@ namespace FoxTube
|
|||||||
|
|
||||||
private async void miniView_Click(object sender, RoutedEventArgs e)
|
private async void miniView_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
TimeSpan elapsedBakcup = new TimeSpan(videoSource.Position.Ticks);
|
ApplicationViewTitleBar titleBar = ApplicationView.GetForCurrentView().TitleBar;
|
||||||
|
|
||||||
if (fullScreen)
|
if (fullScreen)
|
||||||
{
|
{
|
||||||
ApplicationView.GetForCurrentView().ExitFullScreenMode();
|
ApplicationView.GetForCurrentView().ExitFullScreenMode();
|
||||||
@@ -476,24 +642,45 @@ namespace FoxTube
|
|||||||
if (!miniViewed)
|
if (!miniViewed)
|
||||||
{
|
{
|
||||||
miniViewed = await ApplicationView.GetForCurrentView().TryEnterViewModeAsync(ApplicationViewMode.CompactOverlay);
|
miniViewed = await ApplicationView.GetForCurrentView().TryEnterViewModeAsync(ApplicationViewMode.CompactOverlay);
|
||||||
|
|
||||||
|
titleBar.ButtonBackgroundColor = Colors.Transparent;
|
||||||
|
titleBar.ButtonInactiveBackgroundColor = Colors.Transparent;
|
||||||
|
|
||||||
|
CoreApplicationViewTitleBar coreTitleBar = CoreApplication.GetCurrentView().TitleBar;
|
||||||
|
coreTitleBar.ExtendViewIntoTitleBar = true;
|
||||||
|
|
||||||
mainControls.Visibility = Visibility.Collapsed;
|
mainControls.Visibility = Visibility.Collapsed;
|
||||||
|
header.Visibility = Visibility.Collapsed;
|
||||||
|
|
||||||
touchCentral.Visibility = Visibility.Visible;
|
touchCentral.Visibility = Visibility.Visible;
|
||||||
miniViewExit.Visibility = Visibility.Visible;
|
miniViewExit.Visibility = Visibility.Visible;
|
||||||
header.Visibility = Visibility.Collapsed;
|
|
||||||
touchBack10.FontSize = touchFwd30.FontSize = 20;
|
touchBack10.FontSize = touchFwd30.FontSize = 20;
|
||||||
touchPlay.FontSize = 50;
|
touchPlay.FontSize = 50;
|
||||||
|
Methods.MainPage.Fullscreen(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
miniViewed = !await ApplicationView.GetForCurrentView().TryEnterViewModeAsync(ApplicationViewMode.Default);
|
miniViewed = !await ApplicationView.GetForCurrentView().TryEnterViewModeAsync(ApplicationViewMode.Default);
|
||||||
|
|
||||||
|
titleBar.ButtonBackgroundColor = titleBar.BackgroundColor = Colors.Red;
|
||||||
|
titleBar.ButtonInactiveBackgroundColor = Colors.Red;
|
||||||
|
titleBar.ButtonHoverBackgroundColor = Colors.IndianRed;
|
||||||
|
titleBar.ButtonPressedBackgroundColor = Colors.DarkRed;
|
||||||
|
|
||||||
|
CoreApplicationViewTitleBar coreTitleBar = CoreApplication.GetCurrentView().TitleBar;
|
||||||
|
coreTitleBar.ExtendViewIntoTitleBar = false;
|
||||||
|
|
||||||
mainControls.Visibility = Visibility.Visible;
|
mainControls.Visibility = Visibility.Visible;
|
||||||
|
header.Visibility = Visibility.Visible;
|
||||||
|
|
||||||
touchCentral.Visibility = Visibility.Collapsed;
|
touchCentral.Visibility = Visibility.Collapsed;
|
||||||
miniViewExit.Visibility = Visibility.Collapsed;
|
miniViewExit.Visibility = Visibility.Collapsed;
|
||||||
header.Visibility = Visibility.Visible;
|
|
||||||
touchBack10.FontSize = touchFwd30.FontSize = 40;
|
touchBack10.FontSize = touchFwd30.FontSize = 40;
|
||||||
touchPlay.FontSize = 100;
|
touchPlay.FontSize = 100;
|
||||||
|
Methods.MainPage.Fullscreen(false);
|
||||||
}
|
}
|
||||||
videoSource.Position = elapsedBakcup;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void seek_ValueChanged(object sender, RangeBaseValueChangedEventArgs e)
|
private void seek_ValueChanged(object sender, RangeBaseValueChangedEventArgs e)
|
||||||
@@ -539,5 +726,110 @@ namespace FoxTube
|
|||||||
{
|
{
|
||||||
NextClicked.Invoke(this, null);
|
NextClicked.Invoke(this, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void matureDismiss_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if ((bool)matureDisable.IsChecked)
|
||||||
|
settings.Values.Add("showMature", false);
|
||||||
|
matureBlock.Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void signin_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
Methods.MainPage.Vault.Authorize();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Pause()
|
||||||
|
{
|
||||||
|
videoSource.Pause();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void minimize_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if(fullScreen)
|
||||||
|
{
|
||||||
|
ApplicationView.GetForCurrentView().ExitFullScreenMode();
|
||||||
|
fullscreen.Content = "";
|
||||||
|
fullScreen = false;
|
||||||
|
Methods.MainPage.Fullscreen(false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
SetFullSize.Invoke(this, null);
|
||||||
|
|
||||||
|
Width = 432;
|
||||||
|
Height = 243;
|
||||||
|
|
||||||
|
Methods.MainPage.MinimizeVideo();
|
||||||
|
|
||||||
|
miniViewed = true;
|
||||||
|
mainControls.Visibility = Visibility.Collapsed;
|
||||||
|
header.Visibility = Visibility.Collapsed;
|
||||||
|
|
||||||
|
touchCentral.Visibility = Visibility.Visible;
|
||||||
|
maximize.Visibility = Visibility.Visible;
|
||||||
|
close.Visibility = Visibility.Visible;
|
||||||
|
|
||||||
|
touchBack10.FontSize = touchFwd30.FontSize = 20;
|
||||||
|
touchPlay.FontSize = 50;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void close_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
Methods.MainPage.CloseVideo();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void maximize_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
Methods.MainPage.MaximizeVideo();
|
||||||
|
SetFullSize.Invoke(this, null);
|
||||||
|
|
||||||
|
Width = double.NaN;
|
||||||
|
Height = double.NaN;
|
||||||
|
|
||||||
|
miniViewed = false;
|
||||||
|
mainControls.Visibility = Visibility.Visible;
|
||||||
|
header.Visibility = Visibility.Visible;
|
||||||
|
|
||||||
|
touchCentral.Visibility = Visibility.Collapsed;
|
||||||
|
maximize.Visibility = Visibility.Collapsed;
|
||||||
|
close.Visibility = Visibility.Collapsed;
|
||||||
|
|
||||||
|
touchBack10.FontSize = touchFwd30.FontSize = 40;
|
||||||
|
touchPlay.FontSize = 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void cast_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if(videoSource.Source != null)
|
||||||
|
{
|
||||||
|
if (videoSource.CurrentState != MediaElementState.Paused)
|
||||||
|
videoSource.Pause();
|
||||||
|
CastingDevicePicker picker = new CastingDevicePicker();
|
||||||
|
picker.Filter.SupportsVideo = true;
|
||||||
|
picker.CastingDeviceSelected += Picker_CastingDeviceSelected;
|
||||||
|
|
||||||
|
Point positinon = cast.TransformToVisual(Window.Current.Content).TransformPoint(new Point(0, 0));
|
||||||
|
|
||||||
|
picker.Show(new Rect(positinon.X, positinon.Y, cast.ActualWidth, cast.ActualHeight), Windows.UI.Popups.Placement.Below);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void Picker_CastingDeviceSelected(CastingDevicePicker sender, CastingDeviceSelectedEventArgs args)
|
||||||
|
{
|
||||||
|
CastingConnection connection = args.SelectedCastingDevice.CreateCastingConnection();
|
||||||
|
await connection.RequestStartCastingAsync(videoSource.GetAsCastingSource());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UserControl_DoubleTapped(object sender, DoubleTappedRoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (miniViewed && ApplicationView.GetForCurrentView().ViewMode == ApplicationViewMode.CompactOverlay)
|
||||||
|
miniView_Click(this, null);
|
||||||
|
else if (miniViewed && ApplicationView.GetForCurrentView().ViewMode == ApplicationViewMode.Default)
|
||||||
|
maximize_Click(this, null);
|
||||||
|
else if (fullScreen)
|
||||||
|
fullscreen_Click(this, null);
|
||||||
|
else if (!miniViewed && !fullScreen)
|
||||||
|
fullscreen_Click(this, null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+72
-46
@@ -18,7 +18,7 @@
|
|||||||
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||||
<WindowsXamlEnableOverview>true</WindowsXamlEnableOverview>
|
<WindowsXamlEnableOverview>true</WindowsXamlEnableOverview>
|
||||||
<PackageCertificateKeyFile>FoxTube_TemporaryKey.pfx</PackageCertificateKeyFile>
|
<PackageCertificateKeyFile>FoxTube_TemporaryKey.pfx</PackageCertificateKeyFile>
|
||||||
<PackageCertificateThumbprint>965BA230AF9DB31698CAE7A94DE7CA256841AEE0</PackageCertificateThumbprint>
|
<PackageCertificateThumbprint>E33236F6F6066A373DFA92A7B7C1467B1EF0BA81</PackageCertificateThumbprint>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||||
<DebugSymbols>true</DebugSymbols>
|
<DebugSymbols>true</DebugSymbols>
|
||||||
@@ -96,58 +96,68 @@
|
|||||||
<Compile Include="App.xaml.cs">
|
<Compile Include="App.xaml.cs">
|
||||||
<DependentUpon>App.xaml</DependentUpon>
|
<DependentUpon>App.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Channel.xaml.cs">
|
<Compile Include="Classes\Methods.cs" />
|
||||||
|
<Compile Include="Controls\CommentCard.xaml.cs">
|
||||||
|
<DependentUpon>CommentCard.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Pages\Channel.xaml.cs">
|
||||||
<DependentUpon>Channel.xaml</DependentUpon>
|
<DependentUpon>Channel.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="ChannelCard.xaml.cs">
|
<Compile Include="Controls\ChannelCard.xaml.cs">
|
||||||
<DependentUpon>ChannelCard.xaml</DependentUpon>
|
<DependentUpon>ChannelCard.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Feedback.xaml.cs">
|
<Compile Include="Pages\CommentsPage.xaml.cs">
|
||||||
|
<DependentUpon>CommentsPage.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Pages\Feedback.xaml.cs">
|
||||||
<DependentUpon>Feedback.xaml</DependentUpon>
|
<DependentUpon>Feedback.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="General.xaml.cs">
|
<Compile Include="Pages\General.xaml.cs">
|
||||||
<DependentUpon>General.xaml</DependentUpon>
|
<DependentUpon>General.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Home.xaml.cs">
|
<Compile Include="Pages\Home.xaml.cs">
|
||||||
<DependentUpon>Home.xaml</DependentUpon>
|
<DependentUpon>Home.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="LoadingPage.xaml.cs">
|
<Compile Include="Pages\LoadingPage.xaml.cs">
|
||||||
<DependentUpon>LoadingPage.xaml</DependentUpon>
|
<DependentUpon>LoadingPage.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="MainPage.xaml.cs">
|
<Compile Include="Pages\MainPage.xaml.cs">
|
||||||
<DependentUpon>MainPage.xaml</DependentUpon>
|
<DependentUpon>MainPage.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Notification.cs" />
|
<Compile Include="Classes\Notification.cs" />
|
||||||
<Compile Include="PlaylistCardWide.xaml.cs">
|
<Compile Include="Controls\NotificationsCenter.xaml.cs">
|
||||||
|
<DependentUpon>NotificationsCenter.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Controls\PlaylistCardWide.xaml.cs">
|
||||||
<DependentUpon>PlaylistCardWide.xaml</DependentUpon>
|
<DependentUpon>PlaylistCardWide.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="Search.xaml.cs">
|
<Compile Include="Pages\Search.xaml.cs">
|
||||||
<DependentUpon>Search.xaml</DependentUpon>
|
<DependentUpon>Search.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="SecretsVault.cs" />
|
<Compile Include="Classes\SecretsVault.cs" />
|
||||||
<Compile Include="Settings.xaml.cs">
|
<Compile Include="Pages\Settings.xaml.cs">
|
||||||
<DependentUpon>Settings.xaml</DependentUpon>
|
<DependentUpon>Settings.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="SubLayer.xaml.cs">
|
<Compile Include="SubLayer.xaml.cs">
|
||||||
<DependentUpon>SubLayer.xaml</DependentUpon>
|
<DependentUpon>SubLayer.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Translate.xaml.cs">
|
<Compile Include="Pages\Translate.xaml.cs">
|
||||||
<DependentUpon>Translate.xaml</DependentUpon>
|
<DependentUpon>Translate.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Video.xaml.cs">
|
<Compile Include="Pages\Video.xaml.cs">
|
||||||
<DependentUpon>Video.xaml</DependentUpon>
|
<DependentUpon>Video.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="VideoCard.xaml.cs">
|
<Compile Include="Controls\VideoCard.xaml.cs">
|
||||||
<DependentUpon>VideoCard.xaml</DependentUpon>
|
<DependentUpon>VideoCard.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="VideoCardWide.xaml.cs">
|
<Compile Include="Controls\VideoCardWide.xaml.cs">
|
||||||
<DependentUpon>VideoCardWide.xaml</DependentUpon>
|
<DependentUpon>VideoCardWide.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="VideoGrid.xaml.cs">
|
<Compile Include="Pages\VideoGrid.xaml.cs">
|
||||||
<DependentUpon>VideoGrid.xaml</DependentUpon>
|
<DependentUpon>VideoGrid.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="VideoPlayer.xaml.cs">
|
<Compile Include="Controls\VideoPlayer.xaml.cs">
|
||||||
<DependentUpon>VideoPlayer.xaml</DependentUpon>
|
<DependentUpon>VideoPlayer.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
@@ -155,7 +165,6 @@
|
|||||||
<AppxManifest Include="Package.appxmanifest">
|
<AppxManifest Include="Package.appxmanifest">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</AppxManifest>
|
</AppxManifest>
|
||||||
<None Include="FoxTube_TemporaryKey.pfx" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="Assets\AnnouncementThumb.png" />
|
<Content Include="Assets\AnnouncementThumb.png" />
|
||||||
@@ -218,43 +227,55 @@
|
|||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</ApplicationDefinition>
|
</ApplicationDefinition>
|
||||||
<Page Include="Channel.xaml">
|
<Page Include="Controls\CommentCard.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
<Page Include="ChannelCard.xaml">
|
<Page Include="Pages\Channel.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
<Page Include="Feedback.xaml">
|
<Page Include="Controls\ChannelCard.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
<Page Include="General.xaml">
|
<Page Include="Pages\CommentsPage.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
<Page Include="Home.xaml">
|
<Page Include="Pages\Feedback.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
<Page Include="LoadingPage.xaml">
|
<Page Include="Pages\General.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
<Page Include="MainPage.xaml">
|
<Page Include="Pages\Home.xaml">
|
||||||
<Generator>MSBuild:Compile</Generator>
|
|
||||||
<SubType>Designer</SubType>
|
|
||||||
</Page>
|
|
||||||
<Page Include="PlaylistCardWide.xaml">
|
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
<Page Include="Search.xaml">
|
<Page Include="Pages\LoadingPage.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
<Page Include="Settings.xaml">
|
<Page Include="Pages\MainPage.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
|
<Page Include="Controls\NotificationsCenter.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
|
<Page Include="Controls\PlaylistCardWide.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
|
<Page Include="Pages\Search.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
|
<Page Include="Pages\Settings.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
@@ -262,27 +283,27 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
<Page Include="Translate.xaml">
|
<Page Include="Pages\Translate.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
<Page Include="Video.xaml">
|
<Page Include="Pages\Video.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
<Page Include="VideoCard.xaml">
|
<Page Include="Controls\VideoCard.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
<Page Include="VideoCardWide.xaml">
|
<Page Include="Controls\VideoCardWide.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
<Page Include="VideoGrid.xaml">
|
<Page Include="Pages\VideoGrid.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
<Page Include="VideoPlayer.xaml">
|
<Page Include="Controls\VideoPlayer.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
@@ -292,22 +313,25 @@
|
|||||||
<Version>1.0.1</Version>
|
<Version>1.0.1</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Google.Apis">
|
<PackageReference Include="Google.Apis">
|
||||||
<Version>1.32.2</Version>
|
<Version>1.34.0</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Google.Apis.Auth">
|
<PackageReference Include="Google.Apis.Auth">
|
||||||
<Version>1.32.2</Version>
|
<Version>1.34.0</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Google.Apis.Core">
|
<PackageReference Include="Google.Apis.Core">
|
||||||
<Version>1.32.2</Version>
|
<Version>1.34.0</Version>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="Google.Apis.Oauth2.v2">
|
||||||
|
<Version>1.34.0.1134</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Google.Apis.YouTube.v3">
|
<PackageReference Include="Google.Apis.YouTube.v3">
|
||||||
<Version>1.32.2.1198</Version>
|
<Version>1.34.0.1226</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
|
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
|
||||||
<Version>6.0.8</Version>
|
<Version>6.1.5</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.Toolkit.Uwp.Notifications">
|
<PackageReference Include="Microsoft.Toolkit.Uwp.Notifications">
|
||||||
<Version>2.2.0</Version>
|
<Version>3.0.0</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.Toolkit.Uwp.UI.Controls">
|
<PackageReference Include="Microsoft.Toolkit.Uwp.UI.Controls">
|
||||||
<Version>3.0.0</Version>
|
<Version>3.0.0</Version>
|
||||||
@@ -319,7 +343,9 @@
|
|||||||
<Version>4.3.1</Version>
|
<Version>4.3.1</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup />
|
<ItemGroup>
|
||||||
|
<None Include="FoxTube_TemporaryKey.pfx" />
|
||||||
|
</ItemGroup>
|
||||||
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '14.0' ">
|
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '14.0' ">
|
||||||
<VisualStudioVersion>14.0</VisualStudioVersion>
|
<VisualStudioVersion>14.0</VisualStudioVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|||||||
@@ -1,217 +0,0 @@
|
|||||||
<Page
|
|
||||||
x:Class="FoxTube.MainPage"
|
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
||||||
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"
|
|
||||||
SizeChanged="Page_SizeChanged">
|
|
||||||
|
|
||||||
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
|
||||||
<Grid.RowDefinitions>
|
|
||||||
<RowDefinition Height="50" />
|
|
||||||
<RowDefinition Height="*" />
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
<Grid Grid.Row="0" Background="Red">
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition Width="50" />
|
|
||||||
<ColumnDefinition Width="*"/>
|
|
||||||
<ColumnDefinition Width="50"/>
|
|
||||||
<ColumnDefinition Width="50"/>
|
|
||||||
<ColumnDefinition Width="4"/>
|
|
||||||
<ColumnDefinition Width="50"/>
|
|
||||||
<ColumnDefinition Width="50"/>
|
|
||||||
<ColumnDefinition Width="50"/>
|
|
||||||
<ColumnDefinition Width="50"/>
|
|
||||||
<ColumnDefinition Width="350"/>
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<Button Name="menuButton"
|
|
||||||
FontFamily="Segoe MDL2 Assets" FontSize="20" Content=""
|
|
||||||
Foreground="White" Background="Red"
|
|
||||||
Grid.Column="0"
|
|
||||||
Click="menuButton_Click"
|
|
||||||
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
|
|
||||||
<TextBlock Grid.Column="1" Text="Home" FontSize="20" FontWeight="Bold" Margin="5, 0, 0, 0" HorizontalAlignment="Left" VerticalAlignment="Center" Foreground="White" Name="headerText"/>
|
|
||||||
<Button Name="goLive" Grid.Column="2" ToolTipService.ToolTip="Go to Live!" Visibility="Collapsed"
|
|
||||||
FontFamily="Segoe MDL2 Assets" Content="" Foreground="White"
|
|
||||||
Width="50" Height="50" Background="#00000000" RelativePanel.LeftOf="searchField"/>
|
|
||||||
<Button Name="upload" Grid.Column="3" ToolTipService.ToolTip="Upload a video" Visibility="Collapsed"
|
|
||||||
FontFamily="Segoe MDL2 Assets" Content="" Foreground="White"
|
|
||||||
Width="50" Height="50" Background="#00000000" RelativePanel.LeftOf="searchField"/>
|
|
||||||
<Line Grid.Column="4" Y1="40" Y2="10" StrokeThickness="1" Stroke="White" HorizontalAlignment="Center" Visibility="Collapsed"/>
|
|
||||||
<Button Name="notificationMenu" Grid.Column="5" ToolTipService.ToolTip="Notifications" Click="notification_Click"
|
|
||||||
FontFamily="Segoe MDL2 Assets" Content="" Foreground="White"
|
|
||||||
Width="50" Height="50" Background="#00000000" RelativePanel.LeftOf="searchField"/>
|
|
||||||
<Button Name="openBrowser" Grid.Column="6" ToolTipService.ToolTip="Open page in browser" Click="notification_Click"
|
|
||||||
FontFamily="Segoe MDL2 Assets" Content="" Foreground="White"
|
|
||||||
Width="50" Height="50" Background="#00000000" RelativePanel.LeftOf="searchField"/>
|
|
||||||
<Popup Grid.Column="6" Margin="0,50,0,0" Name="notificationPane" IsOpen="False" IsLightDismissEnabled="True">
|
|
||||||
<StackPanel Width="350" Background="WhiteSmoke" Padding="0,10,0,0">
|
|
||||||
<TextBlock Text="Notifications" HorizontalAlignment="Center" FontWeight="Bold"/>
|
|
||||||
<StackPanel Margin="0,10,0,0">
|
|
||||||
<TextBlock Text="You have no any notification" Name="noNotifText" Foreground="Gray" FontStyle="Italic" Padding="10" Visibility="Visible"/>
|
|
||||||
<StackPanel Name="notificationPanel" Visibility="Collapsed">
|
|
||||||
<ListBox Width="350" Padding="0,0,0,10" Name="notificationArray">
|
|
||||||
|
|
||||||
</ListBox>
|
|
||||||
<Button Content="Clear all" HorizontalAlignment="Right" Margin="10,0,10,10" Name="clearNotifications" Click="clearNotifications_Click"/>
|
|
||||||
</StackPanel>
|
|
||||||
</StackPanel>
|
|
||||||
</StackPanel>
|
|
||||||
</Popup>
|
|
||||||
<Button Name="feddback" Grid.Column="7" ToolTipService.ToolTip="Send feedback" Click="feddback_Click"
|
|
||||||
FontFamily="Segoe MDL2 Assets" Content="" Foreground="White"
|
|
||||||
Width="50" Height="50" Background="#00000000" RelativePanel.LeftOf="searchField"/>
|
|
||||||
<Button Name="account" Grid.Column="8" ToolTipService.ToolTip="Sign in"
|
|
||||||
FontFamily="Segoe MDL2 Assets" Content="" Foreground="White"
|
|
||||||
Width="50" Height="50" Background="#00000000" RelativePanel.LeftOf="searchField">
|
|
||||||
<Button.Flyout>
|
|
||||||
<MenuFlyout>
|
|
||||||
<MenuFlyoutItem Text="Sign in with existing account" Name="signIn" Click="signIn_Click"/>
|
|
||||||
<MenuFlyoutItem Text="Create a new Google account" Name="createAccount" Click="createAccount_Click"/>
|
|
||||||
</MenuFlyout>
|
|
||||||
</Button.Flyout>
|
|
||||||
</Button>
|
|
||||||
<Button Grid.Column="8" Padding="0" Width="50" Height="50" Visibility="Collapsed" Name="LoggedAvatar" Click="LoggedAvatar_Click">
|
|
||||||
<PersonPicture Width="30"/>
|
|
||||||
</Button>
|
|
||||||
<Popup Grid.Column="8" Margin="0,50,0,0" IsOpen="False" IsLightDismissEnabled="True" Name="AccountManagement">
|
|
||||||
<StackPanel Width="300" Background="WhiteSmoke">
|
|
||||||
<ListBox>
|
|
||||||
<ListBoxItem Height="75">
|
|
||||||
<StackPanel Orientation="Horizontal">
|
|
||||||
<!--<Ellipse Height="50" Width="50" >
|
|
||||||
<Ellipse.Fill>
|
|
||||||
<ImageBrush ImageSource="Assets/Square150x150Logo.scale-100.png" Stretch="UniformToFill"/>
|
|
||||||
</Ellipse.Fill>
|
|
||||||
</Ellipse>-->
|
|
||||||
<PersonPicture Height="50" Margin="0,0,5,0"></PersonPicture>
|
|
||||||
<!--<Image Width="50" Height="50" Source="Assets/Square150x150Logo.scale-100.png" Margin="0,0,5,0" />-->
|
|
||||||
<StackPanel VerticalAlignment="Center">
|
|
||||||
<TextBlock Text="Account name"/>
|
|
||||||
<TextBlock Foreground="Gray" FontStyle="Italic" Text="example@mail.com"/>
|
|
||||||
</StackPanel>
|
|
||||||
</StackPanel>
|
|
||||||
</ListBoxItem>
|
|
||||||
<ListBoxItem>
|
|
||||||
<TextBlock Text="Add another account"/>
|
|
||||||
</ListBoxItem>
|
|
||||||
<ListBoxItem Height="10" Margin="0" Padding="0" IsEnabled="False">
|
|
||||||
<Line X1="10" X2="290" Stroke="Gray" StrokeThickness="2"/>
|
|
||||||
</ListBoxItem>
|
|
||||||
<ListBoxItem>
|
|
||||||
<TextBlock Text="Log out"/>
|
|
||||||
</ListBoxItem>
|
|
||||||
</ListBox>
|
|
||||||
</StackPanel>
|
|
||||||
</Popup>
|
|
||||||
<TextBox KeyUp="searchField_KeyUp" Name="searchField" Grid.Column="9" ToolTipService.ToolTip="Search" Margin="4" Width="350" Height="50" Padding="14,10,5,0" PlaceholderText="Search" BorderThickness="0" Background="#7FFFFFFF" Text="" TextChanged="searchField_TextChanged" LostFocus="searchField_LostFocus"/>
|
|
||||||
<Button Name="searchButton" Grid.Column="9" HorizontalAlignment="Right" Click="searchButton_Click"
|
|
||||||
Width="42" Height="42" Margin="4"
|
|
||||||
RelativePanel.AlignRightWithPanel="True"
|
|
||||||
Background="Transparent"
|
|
||||||
FontFamily="Segoe MDL2 Assets" Content="" FontSize="20" Foreground="Black"/>
|
|
||||||
<Popup Margin="0,50,0,0" Grid.Column="9" Name="searchSuggestions" IsOpen="True" Visibility="Collapsed">
|
|
||||||
<StackPanel Background="WhiteSmoke" Width="350">
|
|
||||||
<StackPanel Width="350" Name="searchStandby" Visibility="Visible" Margin="10">
|
|
||||||
<TextBlock Text="Loading results... Please, wait."/>
|
|
||||||
<ProgressBar IsIndeterminate="True"/>
|
|
||||||
</StackPanel>
|
|
||||||
<ListBox Name="searchSuggestionsList" Visibility="Visible" SelectionChanged="searchSuggestionsList_SelectionChanged">
|
|
||||||
|
|
||||||
</ListBox>
|
|
||||||
</StackPanel>
|
|
||||||
</Popup>
|
|
||||||
</Grid>
|
|
||||||
<SplitView Name="menu" Grid.Row="1" OpenPaneLength="250" CompactPaneLength="50" DisplayMode="CompactInline" IsPaneOpen="True" PaneClosing="menu_PaneClosed" PaneOpening="menu_PaneOpened">
|
|
||||||
<SplitView.Pane>
|
|
||||||
<RelativePanel>
|
|
||||||
<ListBox SelectionChanged="ListBox_SelectionChanged" Name="topHamburger">
|
|
||||||
<ListBoxItem Name="homeMenu" IsSelected="True">
|
|
||||||
<StackPanel Orientation="Horizontal">
|
|
||||||
<TextBlock Style="{StaticResource ItemIcon}" Text=""/>
|
|
||||||
<TextBlock Style="{StaticResource MenuItem}" Text="Home"/>
|
|
||||||
</StackPanel>
|
|
||||||
</ListBoxItem>
|
|
||||||
<ListBoxItem Name="gamingMenu">
|
|
||||||
<StackPanel Orientation="Horizontal">
|
|
||||||
<TextBlock Style="{StaticResource ItemIcon}" Text=""/>
|
|
||||||
<TextBlock Style="{StaticResource MenuItem}" Text="Gaming"/>
|
|
||||||
</StackPanel>
|
|
||||||
</ListBoxItem>
|
|
||||||
<ListBoxItem Name="historyMenu" Visibility="Collapsed">
|
|
||||||
<StackPanel Orientation="Horizontal">
|
|
||||||
<TextBlock Style="{StaticResource ItemIcon}" Text=""/>
|
|
||||||
<TextBlock Style="{StaticResource MenuItem}" Text="History"/>
|
|
||||||
</StackPanel>
|
|
||||||
</ListBoxItem>
|
|
||||||
<ListBoxItem Name="likedMenu" Visibility="Collapsed">
|
|
||||||
<StackPanel Orientation="Horizontal">
|
|
||||||
<TextBlock Style="{StaticResource ItemIcon}" Text=""/>
|
|
||||||
<TextBlock Style="{StaticResource MenuItem}" Text="Liked videos"/>
|
|
||||||
</StackPanel>
|
|
||||||
</ListBoxItem>
|
|
||||||
<ListBoxItem Name="watchLaterMenu" Visibility="Collapsed">
|
|
||||||
<StackPanel Orientation="Horizontal">
|
|
||||||
<TextBlock Style="{StaticResource ItemIcon}" Text=""/>
|
|
||||||
<TextBlock Style="{StaticResource MenuItem}" Text="Watch later"/>
|
|
||||||
</StackPanel>
|
|
||||||
</ListBoxItem>
|
|
||||||
<ListBoxItem Name="subscriptionsTitle" Height="17" Margin="0" Padding="5, 0, 0, 0" IsEnabled="False">
|
|
||||||
<StackPanel Orientation="Horizontal" Margin="0" Padding="0, 0, 0, 0">
|
|
||||||
<TextBlock Name="subsMenuTitle" Text="Subscriptions" Foreground="Gray" FontSize="12" Margin="0" Padding="0, 0, 5, 0"/>
|
|
||||||
<Line Name="subsMenuStroke" X1="0" Y1="10" X2="165" Y2="10" Stroke="Gray" StrokeThickness="2"/>
|
|
||||||
</StackPanel>
|
|
||||||
</ListBoxItem>
|
|
||||||
<ListBoxItem Height="100" IsEnabled="False" Name="subsLogErr" Visibility="Visible" VerticalContentAlignment="Top">
|
|
||||||
<StackPanel Orientation="Horizontal">
|
|
||||||
<TextBlock FontFamily="Default, Segoe MDL2 Assets" Text="Press  and add an account to see your featured channels and another useful stuff here" Width="225" HorizontalTextAlignment="Center" Foreground="Gray" TextWrapping="WrapWholeWords"/>
|
|
||||||
</StackPanel>
|
|
||||||
</ListBoxItem>
|
|
||||||
</ListBox>
|
|
||||||
<ListBox RelativePanel.Below="topHamburger" Visibility="Collapsed">
|
|
||||||
<ListBoxItem>
|
|
||||||
<StackPanel Orientation="Horizontal">
|
|
||||||
<PersonPicture Height="23" Margin="0,0,17,0" Padding="0"/>
|
|
||||||
<TextBlock Style="{StaticResource MenuItem}" Text="Channel name"/>
|
|
||||||
</StackPanel>
|
|
||||||
</ListBoxItem>
|
|
||||||
</ListBox>
|
|
||||||
<ListBox RelativePanel.AlignBottomWithPanel="True" SelectionChanged="bottomHaburgerSelectionChanged" Name="bottomHaburger">
|
|
||||||
<ListBoxItem Padding="0" IsEnabled="False">
|
|
||||||
<Line X1="0" X2="250" Stroke="Black" StrokeThickness="1"/>
|
|
||||||
</ListBoxItem>
|
|
||||||
<ListBoxItem Name="channelMenu" Visibility="Collapsed">
|
|
||||||
<StackPanel Orientation="Horizontal">
|
|
||||||
<TextBlock Style="{StaticResource ItemIcon}" Text=""/>
|
|
||||||
<TextBlock Style="{StaticResource MenuItem}" Text="My channel"/>
|
|
||||||
</StackPanel>
|
|
||||||
</ListBoxItem>
|
|
||||||
<ListBoxItem Name="dashboardMenu" Visibility="Collapsed">
|
|
||||||
<StackPanel Orientation="Horizontal">
|
|
||||||
<TextBlock Style="{StaticResource ItemIcon}" Text=""/>
|
|
||||||
<TextBlock Style="{StaticResource MenuItem}" Text="Creator studio"/>
|
|
||||||
</StackPanel>
|
|
||||||
</ListBoxItem>
|
|
||||||
<ListBoxItem Name="noadsMenu" Visibility="Visible">
|
|
||||||
<StackPanel Orientation="Horizontal">
|
|
||||||
<TextBlock Style="{StaticResource ItemIcon}" Text=""/>
|
|
||||||
<TextBlock Style="{StaticResource MenuItem}" Text="Remove ads (2$)"/>
|
|
||||||
</StackPanel>
|
|
||||||
</ListBoxItem>
|
|
||||||
<ListBoxItem Name="settingsMenu">
|
|
||||||
<StackPanel Orientation="Horizontal">
|
|
||||||
<TextBlock Style="{StaticResource ItemIcon}" Text=""/>
|
|
||||||
<TextBlock Style="{StaticResource MenuItem}" Text="Settings"/>
|
|
||||||
</StackPanel>
|
|
||||||
</ListBoxItem>
|
|
||||||
</ListBox>
|
|
||||||
</RelativePanel>
|
|
||||||
</SplitView.Pane>
|
|
||||||
<SplitView.Content>
|
|
||||||
<Frame Name="content"/>
|
|
||||||
</SplitView.Content>
|
|
||||||
</SplitView>
|
|
||||||
</Grid>
|
|
||||||
</Page>
|
|
||||||
@@ -47,7 +47,7 @@ namespace FoxTube
|
|||||||
{
|
{
|
||||||
channelId = id;
|
channelId = id;
|
||||||
|
|
||||||
YouTubeService ytService = SecretsVault.YoutubeService;
|
YouTubeService ytService = SecretsVault.NoAuthService;
|
||||||
|
|
||||||
ChannelsResource.ListRequest request = ytService.Channels.List("snippet,contentDetails,statistics,brandingSettings");
|
ChannelsResource.ListRequest request = ytService.Channels.List("snippet,contentDetails,statistics,brandingSettings");
|
||||||
request.Id = id;
|
request.Id = id;
|
||||||
@@ -99,7 +99,7 @@ namespace FoxTube
|
|||||||
{
|
{
|
||||||
content.SelectedIndex = 3;
|
content.SelectedIndex = 3;
|
||||||
|
|
||||||
YouTubeService ytService = SecretsVault.YoutubeService;
|
YouTubeService ytService = SecretsVault.NoAuthService;
|
||||||
|
|
||||||
var searchListRequest = ytService.Search.List("snippet");
|
var searchListRequest = ytService.Search.List("snippet");
|
||||||
searchListRequest.Q = searchField.Text;
|
searchListRequest.Q = searchField.Text;
|
||||||
@@ -151,7 +151,7 @@ namespace FoxTube
|
|||||||
|
|
||||||
if (playlists.Children.Count == 0)
|
if (playlists.Children.Count == 0)
|
||||||
{
|
{
|
||||||
YouTubeService ytService = SecretsVault.YoutubeService;
|
YouTubeService ytService = SecretsVault.NoAuthService;
|
||||||
|
|
||||||
PlaylistsResource.ListRequest request = ytService.Playlists.List("snippet,contentDetails");
|
PlaylistsResource.ListRequest request = ytService.Playlists.List("snippet,contentDetails");
|
||||||
request.MaxResults = 25;
|
request.MaxResults = 25;
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
<Page
|
||||||
|
x:Class="FoxTube.Pages.CommentsPage"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
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="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||||
|
|
||||||
|
<Grid Background="White" Name="grid">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="auto"/>
|
||||||
|
<RowDefinition/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid Background="Red">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="auto"/>
|
||||||
|
<RowDefinition Height="30"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<TextBox Margin="5,5,42,5" PlaceholderText="Add a public comment" VerticalAlignment="Center" MinHeight="32" MaxHeight="100" Height="auto" AcceptsReturn="True"/>
|
||||||
|
<Button HorizontalAlignment="Right" VerticalAlignment="Top"
|
||||||
|
Height="32" Width="32"
|
||||||
|
Margin="0,5,5,0" Padding="0"
|
||||||
|
Background="Transparent" Foreground="White"
|
||||||
|
FontFamily="Segoe MDL2 Assets"
|
||||||
|
Content="" FontSize="30" ToolTipService.ToolTip="Post comment"/>
|
||||||
|
|
||||||
|
<TextBlock Name="counter" Grid.Row="1" Text="[Comments count] Comments" Margin="5,0,0,0" VerticalAlignment="Center" Foreground="White" FontWeight="SemiBold"/>
|
||||||
|
<StackPanel Padding="0" Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,0,10,0">
|
||||||
|
<TextBlock Text="Sort by: " Foreground="White" VerticalAlignment="Center" Margin="0,0,5,0"/>
|
||||||
|
<Button Name="orderBtn" Background="Transparent" Content="Relevance" Foreground="DeepSkyBlue" Padding="0" VerticalAlignment="Center">
|
||||||
|
|
||||||
|
<Button.Flyout>
|
||||||
|
<MenuFlyout>
|
||||||
|
<MenuFlyoutItem Click="toRelevance_Click" Name="toRelevance" Text="Relevance"/>
|
||||||
|
<MenuFlyoutItem Click="toDate_Click" Name="toDate" Text="Date"/>
|
||||||
|
</MenuFlyout>
|
||||||
|
</Button.Flyout>
|
||||||
|
</Button>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<ScrollViewer Grid.Row="1">
|
||||||
|
<StackPanel>
|
||||||
|
<StackPanel Name="placeholder"/>
|
||||||
|
<HyperlinkButton Name="more" Click="more_Click" HorizontalAlignment="Center" Foreground="Red" Content="Show more"/>
|
||||||
|
<ProgressBar Name="moreLoading" Visibility="Collapsed" IsIndeterminate="True" Foreground="Red"/>
|
||||||
|
</StackPanel>
|
||||||
|
</ScrollViewer>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</Page>
|
||||||
@@ -0,0 +1,137 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Runtime.InteropServices.WindowsRuntime;
|
||||||
|
using Windows.Foundation;
|
||||||
|
using Windows.Foundation.Collections;
|
||||||
|
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;
|
||||||
|
|
||||||
|
using Google.Apis.YouTube.v3;
|
||||||
|
using Google.Apis.YouTube.v3.Data;
|
||||||
|
using FoxTube.Controls;
|
||||||
|
|
||||||
|
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
|
||||||
|
|
||||||
|
namespace FoxTube.Pages
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// An empty page that can be used on its own or navigated to within a Frame.
|
||||||
|
/// </summary>
|
||||||
|
public sealed partial class CommentsPage : Page
|
||||||
|
{
|
||||||
|
string threadId;
|
||||||
|
string nextPageToken;
|
||||||
|
|
||||||
|
CommentThreadsResource.ListRequest.OrderEnum order = CommentThreadsResource.ListRequest.OrderEnum.Relevance;
|
||||||
|
|
||||||
|
public CommentsPage()
|
||||||
|
{
|
||||||
|
this.InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async void Initialize(Google.Apis.YouTube.v3.Data.Video video)
|
||||||
|
{
|
||||||
|
threadId = video.Id;
|
||||||
|
|
||||||
|
counter.Text = string.Format("{0:0,0} Comments", video.Statistics.CommentCount);
|
||||||
|
|
||||||
|
var request = SecretsVault.NoAuthService.CommentThreads.List("snippet,replies");
|
||||||
|
request.Order = order;
|
||||||
|
request.VideoId = video.Id;
|
||||||
|
request.TextFormat = CommentThreadsResource.ListRequest.TextFormatEnum.PlainText;
|
||||||
|
var response = await request.ExecuteAsync();
|
||||||
|
|
||||||
|
if(response.NextPageToken != null)
|
||||||
|
{
|
||||||
|
nextPageToken = response.NextPageToken;
|
||||||
|
more.Visibility = Visibility.Visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (CommentThread comment in response.Items)
|
||||||
|
placeholder.Children.Add(new CommentCard(comment));
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void more_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
more.Visibility = Visibility.Collapsed;
|
||||||
|
moreLoading.Visibility = Visibility.Visible;
|
||||||
|
|
||||||
|
var request = SecretsVault.NoAuthService.CommentThreads.List("snippet,replies");
|
||||||
|
request.Order = order;
|
||||||
|
request.VideoId = threadId;
|
||||||
|
request.TextFormat = CommentThreadsResource.ListRequest.TextFormatEnum.PlainText;
|
||||||
|
request.PageToken = nextPageToken;
|
||||||
|
var response = await request.ExecuteAsync();
|
||||||
|
|
||||||
|
foreach (CommentThread comment in response.Items)
|
||||||
|
placeholder.Children.Add(new CommentCard(comment));
|
||||||
|
|
||||||
|
if(response.NextPageToken != null)
|
||||||
|
{
|
||||||
|
nextPageToken = response.NextPageToken;
|
||||||
|
more.Visibility = Visibility.Visible;
|
||||||
|
}
|
||||||
|
moreLoading.Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void toRelevance_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if(order != CommentThreadsResource.ListRequest.OrderEnum.Relevance)
|
||||||
|
{
|
||||||
|
more.Visibility = Visibility.Collapsed;
|
||||||
|
moreLoading.Visibility = Visibility.Visible;
|
||||||
|
|
||||||
|
order = CommentThreadsResource.ListRequest.OrderEnum.Relevance;
|
||||||
|
orderBtn.Content = "Relevance";
|
||||||
|
|
||||||
|
placeholder.Children.Clear();
|
||||||
|
|
||||||
|
var request = SecretsVault.NoAuthService.CommentThreads.List("snippet,replies");
|
||||||
|
request.Order = order;
|
||||||
|
request.VideoId = threadId;
|
||||||
|
request.TextFormat = CommentThreadsResource.ListRequest.TextFormatEnum.PlainText;
|
||||||
|
var response = await request.ExecuteAsync();
|
||||||
|
|
||||||
|
nextPageToken = response.NextPageToken;
|
||||||
|
foreach (CommentThread comment in response.Items)
|
||||||
|
placeholder.Children.Add(new CommentCard(comment));
|
||||||
|
|
||||||
|
more.Visibility = Visibility.Visible;
|
||||||
|
moreLoading.Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void toDate_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (order != CommentThreadsResource.ListRequest.OrderEnum.Time)
|
||||||
|
{
|
||||||
|
more.Visibility = Visibility.Collapsed;
|
||||||
|
moreLoading.Visibility = Visibility.Visible;
|
||||||
|
|
||||||
|
order = CommentThreadsResource.ListRequest.OrderEnum.Time;
|
||||||
|
orderBtn.Content = "Publish date";
|
||||||
|
|
||||||
|
placeholder.Children.Clear();
|
||||||
|
|
||||||
|
var request = SecretsVault.NoAuthService.CommentThreads.List("snippet,replies");
|
||||||
|
request.Order = order;
|
||||||
|
request.VideoId = threadId;
|
||||||
|
var response = await request.ExecuteAsync();
|
||||||
|
|
||||||
|
nextPageToken = response.NextPageToken;
|
||||||
|
foreach (CommentThread comment in response.Items)
|
||||||
|
placeholder.Children.Add(new CommentCard(comment));
|
||||||
|
|
||||||
|
more.Visibility = Visibility.Visible;
|
||||||
|
moreLoading.Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -101,7 +101,7 @@ namespace FoxTube
|
|||||||
{
|
{
|
||||||
SmtpClient client = new SmtpClient("smtp.gmail.com", 587);
|
SmtpClient client = new SmtpClient("smtp.gmail.com", 587);
|
||||||
client.EnableSsl = true;
|
client.EnableSsl = true;
|
||||||
client.Credentials = new NetworkCredential("youwillneverknowthisadress@gmail.com", "thisisthepassword12345");
|
client.Credentials = SecretsVault.EmailCredential;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -53,7 +53,7 @@ namespace FoxTube
|
|||||||
grid.RowDefinitions[0].Height = new GridLength(0);
|
grid.RowDefinitions[0].Height = new GridLength(0);
|
||||||
|
|
||||||
#region Request-Response
|
#region Request-Response
|
||||||
VideosResource.ListRequest request = SecretsVault.YoutubeService.Videos.List("snippet,contentDetails,statistics");
|
VideosResource.ListRequest request = SecretsVault.NoAuthService.Videos.List("snippet,contentDetails,statistics");
|
||||||
request.Chart = VideosResource.ListRequest.ChartEnum.MostPopular;
|
request.Chart = VideosResource.ListRequest.ChartEnum.MostPopular;
|
||||||
request.RegionCode = reg;
|
request.RegionCode = reg;
|
||||||
request.MaxResults = 48;
|
request.MaxResults = 48;
|
||||||
@@ -6,33 +6,37 @@
|
|||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
Background="White">
|
||||||
|
|
||||||
<Grid HorizontalAlignment="Center" VerticalAlignment="Center">
|
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="White">
|
||||||
<ProgressRing Name="ring" IsActive="True" Foreground="Red" Width="100" Height="100"/>
|
<ProgressRing Name="ring" IsActive="True" Foreground="Red" Width="100" Height="100"/>
|
||||||
<StackPanel Name="wifiTrouble" Visibility="Collapsed">
|
|
||||||
|
<StackPanel Name="wifiTrouble" Visibility="Collapsed" VerticalAlignment="Center">
|
||||||
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph="" FontSize="100" HorizontalAlignment="Center"/>
|
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph="" FontSize="100" HorizontalAlignment="Center"/>
|
||||||
<TextBlock Text="Check your internet connection" FontSize="48" HorizontalAlignment="Center"/>
|
<TextBlock Text="Check your internet connection" FontSize="48" HorizontalAlignment="Center"/>
|
||||||
<TextBlock Text="Please, make sure you are connected to the internet and try again." HorizontalAlignment="Center"/>
|
<TextBlock Text="Please, make sure you are connected to the internet and try again." HorizontalAlignment="Center"/>
|
||||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
||||||
<Button Content="Open Wi-Fi settings" Margin="5" Name="openWifi" Click="openWifi_Click"/>
|
<Button Content="Open network settings" Margin="5" Name="openWifi" Click="openWifi_Click"/>
|
||||||
<Button Content="Open troubleshooter" Background="Red" Foreground="White" Margin="5" Name="openTroubleshoot" Click="openTroubleshoot_Click"/>
|
<Button Content="Open troubleshooter" Background="Red" Foreground="White" Margin="5" Name="openTroubleshoot" Click="openTroubleshoot_Click"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<TextBlock Text="OR" FontSize="20" HorizontalAlignment="Center"/>
|
<TextBlock Text="OR" FontSize="20" HorizontalAlignment="Center"/>
|
||||||
<Button Content="Refresh page" HorizontalAlignment="Center" Background="Red" Foreground="White" Margin="5"/>
|
<Button Name="wifiRefresh" Click="wifiRefresh_Click" Content="Refresh page" HorizontalAlignment="Center" Background="Red" Foreground="White" Margin="5"/>
|
||||||
<TextBlock Name="wifiException" Foreground="Gray" Text="Exception:" HorizontalAlignment="Center"/>
|
<TextBlock Name="wifiException" Foreground="Gray" Text="Exception:" HorizontalAlignment="Center"/>
|
||||||
<TextBlock Name="wifiMessage" Foreground="Gray" Text="Message:" HorizontalAlignment="Center"/>
|
<TextBlock Name="wifiMessage" Foreground="Gray" Text="Message:" HorizontalAlignment="Center"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel Name="trouble" Visibility="Collapsed">
|
|
||||||
|
<StackPanel Name="trouble" Visibility="Collapsed" VerticalAlignment="Center">
|
||||||
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph="" FontSize="100" HorizontalAlignment="Center"/>
|
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph="" FontSize="100" HorizontalAlignment="Center"/>
|
||||||
<TextBlock Text="We are unable to display the page" FontSize="48" HorizontalAlignment="Center"/>
|
<TextBlock Text="We are unable to display the page" FontSize="48" HorizontalAlignment="Center"/>
|
||||||
<TextBlock Text="It could be caused by YouTube internal server error or by application's bug. Please, try again later" HorizontalAlignment="Center"/>
|
<TextBlock Text="It could be caused by YouTube internal server error or by application's bug. Please, try again later" HorizontalAlignment="Center"/>
|
||||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
||||||
<Button Content="Refresh page" Margin="5"/>
|
<Button Name="refresh" Click="wifiRefresh_Click" Content="Refresh page" Margin="5"/>
|
||||||
<Button Content="Leave feedback" Background="Red" Foreground="White" Margin="5" Name="feedback" Click="feedback_Click"/>
|
<Button Content="Leave feedback" Background="Red" Foreground="White" Margin="5" Name="feedback" Click="feedback_Click"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<TextBlock Name="exception" Foreground="Gray" Text="Exception:" HorizontalAlignment="Center"/>
|
<TextBlock Name="exception" Foreground="Gray" Text="Exception:" HorizontalAlignment="Center"/>
|
||||||
<TextBlock Name="message" Foreground="Gray" Text="Message:" HorizontalAlignment="Center"/>
|
<TextBlock Name="message" Foreground="Gray" Text="Message:" HorizontalAlignment="Center"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
|
<FontIcon Name="blockIcon" Visibility="Collapsed" Glyph="" FontSize="100" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Gray"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Page>
|
</Page>
|
||||||
@@ -22,16 +22,19 @@ namespace FoxTube
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed partial class LoadingPage : Page
|
public sealed partial class LoadingPage : Page
|
||||||
{
|
{
|
||||||
|
public event EventHandler RefreshPage;
|
||||||
|
|
||||||
public LoadingPage()
|
public LoadingPage()
|
||||||
{
|
{
|
||||||
this.InitializeComponent();
|
this.InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Error(string exceptionId, string details, bool isWifiTrouble = false)
|
public void Error(string exceptionId = "Unknown", string details = "N/A", bool isWifiTrouble = false)
|
||||||
{
|
{
|
||||||
ring.IsActive = false;
|
ring.IsActive = false;
|
||||||
trouble.Visibility = Visibility.Collapsed;
|
trouble.Visibility = Visibility.Collapsed;
|
||||||
wifiTrouble.Visibility = Visibility.Collapsed;
|
wifiTrouble.Visibility = Visibility.Collapsed;
|
||||||
|
blockIcon.Visibility = Visibility.Collapsed;
|
||||||
|
|
||||||
if (isWifiTrouble)
|
if (isWifiTrouble)
|
||||||
{
|
{
|
||||||
@@ -49,6 +52,15 @@ namespace FoxTube
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Block()
|
||||||
|
{
|
||||||
|
ring.IsActive = false;
|
||||||
|
trouble.Visibility = Visibility.Collapsed;
|
||||||
|
wifiTrouble.Visibility = Visibility.Collapsed;
|
||||||
|
|
||||||
|
blockIcon.Visibility = Visibility.Visible;
|
||||||
|
}
|
||||||
|
|
||||||
private async void openWifi_Click(object sender, RoutedEventArgs e)
|
private async void openWifi_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
await Windows.System.Launcher.LaunchUriAsync(new Uri("ms-settings:network"));
|
await Windows.System.Launcher.LaunchUriAsync(new Uri("ms-settings:network"));
|
||||||
@@ -65,5 +77,19 @@ namespace FoxTube
|
|||||||
MainPage main = root.Content as MainPage;
|
MainPage main = root.Content as MainPage;
|
||||||
main.PreDefineFeedback(true, string.Format("Exception:\n{0}\n\nMessage:\n{1}", exception, message));
|
main.PreDefineFeedback(true, string.Format("Exception:\n{0}\n\nMessage:\n{1}", exception, message));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void wifiRefresh_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
Refresh();
|
||||||
|
RefreshPage.Invoke(this, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Refresh()
|
||||||
|
{
|
||||||
|
ring.IsActive = true;
|
||||||
|
trouble.Visibility = Visibility.Collapsed;
|
||||||
|
wifiTrouble.Visibility = Visibility.Collapsed;
|
||||||
|
blockIcon.Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,241 @@
|
|||||||
|
<Page
|
||||||
|
x:Class="FoxTube.MainPage"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
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"
|
||||||
|
SizeChanged="Page_SizeChanged">
|
||||||
|
|
||||||
|
<Grid Name="grid" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||||
|
<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=""
|
||||||
|
Foreground="White" Background="Red"
|
||||||
|
Grid.Column="0"
|
||||||
|
Click="menuButton_Click"
|
||||||
|
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
|
||||||
|
<TextBlock Grid.Column="1" Text="Home" FontSize="20" FontWeight="Bold" Margin="5, 0, 0, 0" HorizontalAlignment="Left" VerticalAlignment="Center" Foreground="White" Name="headerText"/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
||||||
|
<Grid Width="50">
|
||||||
|
<Button Name="notificationMenu" ToolTipService.ToolTip="Notifications" Click="notificationMenu_Click"
|
||||||
|
FontFamily="Segoe MDL2 Assets" Content="" Foreground="White"
|
||||||
|
Width="50" Height="50" Background="Transparent"/>
|
||||||
|
|
||||||
|
<Popup Margin="0,50,0,0" Name="notificationPane" Width="350" Height="400" IsOpen="False" IsLightDismissEnabled="True"/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<Button Name="feedback" ToolTipService.ToolTip="Send feedback" Click="feedback_Click"
|
||||||
|
FontFamily="Segoe MDL2 Assets" Content="" Foreground="White"
|
||||||
|
Width="50" Height="50" Background="Transparent"/>
|
||||||
|
|
||||||
|
<Button Name="account" ToolTipService.ToolTip="Sign in"
|
||||||
|
FontFamily="Segoe MDL2 Assets" Content="" Foreground="White"
|
||||||
|
Width="50" Height="50" Background="Transparent">
|
||||||
|
<Button.Flyout>
|
||||||
|
<MenuFlyout>
|
||||||
|
<MenuFlyoutItem Text="Sign in with existing account" Name="signIn" Click="signIn_Click"/>
|
||||||
|
<MenuFlyoutItem Text="Create a new Google account" Name="createAccount" Click="createAccount_Click"/>
|
||||||
|
</MenuFlyout>
|
||||||
|
</Button.Flyout>
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<Grid>
|
||||||
|
<Button Width="50" Background="Transparent" Height="50" Visibility="Collapsed" Name="LoggedAvatar" ToolTipService.ToolTip="My account" Click="LoggedAvatar_Click">
|
||||||
|
<PersonPicture Width="30"/>
|
||||||
|
</Button>
|
||||||
|
<Popup Margin="0,50,0,0" IsOpen="False" IsLightDismissEnabled="True" Name="AccountManagement">
|
||||||
|
<StackPanel Width="300" Background="WhiteSmoke">
|
||||||
|
<StackPanel Name="accountsMenu">
|
||||||
|
<Button HorizontalAlignment="Stretch" HorizontalContentAlignment="Left" Background="Transparent" Height="75">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<PersonPicture Height="50" Margin="0,0,5,0"></PersonPicture>
|
||||||
|
<StackPanel VerticalAlignment="Center">
|
||||||
|
<TextBlock Text="[Account name]"/>
|
||||||
|
<TextBlock Foreground="Gray" FontStyle="Italic" Text="[example@mail.com]"/>
|
||||||
|
</StackPanel>
|
||||||
|
</StackPanel>
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<Button HorizontalAlignment="Stretch" HorizontalContentAlignment="Left" Background="Transparent" Content="Add another account">
|
||||||
|
<Button.Flyout>
|
||||||
|
<MenuFlyout>
|
||||||
|
<MenuFlyoutItem Text="Sign in with existing account" Click="signIn_Click"/>
|
||||||
|
<MenuFlyoutItem Text="Create a new Google account" Click="createAccount_Click"/>
|
||||||
|
</MenuFlyout>
|
||||||
|
</Button.Flyout>
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<Line X1="10" X2="290" Stroke="Gray" StrokeThickness="1"/>
|
||||||
|
|
||||||
|
<Button HorizontalAlignment="Stretch" HorizontalContentAlignment="Left" Background="Transparent" Content="Log out"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Popup>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<Grid>
|
||||||
|
<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="Random encounters" TextChanged="searchField_TextChanged" LostFocus="searchField_LostFocus"/>
|
||||||
|
<Button Name="searchButton" HorizontalAlignment="Right" Click="searchButton_Click"
|
||||||
|
Width="42" Height="42" Margin="4"
|
||||||
|
Background="Transparent"
|
||||||
|
FontFamily="Segoe MDL2 Assets" Content="" FontSize="20" Foreground="Black"/>
|
||||||
|
|
||||||
|
<Popup Margin="0,50,0,0" Name="searchSuggestions" IsOpen="True" Visibility="Collapsed">
|
||||||
|
<StackPanel Background="WhiteSmoke" Width="350">
|
||||||
|
<StackPanel Width="350" Name="searchStandby" Visibility="Visible" Margin="10">
|
||||||
|
<TextBlock Text="Loading results... Please, wait."/>
|
||||||
|
<ProgressBar IsIndeterminate="True"/>
|
||||||
|
</StackPanel>
|
||||||
|
<ListBox Name="searchSuggestionsList" Visibility="Visible" SelectionChanged="searchSuggestionsList_SelectionChanged">
|
||||||
|
|
||||||
|
</ListBox>
|
||||||
|
</StackPanel>
|
||||||
|
</Popup>
|
||||||
|
</Grid>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
<SplitView Name="menu" Grid.Row="1" OpenPaneLength="250" CompactPaneLength="50" DisplayMode="CompactInline" IsPaneOpen="True" PaneClosing="menu_PaneClosed" PaneOpening="menu_PaneOpened">
|
||||||
|
<SplitView.Pane>
|
||||||
|
<RelativePanel>
|
||||||
|
<ListBox SelectionChanged="ListBox_SelectionChanged" Name="topHamburger">
|
||||||
|
<ListBoxItem Name="homeMenu" IsSelected="True">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<TextBlock Style="{StaticResource ItemIcon}" Text=""/>
|
||||||
|
<TextBlock Style="{StaticResource MenuItem}" Text="Home"/>
|
||||||
|
</StackPanel>
|
||||||
|
</ListBoxItem>
|
||||||
|
<ListBoxItem Name="historyMenu" Visibility="Collapsed">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<TextBlock Style="{StaticResource ItemIcon}" Text=""/>
|
||||||
|
<TextBlock Style="{StaticResource MenuItem}" Text="History"/>
|
||||||
|
</StackPanel>
|
||||||
|
</ListBoxItem>
|
||||||
|
<ListBoxItem Name="likedMenu" Visibility="Collapsed">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<TextBlock Style="{StaticResource ItemIcon}" Text=""/>
|
||||||
|
<TextBlock Style="{StaticResource MenuItem}" Text="Liked videos"/>
|
||||||
|
</StackPanel>
|
||||||
|
</ListBoxItem>
|
||||||
|
<ListBoxItem Name="watchLaterMenu" Visibility="Collapsed">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<TextBlock Style="{StaticResource ItemIcon}" Text=""/>
|
||||||
|
<TextBlock Style="{StaticResource MenuItem}" Text="Watch later"/>
|
||||||
|
</StackPanel>
|
||||||
|
</ListBoxItem>
|
||||||
|
</ListBox>
|
||||||
|
|
||||||
|
<ListBox RelativePanel.Below="topHamburger" Name="subscriptionsHamburger" Visibility="Visible">
|
||||||
|
<ListBoxItem Name="subscriptionsTitle" Height="17" Margin="0" Padding="5, 0, 5, 0" IsEnabled="False">
|
||||||
|
<StackPanel Orientation="Horizontal" Margin="0" Padding="0, 0, 0, 0">
|
||||||
|
<TextBlock Name="subsMenuTitle" Text="Subscriptions" Foreground="Gray" FontSize="12" Margin="0" Padding="0, 0, 5, 0"/>
|
||||||
|
<Line Name="subsMenuStroke" X1="0" Y1="10" X2="300" Y2="10" Stroke="Gray" StrokeThickness="2"/>
|
||||||
|
</StackPanel>
|
||||||
|
</ListBoxItem>
|
||||||
|
<ListBoxItem IsEnabled="False" Name="subsLogErr" Visibility="Visible" VerticalContentAlignment="Top">
|
||||||
|
<TextBlock FontFamily="Default, Segoe MDL2 Assets" Text="Press  and add an account to see your featured channels and another useful stuff here" HorizontalTextAlignment="Center" Width="225" Foreground="Gray" TextWrapping="WrapWholeWords"/>
|
||||||
|
</ListBoxItem>
|
||||||
|
<ListBoxItem>
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<PersonPicture Height="25" Margin="0,0,17,0"/>
|
||||||
|
<TextBlock Style="{StaticResource MenuItem}" VerticalAlignment="Center" Text="Channel name"/>
|
||||||
|
</StackPanel>
|
||||||
|
</ListBoxItem>
|
||||||
|
</ListBox>
|
||||||
|
|
||||||
|
<ListBox RelativePanel.Below="subscriptionsHamburger" Name="categoriesHamburger" Visibility="Visible">
|
||||||
|
<ListBoxItem Name="categoriesTitle" Height="17" Margin="0" Padding="5, 0, 5, 0" IsEnabled="False">
|
||||||
|
<StackPanel Orientation="Horizontal" Margin="0" Padding="0, 0, 0, 0">
|
||||||
|
<TextBlock Name="catMenuTitle" Text="Featured" Foreground="Gray" FontSize="12" Margin="0" Padding="0, 0, 5, 0"/>
|
||||||
|
<Line Name="catMenuStroke" X1="0" Y1="10" X2="300" Y2="10" Stroke="Gray" StrokeThickness="2"/>
|
||||||
|
</StackPanel>
|
||||||
|
</ListBoxItem>
|
||||||
|
<ListBoxItem>
|
||||||
|
<StackPanel Orientation="Horizontal" Name="musicMenu">
|
||||||
|
<TextBlock Style="{StaticResource ItemIcon}" Text=""/>
|
||||||
|
<TextBlock Style="{StaticResource MenuItem}" Text="Music"/>
|
||||||
|
</StackPanel>
|
||||||
|
</ListBoxItem>
|
||||||
|
<ListBoxItem>
|
||||||
|
<StackPanel Orientation="Horizontal" Name="sportMenu">
|
||||||
|
<TextBlock Style="{StaticResource ItemIcon}" Text=""/>
|
||||||
|
<TextBlock Style="{StaticResource MenuItem}" Text="Sports"/>
|
||||||
|
</StackPanel>
|
||||||
|
</ListBoxItem>
|
||||||
|
<ListBoxItem>
|
||||||
|
<StackPanel Name="gamingMenu" Orientation="Horizontal">
|
||||||
|
<TextBlock Style="{StaticResource ItemIcon}" Text=""/>
|
||||||
|
<TextBlock Style="{StaticResource MenuItem}" Text="Gaming"/>
|
||||||
|
</StackPanel>
|
||||||
|
</ListBoxItem>
|
||||||
|
<ListBoxItem>
|
||||||
|
<StackPanel Orientation="Horizontal" Name="newsMenu">
|
||||||
|
<TextBlock Style="{StaticResource ItemIcon}" Text=""/>
|
||||||
|
<TextBlock Style="{StaticResource MenuItem}" Text="News"/>
|
||||||
|
</StackPanel>
|
||||||
|
</ListBoxItem>
|
||||||
|
<ListBoxItem>
|
||||||
|
<StackPanel Orientation="Horizontal" Name="liveMenu">
|
||||||
|
<TextBlock Style="{StaticResource ItemIcon}" Text=""/>
|
||||||
|
<TextBlock Style="{StaticResource MenuItem}" Text="Live"/>
|
||||||
|
</StackPanel>
|
||||||
|
</ListBoxItem>
|
||||||
|
<ListBoxItem>
|
||||||
|
<StackPanel Orientation="Horizontal" Name="spotlightMenu">
|
||||||
|
<TextBlock Style="{StaticResource ItemIcon}" Text=""/>
|
||||||
|
<TextBlock Style="{StaticResource MenuItem}" Text="Spotlight"/>
|
||||||
|
</StackPanel>
|
||||||
|
</ListBoxItem>
|
||||||
|
<ListBoxItem>
|
||||||
|
<StackPanel Orientation="Horizontal" Name="TSZMenu">
|
||||||
|
<TextBlock Style="{StaticResource ItemIcon}" Text=""/>
|
||||||
|
<TextBlock Style="{StaticResource MenuItem}" Text="360° Video"/>
|
||||||
|
</StackPanel>
|
||||||
|
</ListBoxItem>
|
||||||
|
</ListBox>
|
||||||
|
|
||||||
|
<ListBox RelativePanel.AlignBottomWithPanel="True" SelectionChanged="bottomHaburgerSelectionChanged" Name="bottomHaburger">
|
||||||
|
<ListBoxItem Padding="0" IsEnabled="False">
|
||||||
|
<Line X1="0" X2="250" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
</ListBoxItem>
|
||||||
|
<ListBoxItem Name="channelMenu" Visibility="Collapsed">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<TextBlock Style="{StaticResource ItemIcon}" Text=""/>
|
||||||
|
<TextBlock Style="{StaticResource MenuItem}" Text="My channel"/>
|
||||||
|
</StackPanel>
|
||||||
|
</ListBoxItem>
|
||||||
|
<ListBoxItem Name="noadsMenu" Visibility="Visible">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<TextBlock Style="{StaticResource ItemIcon}" Text=""/>
|
||||||
|
<TextBlock Style="{StaticResource MenuItem}" Text="Remove ads (2$)"/>
|
||||||
|
</StackPanel>
|
||||||
|
</ListBoxItem>
|
||||||
|
<ListBoxItem Name="settingsMenu">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<TextBlock Style="{StaticResource ItemIcon}" Text=""/>
|
||||||
|
<TextBlock Style="{StaticResource MenuItem}" Text="Settings"/>
|
||||||
|
</StackPanel>
|
||||||
|
</ListBoxItem>
|
||||||
|
</ListBox>
|
||||||
|
</RelativePanel>
|
||||||
|
</SplitView.Pane>
|
||||||
|
<SplitView.Content>
|
||||||
|
<Grid>
|
||||||
|
<Frame Name="content"/>
|
||||||
|
<Frame Name="popupPlaceholder"/>
|
||||||
|
<Frame Name="videoPlaceholder"/>
|
||||||
|
</Grid>
|
||||||
|
</SplitView.Content>
|
||||||
|
</SplitView>
|
||||||
|
</Grid>
|
||||||
|
</Page>
|
||||||
@@ -31,6 +31,9 @@ using System.Threading.Tasks;
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using Google.Apis.Util.Store;
|
using Google.Apis.Util.Store;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
using Windows.ApplicationModel.Core;
|
||||||
|
using Windows.System;
|
||||||
|
using Windows.UI.Xaml.Documents;
|
||||||
|
|
||||||
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409
|
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409
|
||||||
|
|
||||||
@@ -41,25 +44,21 @@ namespace FoxTube
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
||||||
public enum RightPaneState { Full, Collapsed, Hidden }
|
public enum RightPaneState { Full, Collapsed, Hidden }
|
||||||
|
public interface IPageNesting
|
||||||
|
{
|
||||||
|
void GoToSettings(int pageIndex = 0);
|
||||||
|
}
|
||||||
|
|
||||||
public sealed partial class MainPage : Page
|
public sealed partial class MainPage : Page
|
||||||
{
|
{
|
||||||
private bool loggedIn = false;
|
public SecretsVault Vault = new SecretsVault();
|
||||||
UserCredential credential;
|
|
||||||
|
|
||||||
RightPaneState paneState = RightPaneState.Full;
|
RightPaneState paneState = RightPaneState.Full;
|
||||||
bool isForcedCollapsed = false;
|
bool isForcedCollapsed = false;
|
||||||
|
|
||||||
public bool Logged
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return loggedIn;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ApplicationDataContainer settings = ApplicationData.Current.LocalSettings;
|
ApplicationDataContainer settings = ApplicationData.Current.LocalSettings;
|
||||||
List<Notification> notifications = new List<Notification>();
|
|
||||||
|
NotificationsCenter notificationsCenter = new NotificationsCenter();
|
||||||
public MainPage()
|
public MainPage()
|
||||||
{
|
{
|
||||||
this.InitializeComponent();
|
this.InitializeComponent();
|
||||||
@@ -67,7 +66,7 @@ namespace FoxTube
|
|||||||
if(settings.Values["language"] == null)
|
if(settings.Values["language"] == null)
|
||||||
settings.Values.Add("language", 0);
|
settings.Values.Add("language", 0);
|
||||||
if (settings.Values["quality"] == null)
|
if (settings.Values["quality"] == null)
|
||||||
settings.Values.Add("quality", 0);
|
settings.Values.Add("quality", 1);
|
||||||
|
|
||||||
if (settings.Values["newVideoNotification"] == null)
|
if (settings.Values["newVideoNotification"] == null)
|
||||||
settings.Values.Add("newVideoNotification", true);
|
settings.Values.Add("newVideoNotification", true);
|
||||||
@@ -81,7 +80,7 @@ namespace FoxTube
|
|||||||
if (settings.Values["moblieWarning"] == null)
|
if (settings.Values["moblieWarning"] == null)
|
||||||
settings.Values.Add("moblieWarning", false);
|
settings.Values.Add("moblieWarning", false);
|
||||||
if (settings.Values["videoAutoplay"] == null)
|
if (settings.Values["videoAutoplay"] == null)
|
||||||
settings.Values.Add("videoAutoplay", true);
|
settings.Values.Add("videoAutoplay", false);
|
||||||
if (settings.Values["volume"] == null)
|
if (settings.Values["volume"] == null)
|
||||||
settings.Values.Add("volume", 100);
|
settings.Values.Add("volume", 100);
|
||||||
|
|
||||||
@@ -91,6 +90,13 @@ namespace FoxTube
|
|||||||
settings.Values.Add("safeSearch", 0);
|
settings.Values.Add("safeSearch", 0);
|
||||||
|
|
||||||
content.Navigate(typeof(Home));
|
content.Navigate(typeof(Home));
|
||||||
|
|
||||||
|
Vault.AuthorizationStateChanged += Vault_AuthorizationStateChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Vault_AuthorizationStateChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Debug.WriteLine("--<!!!Authorized!!!>--");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnNavigatedTo(NavigationEventArgs e)
|
protected override void OnNavigatedTo(NavigationEventArgs e)
|
||||||
@@ -107,114 +113,25 @@ namespace FoxTube
|
|||||||
titleBar.ForegroundColor = titleBar.ButtonForegroundColor = Colors.White;
|
titleBar.ForegroundColor = titleBar.ButtonForegroundColor = Colors.White;
|
||||||
titleBar.ButtonHoverBackgroundColor = Colors.IndianRed;
|
titleBar.ButtonHoverBackgroundColor = Colors.IndianRed;
|
||||||
titleBar.ButtonPressedBackgroundColor = Colors.DarkRed;
|
titleBar.ButtonPressedBackgroundColor = Colors.DarkRed;
|
||||||
|
|
||||||
|
CoreApplicationViewTitleBar coreTitleBar = CoreApplication.GetCurrentView().TitleBar;
|
||||||
|
coreTitleBar.ExtendViewIntoTitleBar = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void menuButton_Click(object sender, RoutedEventArgs e)
|
private void menuButton_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
menu.IsPaneOpen = !menu.IsPaneOpen;
|
menu.IsPaneOpen = !menu.IsPaneOpen;
|
||||||
//AddNotification(new Notification("Internal notification", "Menu state has been changed", DateTime.Now, NotificationType.Update));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddNotification(Notification notification , bool needNotify = true)
|
public void GotNotification()
|
||||||
{
|
{
|
||||||
notificationMenu.Content = "";
|
notificationMenu.Content = "";
|
||||||
notifications.Add(notification);
|
}
|
||||||
noNotifText.Visibility = Visibility.Collapsed;
|
|
||||||
notificationPanel.Visibility = Visibility.Visible;
|
|
||||||
StackPanel stack = new StackPanel();
|
|
||||||
stack.Orientation = Orientation.Horizontal;
|
|
||||||
stack.Children.Add(new PersonPicture()
|
|
||||||
{
|
|
||||||
Height = 50,
|
|
||||||
HorizontalAlignment = HorizontalAlignment.Left,
|
|
||||||
Margin = new Thickness(0, 0, 10, 0),
|
|
||||||
VerticalAlignment = VerticalAlignment.Top,
|
|
||||||
ProfilePicture = new BitmapImage(new Uri(notification.Avatar))
|
|
||||||
});
|
|
||||||
StackPanel stackPanel = new StackPanel();
|
|
||||||
//Channel
|
|
||||||
stackPanel.Children.Add(new TextBlock()
|
|
||||||
{
|
|
||||||
FontSize = 14,
|
|
||||||
FontStyle = Windows.UI.Text.FontStyle.Italic,
|
|
||||||
Foreground = new SolidColorBrush(Colors.Gray),
|
|
||||||
Text = notification.Header
|
|
||||||
});
|
|
||||||
//Content
|
|
||||||
stackPanel.Children.Add(new TextBlock()
|
|
||||||
{
|
|
||||||
TextWrapping = TextWrapping.WrapWholeWords,
|
|
||||||
Text = notification.message,
|
|
||||||
});
|
|
||||||
//Time
|
|
||||||
stackPanel.Children.Add(new TextBlock()
|
|
||||||
{
|
|
||||||
FontSize = 13,
|
|
||||||
Foreground = new SolidColorBrush(Colors.Gray),
|
|
||||||
Text = notification.returnTimecode()
|
|
||||||
});
|
|
||||||
stack.Children.Add(stackPanel);
|
|
||||||
|
|
||||||
notificationArray.Items.Add(new ListBoxItem()
|
public void ClosePopups()
|
||||||
{
|
{
|
||||||
Padding = new Thickness(10),
|
popupPlaceholder.Content = null;
|
||||||
MinHeight = 80,
|
notificationPane.Child = null;
|
||||||
Content = stack
|
|
||||||
});
|
|
||||||
|
|
||||||
//Sending notification
|
|
||||||
if(needNotify)
|
|
||||||
{
|
|
||||||
if(notification.Type == NotificationType.Update)
|
|
||||||
{
|
|
||||||
ToastContent toast = new ToastContent()
|
|
||||||
{
|
|
||||||
Visual = new ToastVisual()
|
|
||||||
{
|
|
||||||
BindingGeneric = new ToastBindingGeneric()
|
|
||||||
{
|
|
||||||
Children =
|
|
||||||
{
|
|
||||||
new AdaptiveText()
|
|
||||||
{
|
|
||||||
Text = notification.Header,
|
|
||||||
HintMaxLines = 2
|
|
||||||
},
|
|
||||||
new AdaptiveText()
|
|
||||||
{
|
|
||||||
Text = notification.message
|
|
||||||
}
|
|
||||||
},
|
|
||||||
HeroImage = new ToastGenericHeroImage()
|
|
||||||
{
|
|
||||||
Source = notification.Thumbnail
|
|
||||||
},
|
|
||||||
AppLogoOverride = new ToastGenericAppLogo()
|
|
||||||
{
|
|
||||||
Source = notification.Avatar,
|
|
||||||
HintCrop = ToastGenericAppLogoCrop.Circle
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
Actions = new ToastActionsCustom()
|
|
||||||
{
|
|
||||||
Buttons =
|
|
||||||
{
|
|
||||||
new ToastButton("View full post", "action=viewupdatenotification")
|
|
||||||
{
|
|
||||||
ActivationType = ToastActivationType.Foreground
|
|
||||||
},
|
|
||||||
new ToastButton("Manage notifications", "action=notificationsettings")
|
|
||||||
{
|
|
||||||
ActivationType = ToastActivationType.Foreground
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
Launch = "action=viewupdatenotification"
|
|
||||||
};
|
|
||||||
ToastNotificationManager.CreateToastNotifier().Show(new ToastNotification(toast.GetXml()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
@@ -282,32 +199,22 @@ namespace FoxTube
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void notification_Click(object sender, RoutedEventArgs e)
|
private void notificationMenu_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
notificationPane.IsOpen = !notificationPane.IsOpen;
|
|
||||||
notificationMenu.Content = "";
|
notificationMenu.Content = "";
|
||||||
}
|
if (content.Width >= 500)
|
||||||
|
|
||||||
private void clearNotifications_Click(object sender, RoutedEventArgs e)
|
|
||||||
{
|
{
|
||||||
notifications.Clear();
|
notificationPane.Child = notificationsCenter;
|
||||||
notificationArray.Items.Clear();
|
notificationPane.IsOpen = !notificationPane.IsOpen;
|
||||||
|
}
|
||||||
noNotifText.Visibility = Visibility.Visible;
|
else
|
||||||
notificationPanel.Visibility = Visibility.Collapsed;
|
popupPlaceholder.Content = notificationsCenter;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void refresh_Click(object sender, RoutedEventArgs e)
|
private void feedback_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
|
||||||
Type t = content.CurrentSourcePageType;
|
|
||||||
content.Navigate(t);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void feddback_Click(object sender, RoutedEventArgs e)
|
|
||||||
{
|
{
|
||||||
bottomHaburger.SelectedIndex = 4;
|
bottomHaburger.SelectedIndex = 4;
|
||||||
Settings s = content.Content as Settings;
|
(content.Content as Settings).pivot.SelectedIndex = 3;
|
||||||
s.pivot.SelectedIndex = 3;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PreDefineFeedback(bool isProblem, string meta)
|
public void PreDefineFeedback(bool isProblem, string meta)
|
||||||
@@ -323,9 +230,14 @@ namespace FoxTube
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
subsMenuTitle.Visibility = Visibility.Collapsed;
|
subsMenuTitle.Visibility = Visibility.Collapsed;
|
||||||
subsMenuStroke.X2 = 40;
|
|
||||||
subsMenuStroke.Y1 = subsMenuStroke.Y2 = 0;
|
subsMenuStroke.Y1 = subsMenuStroke.Y2 = 0;
|
||||||
|
subsMenuStroke.X2 = 40;
|
||||||
subscriptionsTitle.Height = 2;
|
subscriptionsTitle.Height = 2;
|
||||||
|
|
||||||
|
catMenuTitle.Visibility = Visibility.Collapsed;
|
||||||
|
catMenuStroke.Y1 = catMenuStroke.Y2 = 0;
|
||||||
|
catMenuStroke.X2 = 40;
|
||||||
|
categoriesTitle.Height = 2;
|
||||||
subsLogErr.Visibility = Visibility.Collapsed;
|
subsLogErr.Visibility = Visibility.Collapsed;
|
||||||
} catch { }
|
} catch { }
|
||||||
}
|
}
|
||||||
@@ -335,9 +247,14 @@ namespace FoxTube
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
subsMenuTitle.Visibility = Visibility.Visible;
|
subsMenuTitle.Visibility = Visibility.Visible;
|
||||||
subsMenuStroke.X2 = 165;
|
subsMenuStroke.Y1 = catMenuStroke.Y2 = 10;
|
||||||
subsMenuStroke.Y1 = subsMenuStroke.Y2 = 10;
|
subsMenuStroke.X2 = 300;
|
||||||
subscriptionsTitle.Height = 17;
|
subscriptionsTitle.Height = 17;
|
||||||
|
|
||||||
|
catMenuTitle.Visibility = Visibility.Visible;
|
||||||
|
catMenuStroke.Y1 = subsMenuStroke.Y2 = 10;
|
||||||
|
catMenuStroke.X2 = 300;
|
||||||
|
categoriesTitle.Height = 17;
|
||||||
subsLogErr.Visibility = Visibility.Visible;
|
subsLogErr.Visibility = Visibility.Visible;
|
||||||
} catch { }
|
} catch { }
|
||||||
}
|
}
|
||||||
@@ -347,24 +264,14 @@ namespace FoxTube
|
|||||||
AccountManagement.IsOpen = true;
|
AccountManagement.IsOpen = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createAccount_Click(object sender, RoutedEventArgs e)
|
private async void createAccount_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
Process.Start("https://accounts.google.com/signup/");
|
await Launcher.LaunchUriAsync(new Uri("https://accounts.google.com/signup/v2/webcreateaccount?ManageAccount&flowName=GlifWebSignIn&flowEntry=SignUp"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void signIn_Click(object sender, RoutedEventArgs e)
|
private void signIn_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
LogIn().Wait();
|
Vault.Authorize();
|
||||||
}
|
|
||||||
|
|
||||||
private async Task LogIn()
|
|
||||||
{
|
|
||||||
credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(
|
|
||||||
SecretsVault.Secrets,
|
|
||||||
new[] { YouTubeService.Scope.Youtube },
|
|
||||||
"user",
|
|
||||||
CancellationToken.None
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void searchField_TextChanged(object sender, TextChangedEventArgs e)
|
private void searchField_TextChanged(object sender, TextChangedEventArgs e)
|
||||||
@@ -501,11 +408,7 @@ namespace FoxTube
|
|||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
YouTubeService ytService = new YouTubeService(new BaseClientService.Initializer()
|
YouTubeService ytService = SecretsVault.IsAuthorized ? SecretsVault.Service : SecretsVault.NoAuthService;
|
||||||
{
|
|
||||||
ApiKey = "AIzaSyBgHrCnrlzlVmk0cJKL8RqP9Y8x6XSuk_0",
|
|
||||||
ApplicationName = this.GetType().ToString()
|
|
||||||
});
|
|
||||||
|
|
||||||
var searchListRequest = ytService.Search.List("snippet");
|
var searchListRequest = ytService.Search.List("snippet");
|
||||||
searchListRequest.Q = keyword;
|
searchListRequest.Q = keyword;
|
||||||
@@ -526,7 +429,7 @@ namespace FoxTube
|
|||||||
s.SetResults(keyword, (int)response.PageInfo.TotalResults);
|
s.SetResults(keyword, (int)response.PageInfo.TotalResults);
|
||||||
Debug.WriteLine("building items tree...");
|
Debug.WriteLine("building items tree...");
|
||||||
foreach (SearchResult result in response.Items)
|
foreach (SearchResult result in response.Items)
|
||||||
s.AddItem(result, Logged);
|
s.AddItem(result);
|
||||||
s.ring.IsActive = false;
|
s.ring.IsActive = false;
|
||||||
s.content.Visibility = Visibility.Visible;
|
s.content.Visibility = Visibility.Visible;
|
||||||
Debug.WriteLine("done");
|
Debug.WriteLine("done");
|
||||||
@@ -567,12 +470,22 @@ namespace FoxTube
|
|||||||
menu.IsPaneOpen = false;
|
menu.IsPaneOpen = false;
|
||||||
isForcedCollapsed = true;
|
isForcedCollapsed = true;
|
||||||
|
|
||||||
content.Navigate(typeof(Video));
|
videoPlaceholder.Content = null;
|
||||||
(content.Content as Video).Initialize(id);
|
videoPlaceholder.Width = double.NaN;
|
||||||
|
videoPlaceholder.Height = double.NaN;
|
||||||
|
videoPlaceholder.VerticalAlignment = VerticalAlignment.Stretch;
|
||||||
|
videoPlaceholder.HorizontalAlignment = HorizontalAlignment.Stretch;
|
||||||
|
videoPlaceholder.Margin = new Thickness(0);
|
||||||
|
|
||||||
|
videoPlaceholder.Navigate(typeof(Video));
|
||||||
|
(videoPlaceholder.Content as Video).Initialize(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Page_SizeChanged(object sender, SizeChangedEventArgs e)
|
private void Page_SizeChanged(object sender, SizeChangedEventArgs e)
|
||||||
{
|
{
|
||||||
|
if (videoPlaceholder.Content != null)
|
||||||
|
(videoPlaceholder.Content as Video).player.UpdateSize();
|
||||||
|
|
||||||
if(isForcedCollapsed)
|
if(isForcedCollapsed)
|
||||||
{
|
{
|
||||||
if (e.NewSize.Width >= 600 && paneState != RightPaneState.Collapsed)
|
if (e.NewSize.Width >= 600 && paneState != RightPaneState.Collapsed)
|
||||||
@@ -610,5 +523,57 @@ namespace FoxTube
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void closeNotification_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
notificationPane.IsOpen = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void MaximizeVideo()
|
||||||
|
{
|
||||||
|
videoPlaceholder.Width = double.NaN;
|
||||||
|
videoPlaceholder.Height = double.NaN;
|
||||||
|
videoPlaceholder.VerticalAlignment = VerticalAlignment.Stretch;
|
||||||
|
videoPlaceholder.HorizontalAlignment = HorizontalAlignment.Stretch;
|
||||||
|
videoPlaceholder.Margin = new Thickness(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Fullscreen(bool on)
|
||||||
|
{
|
||||||
|
if(on)
|
||||||
|
{
|
||||||
|
grid.RowDefinitions[0].Height = new GridLength(0);
|
||||||
|
menu.CompactPaneLength = 0;
|
||||||
|
/*menu.DisplayMode = SplitViewDisplayMode.Overlay;
|
||||||
|
menu.IsPaneOpen = false;*/
|
||||||
|
isForcedCollapsed = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
grid.RowDefinitions[0].Height = new GridLength(50);
|
||||||
|
menu.CompactPaneLength = 50;
|
||||||
|
//menu.DisplayMode = SplitViewDisplayMode.CompactOverlay;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CloseVideo()
|
||||||
|
{
|
||||||
|
if (ApplicationView.GetForCurrentView().IsFullScreenMode)
|
||||||
|
{
|
||||||
|
ApplicationView.GetForCurrentView().ExitFullScreenMode();
|
||||||
|
Fullscreen(false);
|
||||||
|
}
|
||||||
|
videoPlaceholder.Content = null;
|
||||||
|
MaximizeVideo();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -42,7 +42,7 @@ namespace FoxTube
|
|||||||
resultsCount.Text = count.ToString();
|
resultsCount.Text = count.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddItem(SearchResult result, bool logged)
|
public void AddItem(SearchResult result)
|
||||||
{
|
{
|
||||||
switch (result.Id.Kind)
|
switch (result.Id.Kind)
|
||||||
{
|
{
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
</ComboBox>
|
</ComboBox>
|
||||||
<TextBlock Text="Playback" FontSize="22"/>
|
<TextBlock Text="Playback" FontSize="22"/>
|
||||||
<ComboBox Margin="0,0,0,10" Width="250" Header="Default video playback quality" Name="quality" SelectionChanged="quality_SelectionChanged">
|
<ComboBox Margin="0,0,0,10" Width="250" Header="Default video playback quality" Name="quality" SelectionChanged="quality_SelectionChanged">
|
||||||
<ComboBoxItem Content="Auto"/>
|
<!--<ComboBoxItem Content="Auto"/>-->
|
||||||
<ComboBoxItem Content="2160p"/>
|
<ComboBoxItem Content="2160p"/>
|
||||||
<ComboBoxItem Content="1080p"/>
|
<ComboBoxItem Content="1080p"/>
|
||||||
<ComboBoxItem Content="720p"/>
|
<ComboBoxItem Content="720p"/>
|
||||||
@@ -94,7 +94,7 @@ namespace FoxTube
|
|||||||
|
|
||||||
SmtpClient client = new SmtpClient("smtp.gmail.com", 587);
|
SmtpClient client = new SmtpClient("smtp.gmail.com", 587);
|
||||||
client.EnableSsl = true;
|
client.EnableSsl = true;
|
||||||
client.Credentials = new NetworkCredential(SecretsVault.Email, SecretsVault.Password);
|
client.Credentials = SecretsVault.EmailCredential;
|
||||||
|
|
||||||
upload.IsEnabled = false;
|
upload.IsEnabled = false;
|
||||||
export.IsEnabled = false;
|
export.IsEnabled = false;
|
||||||
@@ -0,0 +1,139 @@
|
|||||||
|
<Page
|
||||||
|
x:Class="FoxTube.Video"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:local="using:FoxTube"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:pages="using:FoxTube.Pages"
|
||||||
|
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
|
||||||
|
mc:Ignorable="d">
|
||||||
|
|
||||||
|
<Grid Name="mainGrid">
|
||||||
|
<Grid Name="grid" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" SizeChanged="grid_SizeChanged">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="400"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<ScrollViewer Margin="0,0,0,50" Name="mainScroll">
|
||||||
|
<StackPanel Orientation="Vertical" Name="mainContent">
|
||||||
|
<StackPanel Name="playerPlaceholder"/>
|
||||||
|
<StackPanel Margin="10" Name="descriptionPanel">
|
||||||
|
<TextBlock IsTextSelectionEnabled="True" Name="title" Text="[Video title]" FontSize="25" TextWrapping="WrapWholeWords" HorizontalTextAlignment="Start"/>
|
||||||
|
<Grid>
|
||||||
|
<Button Padding="0" Background="Transparent" Margin="5" Name="gotoChannel" Click="gotoChannel_Click">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<PersonPicture Name="channelAvatar" Width="90"/>
|
||||||
|
<StackPanel Orientation="Vertical" Grid.Column="1" Padding="5" VerticalAlignment="Center">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<TextBlock Name="channelName" Text="[Channel name]" FontSize="18"/>
|
||||||
|
</StackPanel>
|
||||||
|
<TextBlock Name="subscribers" Text="[subscribers]" Foreground="Gray"/>
|
||||||
|
<StackPanel Name="subscribePanel" Orientation="Horizontal" Margin="0,5,0,0">
|
||||||
|
<ToggleButton Grid.Column="2" Height="30" Width="150" Background="Red" Foreground="White" FontSize="14" FontWeight="SemiBold" Content="Subscirbe"/>
|
||||||
|
<ToggleButton Grid.Column="3" Height="30" Width="30" Padding="0" FontFamily="Segoe MDL2 Assets" FontSize="14" FontWeight="SemiBold" Content="" Foreground="White" Background="Red"/>
|
||||||
|
</StackPanel>
|
||||||
|
</StackPanel>
|
||||||
|
</StackPanel>
|
||||||
|
</Button>
|
||||||
|
<StackPanel HorizontalAlignment="Right">
|
||||||
|
<TextBlock Name="views" Text="[views]" FontSize="24" Foreground="Gray"/>
|
||||||
|
<ProgressBar Name="rating" Width="250" Background="Green" Foreground="Red"/>
|
||||||
|
<Grid>
|
||||||
|
<Button Background="Transparent" Foreground="Gray"
|
||||||
|
Padding="0"
|
||||||
|
FontFamily="Segoe MDL2 Assets" FontSize="40"
|
||||||
|
Name="dislike" Click="dislike_Click"
|
||||||
|
Content=""/>
|
||||||
|
|
||||||
|
<Button Background="Transparent" Foreground="Gray"
|
||||||
|
Padding="0" HorizontalAlignment="Right"
|
||||||
|
FontFamily="Segoe MDL2 Assets" FontSize="40"
|
||||||
|
Name="like" Click="like_Click"
|
||||||
|
Content=""/>
|
||||||
|
</Grid>
|
||||||
|
<Grid>
|
||||||
|
<TextBlock Foreground="Gray" Text="[dislikes]" Name="dislikes"/>
|
||||||
|
<TextBlock HorizontalAlignment="Right" Foreground="Gray" Text="[likes]" Name="likes"/>
|
||||||
|
</Grid>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
<TextBlock Name="description" Text="[Description]" IsTextSelectionEnabled="True" TextWrapping="WrapWholeWords"/>
|
||||||
|
<Grid Margin="0,20,0,0">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="auto"/>
|
||||||
|
<ColumnDefinition Width="20"/>
|
||||||
|
<ColumnDefinition Width="auto"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="auto"/>
|
||||||
|
<RowDefinition Height="auto"/>
|
||||||
|
<RowDefinition Height="auto"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<TextBlock Text="Published at: "/>
|
||||||
|
<TextBlock Grid.Row="1" Text="Category: "/>
|
||||||
|
<TextBlock Grid.Row="2" Text="License: "/>
|
||||||
|
|
||||||
|
<TextBlock Name="publishedAt" Grid.Column="2" Text="[Publishing date]"/>
|
||||||
|
<TextBlock Name="category" Grid.Column="2" Grid.Row="1" Padding="0" Text="[Category]"/>
|
||||||
|
<TextBlock Name="license" Grid.Column="2" Grid.Row="2" Text="[License type]"/>
|
||||||
|
</Grid>
|
||||||
|
</StackPanel>
|
||||||
|
</StackPanel>
|
||||||
|
</ScrollViewer>
|
||||||
|
|
||||||
|
|
||||||
|
<CommandBar VerticalAlignment="Bottom" Name="commandbar">
|
||||||
|
<AppBarToggleButton Icon="Clock" Label="Watch later" Visibility="Collapsed"/>
|
||||||
|
<AppBarButton Name="refresh" Click="refresh_Click" Icon="Refresh" Label="Refresh page"/>
|
||||||
|
<AppBarButton Name="share" Click="share_Click" Icon="Share" Label="Share"/>
|
||||||
|
<AppBarButton Name="openBrowser" Click="openBrowser_Click" Icon="Globe" Label="Open in browser"/>
|
||||||
|
|
||||||
|
<CommandBar.SecondaryCommands>
|
||||||
|
<AppBarButton Icon="Add" Label="Add to playlist" Visibility="Collapsed"/>
|
||||||
|
<AppBarButton Icon="Flag" Label="Report this video"/>
|
||||||
|
</CommandBar.SecondaryCommands>
|
||||||
|
</CommandBar>
|
||||||
|
|
||||||
|
<Grid Grid.Column="1" Name="tabsPlaceholder">
|
||||||
|
<Grid Name="tabs">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="47"/>
|
||||||
|
<RowDefinition/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<Grid Background="Red">
|
||||||
|
<StackPanel Orientation="Horizontal" Margin="10,0,10,0">
|
||||||
|
<HyperlinkButton Name="toDescription" Click="toDescription_Click" Foreground="White" Margin="0,0,10,0" Visibility="Collapsed">
|
||||||
|
<TextBlock Text="Description"/>
|
||||||
|
</HyperlinkButton>
|
||||||
|
<HyperlinkButton Name="toPlaylist" Click="toPlaylist_Click" Foreground="White" Margin="0,0,10,0" Visibility="Collapsed">
|
||||||
|
<TextBlock Text="Playlist"/>
|
||||||
|
</HyperlinkButton>
|
||||||
|
<HyperlinkButton Name="toSuggestions" Click="toSuggestions_Click" Foreground="White" Margin="0,0,10,0">
|
||||||
|
<TextBlock Text="Suggestions"/>
|
||||||
|
</HyperlinkButton>
|
||||||
|
<HyperlinkButton Name="toComments" Click="toComments_Click" Foreground="White" Margin="0,0,10,0">
|
||||||
|
<TextBlock Text="Comments"/>
|
||||||
|
</HyperlinkButton>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<Pivot Grid.Row="1" Name="pivot" SelectedIndex="0" SelectionChanged="pivot_SelectionChanged">
|
||||||
|
<PivotItem Margin="0,-48,0,0">
|
||||||
|
<Grid Name="relatedGrid">
|
||||||
|
<ScrollViewer>
|
||||||
|
<StackPanel Name="relatedVideos"/>
|
||||||
|
</ScrollViewer>
|
||||||
|
</Grid>
|
||||||
|
</PivotItem>
|
||||||
|
<PivotItem Margin="0,-48,0,0" Name="commentsPlaceholder">
|
||||||
|
<pages:CommentsPage/>
|
||||||
|
</PivotItem>
|
||||||
|
</Pivot>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</Page>
|
||||||
@@ -0,0 +1,472 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Runtime.InteropServices.WindowsRuntime;
|
||||||
|
using Windows.Foundation;
|
||||||
|
using Windows.Foundation.Collections;
|
||||||
|
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;
|
||||||
|
using Windows.System;
|
||||||
|
|
||||||
|
using Google.Apis.YouTube.v3.Data;
|
||||||
|
using Google.Apis.YouTube.v3;
|
||||||
|
using Windows.UI.Xaml.Media.Imaging;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Timers;
|
||||||
|
using Windows.UI.Core;
|
||||||
|
using System.Threading;
|
||||||
|
using Windows.ApplicationModel.DataTransfer;
|
||||||
|
using Windows.Storage;
|
||||||
|
using Windows.ApplicationModel;
|
||||||
|
using Windows.Storage.Streams;
|
||||||
|
using Windows.UI.Popups;
|
||||||
|
using Windows.UI.Text;
|
||||||
|
using Windows.UI;
|
||||||
|
using FoxTube.Pages;
|
||||||
|
|
||||||
|
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
|
||||||
|
|
||||||
|
namespace FoxTube
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// An empty page that can be used on its own or navigated to within a Frame.
|
||||||
|
/// </summary>
|
||||||
|
public sealed partial class Video : Page
|
||||||
|
{
|
||||||
|
string videoId;
|
||||||
|
Google.Apis.YouTube.v3.Data.Video item;
|
||||||
|
|
||||||
|
bool wide;
|
||||||
|
bool isExtended = false;
|
||||||
|
|
||||||
|
public VideoPlayer player;
|
||||||
|
LoadingPage LoadingScreen = new LoadingPage();
|
||||||
|
LoadingPage loadingRelated = new LoadingPage();
|
||||||
|
|
||||||
|
System.Timers.Timer streamUpdateTimer;
|
||||||
|
|
||||||
|
public Video()
|
||||||
|
{
|
||||||
|
this.InitializeComponent();
|
||||||
|
mainGrid.Children.Add(LoadingScreen);
|
||||||
|
relatedGrid.Children.Add(loadingRelated);
|
||||||
|
LoadingScreen.RefreshPage += LoadingScreen_RefreshPage;
|
||||||
|
|
||||||
|
DataTransferManager.GetForCurrentView().DataRequested += new TypedEventHandler<DataTransferManager, DataRequestedEventArgs>(Share);
|
||||||
|
|
||||||
|
if (Window.Current.Bounds.Width <= 1000)
|
||||||
|
{
|
||||||
|
Debug.WriteLine("Correcting layout...");
|
||||||
|
mainContent.Children.Remove(descriptionPanel);
|
||||||
|
pivot.Items.Insert(0, new PivotItem()
|
||||||
|
{
|
||||||
|
Content = descriptionPanel,
|
||||||
|
Margin = new Thickness(0, -48, 0, 0)
|
||||||
|
});
|
||||||
|
|
||||||
|
tabsPlaceholder.Children.Remove(tabs);
|
||||||
|
mainContent.Children.Add(tabs);
|
||||||
|
|
||||||
|
toDescription.Visibility = Visibility.Visible;
|
||||||
|
grid.ColumnDefinitions[1].Width = new GridLength(0);
|
||||||
|
|
||||||
|
pivot.SelectedIndex = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async void Initialize(string id)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
grid.Visibility = Visibility.Collapsed;
|
||||||
|
LoadingScreen.Refresh();
|
||||||
|
LoadingScreen.Visibility = Visibility.Visible;
|
||||||
|
videoId = id;
|
||||||
|
VideosResource.ListRequest request = SecretsVault.NoAuthService.Videos.List("snippet,contentDetails,statistics,status,liveStreamingDetails");
|
||||||
|
request.Id = id;
|
||||||
|
|
||||||
|
VideoListResponse response = await request.ExecuteAsync();
|
||||||
|
item = response.Items[0];
|
||||||
|
|
||||||
|
if (item.Snippet.LiveBroadcastContent == "live")
|
||||||
|
{
|
||||||
|
views.Text = string.Format("{0:0,0} viewers", item.LiveStreamingDetails.ConcurrentViewers);
|
||||||
|
streamUpdateTimer = new System.Timers.Timer(10000);
|
||||||
|
streamUpdateTimer.Elapsed += StreamUpdateTimer_Elapsed;
|
||||||
|
toComments.Visibility = Visibility.Collapsed;
|
||||||
|
pivot.Items.RemoveAt(pivot.Items.Count - 1);
|
||||||
|
//(toComments.Content as TextBlock).Text = "Chat";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
views.Text = string.Format("{0:0,0} views", item.Statistics.ViewCount);
|
||||||
|
(commentsPlaceholder.Content as CommentsPage).Initialize(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
VideoCategoriesResource.ListRequest categoryRequest = SecretsVault.NoAuthService.VideoCategories.List("snippet");
|
||||||
|
categoryRequest.Id = item.Snippet.CategoryId;
|
||||||
|
VideoCategoryListResponse categoryResponse = await categoryRequest.ExecuteAsync();
|
||||||
|
VideoCategory cat = categoryResponse.Items[0];
|
||||||
|
category.Text = cat.Snippet.Title;
|
||||||
|
|
||||||
|
if (item.Status.License == "youtube")
|
||||||
|
license.Text = "Standard YouTube License";
|
||||||
|
else license.Text = "Creative Commons Attribution license (reuse allowed)";
|
||||||
|
|
||||||
|
publishedAt.Text = item.Snippet.PublishedAt.Value.ToString("d, MMMM, yyyy");
|
||||||
|
title.Text = item.Snippet.Title;
|
||||||
|
dislikes.Text = item.Statistics.DislikeCount.ToString();
|
||||||
|
likes.Text = item.Statistics.LikeCount.ToString();
|
||||||
|
rating.Value = (double)item.Statistics.DislikeCount / (double)(item.Statistics.DislikeCount + item.Statistics.LikeCount) * 100;
|
||||||
|
Methods.FormatText(ref description, item.Snippet.Description);
|
||||||
|
|
||||||
|
ChannelsResource.ListRequest request1 = SecretsVault.NoAuthService.Channels.List("snippet,contentDetails,statistics");
|
||||||
|
request1.Id = item.Snippet.ChannelId;
|
||||||
|
|
||||||
|
ChannelListResponse response1 = await request1.ExecuteAsync();
|
||||||
|
var item1 = response1.Items[0];
|
||||||
|
|
||||||
|
channelAvatar.ProfilePicture = new BitmapImage(new Uri(item1.Snippet.Thumbnails.Medium.Url));
|
||||||
|
channelName.Text = item.Snippet.ChannelTitle;
|
||||||
|
subscribers.Text = item1.Statistics.SubscriberCount + " subscribers";
|
||||||
|
|
||||||
|
/*var ratingResponse = await SecretsVault.YoutubeService.Videos.GetRating(id).ExecuteAsync();
|
||||||
|
if (ratingResponse.Items[0].Rating == "like")
|
||||||
|
like.Foreground = new SolidColorBrush(Colors.Green);
|
||||||
|
else if (ratingResponse.Items[0].Rating == "dislike")
|
||||||
|
dislike.Foreground = new SolidColorBrush(Colors.Red);*/
|
||||||
|
|
||||||
|
player = new VideoPlayer(item, item1.Snippet.Thumbnails.Medium.Url);
|
||||||
|
player.SetFullSize += Player_SetFullSize;
|
||||||
|
|
||||||
|
playerPlaceholder.Children.Add(player);
|
||||||
|
|
||||||
|
Thread.Sleep(1000);
|
||||||
|
grid.Visibility = Visibility.Visible;
|
||||||
|
LoadingScreen.Visibility = Visibility.Collapsed;
|
||||||
|
|
||||||
|
LoadRelatedVideos();
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
LoadingScreen.Error();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async void LoadRelatedVideos()
|
||||||
|
{
|
||||||
|
loadingRelated.Refresh();
|
||||||
|
loadingRelated.Visibility = Visibility.Visible;
|
||||||
|
|
||||||
|
SearchResource.ListRequest request = SecretsVault.NoAuthService.Search.List("snippet");
|
||||||
|
request.RelatedToVideoId = videoId;
|
||||||
|
request.MaxResults = 20;
|
||||||
|
request.Type = "video";
|
||||||
|
|
||||||
|
SearchListResponse response = await request.ExecuteAsync();
|
||||||
|
|
||||||
|
foreach (SearchResult video in response.Items)
|
||||||
|
relatedVideos.Children.Add(new VideoCard(video.Id.VideoId));
|
||||||
|
|
||||||
|
loadingRelated.Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void StreamUpdateTimer_Elapsed(object sender, ElapsedEventArgs e)
|
||||||
|
{
|
||||||
|
await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, UpdateStreamDetails);
|
||||||
|
}
|
||||||
|
|
||||||
|
async void UpdateStreamDetails()
|
||||||
|
{
|
||||||
|
VideosResource.ListRequest request = SecretsVault.NoAuthService.Videos.List("statistics,liveStreamingDetails");
|
||||||
|
request.Id = videoId;
|
||||||
|
|
||||||
|
VideoListResponse response = await request.ExecuteAsync();
|
||||||
|
var itemTemp = response.Items[0];
|
||||||
|
|
||||||
|
if (itemTemp.Snippet.LiveBroadcastContent == "live")
|
||||||
|
{
|
||||||
|
views.Text = itemTemp.LiveStreamingDetails.ConcurrentViewers + " viewers";
|
||||||
|
|
||||||
|
dislikes.Text = itemTemp.Statistics.DislikeCount.ToString();
|
||||||
|
likes.Text = itemTemp.Statistics.LikeCount.ToString();
|
||||||
|
rating.Value = (double)itemTemp.Statistics.DislikeCount / (double)(itemTemp.Statistics.DislikeCount + itemTemp.Statistics.LikeCount) * 100;
|
||||||
|
}
|
||||||
|
else streamUpdateTimer.Stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Player_SetFullSize(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
isExtended = !isExtended;
|
||||||
|
if(isExtended)
|
||||||
|
{
|
||||||
|
grid.ColumnDefinitions[1].Width = new GridLength(0);
|
||||||
|
|
||||||
|
tabs.Visibility = Visibility.Collapsed;
|
||||||
|
descriptionPanel.Visibility = Visibility.Collapsed;
|
||||||
|
commandbar.Visibility = Visibility.Collapsed;
|
||||||
|
|
||||||
|
mainScroll.Margin = new Thickness(0);
|
||||||
|
mainScroll.ChangeView(0, 0, null);
|
||||||
|
mainScroll.VerticalScrollBarVisibility = ScrollBarVisibility.Hidden;
|
||||||
|
mainScroll.VerticalScrollMode = ScrollMode.Disabled;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tabs.Visibility = Visibility.Visible;
|
||||||
|
descriptionPanel.Visibility = Visibility.Visible;
|
||||||
|
commandbar.Visibility = Visibility.Visible;
|
||||||
|
|
||||||
|
mainScroll.Margin = new Thickness(0,0,0,50);
|
||||||
|
mainScroll.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
|
||||||
|
mainScroll.VerticalScrollMode = ScrollMode.Auto;
|
||||||
|
|
||||||
|
if (wide)
|
||||||
|
grid.ColumnDefinitions[1].Width = new GridLength(400);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void gotoChannel_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
((Window.Current.Content as Frame).Content as MainPage).GoToChannel(item.Snippet.ChannelId);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void openBrowser_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
player.Pause();
|
||||||
|
string timecode = player.elapsed.TotalSeconds > 10 ?
|
||||||
|
"&t=" + (int)player.elapsed.TotalSeconds + "s" : string.Empty;
|
||||||
|
|
||||||
|
await Launcher.LaunchUriAsync(new Uri(string.Format("https://www.youtube.com/watch?v={0}{1}", videoId, timecode)));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refresh_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
playerPlaceholder.Children.Clear();
|
||||||
|
player = null;
|
||||||
|
|
||||||
|
Initialize(videoId);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadingScreen_RefreshPage(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
refresh_Click(this, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void grid_SizeChanged(object sender, SizeChangedEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.NewSize.Width > 1000)
|
||||||
|
wide = true;
|
||||||
|
else
|
||||||
|
wide = false;
|
||||||
|
|
||||||
|
if (e.NewSize.Width > 1000 && e.PreviousSize.Width <= 1000 && !isExtended)
|
||||||
|
{
|
||||||
|
if (mainContent.Children.Contains(tabs))
|
||||||
|
{
|
||||||
|
mainContent.Children.Remove(tabs);
|
||||||
|
tabsPlaceholder.Children.Add(tabs);
|
||||||
|
|
||||||
|
(pivot.Items[0] as PivotItem).Content = null;
|
||||||
|
pivot.Items.RemoveAt(0);
|
||||||
|
mainContent.Children.Add(descriptionPanel);
|
||||||
|
}
|
||||||
|
|
||||||
|
toDescription.Visibility = Visibility.Collapsed;
|
||||||
|
grid.ColumnDefinitions[1].Width = new GridLength(400);
|
||||||
|
|
||||||
|
pivot.SelectedIndex = 0;
|
||||||
|
}
|
||||||
|
else if (e.NewSize.Width <= 1000 & e.PreviousSize.Width > 1000)
|
||||||
|
{
|
||||||
|
if (mainContent.Children.Contains(descriptionPanel))
|
||||||
|
{
|
||||||
|
mainContent.Children.Remove(descriptionPanel);
|
||||||
|
pivot.Items.Insert(0, new PivotItem()
|
||||||
|
{
|
||||||
|
Content = descriptionPanel,
|
||||||
|
Margin = new Thickness(0, -48, 0, 0)
|
||||||
|
});
|
||||||
|
|
||||||
|
tabsPlaceholder.Children.Remove(tabs);
|
||||||
|
mainContent.Children.Add(tabs);
|
||||||
|
}
|
||||||
|
|
||||||
|
toDescription.Visibility = Visibility.Visible;
|
||||||
|
grid.ColumnDefinitions[1].Width = new GridLength(0);
|
||||||
|
|
||||||
|
pivot.SelectedIndex = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
player.Pause();
|
||||||
|
DataRequest request = args.Request;
|
||||||
|
request.Data.Properties.Title = item.Snippet.Title;
|
||||||
|
request.Data.Properties.Description = "Sharing a video";
|
||||||
|
|
||||||
|
// Handle errors
|
||||||
|
//request.FailWithDisplayText("Something unexpected could happen.");
|
||||||
|
|
||||||
|
// Plain text
|
||||||
|
request.Data.SetText(item.Snippet.Title + "\n" + "#YouTube #FoxTube #SharedWithFoxTube");
|
||||||
|
|
||||||
|
// Uniform Resource Identifiers (URIs)
|
||||||
|
request.Data.SetWebLink(new Uri(string.Format("https://www.youtube.com/watch?v={0}", videoId)));
|
||||||
|
|
||||||
|
// HTML
|
||||||
|
//request.Data.SetHtmlFormat("<b>Bold Text</b>");
|
||||||
|
|
||||||
|
// Because we are making async calls in the DataRequested event handler,
|
||||||
|
// we need to get the deferral first.
|
||||||
|
DataRequestDeferral deferral = request.GetDeferral();
|
||||||
|
|
||||||
|
// Make sure we always call Complete on the deferral.
|
||||||
|
try
|
||||||
|
{
|
||||||
|
StorageFile thumbnailFile = await Package.Current.InstalledLocation.GetFileAsync(item.Snippet.Thumbnails.Medium.Url);
|
||||||
|
request.Data.Properties.Thumbnail = RandomAccessStreamReference.CreateFromFile(thumbnailFile);
|
||||||
|
StorageFile imageFile = await Package.Current.InstalledLocation.GetFileAsync(item.Snippet.Thumbnails.Medium.Url);
|
||||||
|
|
||||||
|
// Bitmaps
|
||||||
|
request.Data.SetBitmap(RandomAccessStreamReference.CreateFromFile(imageFile));
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
deferral.Complete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void share_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
DataTransferManager.ShowShareUI();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void pivot_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
|
{
|
||||||
|
toDescription.FontWeight = FontWeights.Normal;
|
||||||
|
toPlaylist.FontWeight = FontWeights.Normal;
|
||||||
|
toSuggestions.FontWeight = FontWeights.Normal;
|
||||||
|
toComments.FontWeight = FontWeights.Normal;
|
||||||
|
|
||||||
|
if (pivot.SelectedIndex == 0)
|
||||||
|
{
|
||||||
|
if (toDescription.Visibility != Visibility.Collapsed)
|
||||||
|
toDescription.FontWeight = FontWeights.Bold;
|
||||||
|
else if (toPlaylist.Visibility != Visibility.Collapsed)
|
||||||
|
toPlaylist.FontWeight = FontWeights.Bold;
|
||||||
|
else
|
||||||
|
toSuggestions.FontWeight = FontWeights.Bold;
|
||||||
|
}
|
||||||
|
else if (pivot.SelectedIndex == 1)
|
||||||
|
{
|
||||||
|
if (toDescription.Visibility == Visibility.Collapsed)
|
||||||
|
{
|
||||||
|
if (toPlaylist.Visibility == Visibility.Collapsed)
|
||||||
|
toComments.FontWeight = FontWeights.Bold;
|
||||||
|
else
|
||||||
|
toSuggestions.FontWeight = FontWeights.Bold;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (toPlaylist.Visibility != Visibility.Collapsed)
|
||||||
|
toPlaylist.FontWeight = FontWeights.Bold;
|
||||||
|
else
|
||||||
|
toSuggestions.FontWeight = FontWeights.Bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (pivot.SelectedIndex == 2)
|
||||||
|
{
|
||||||
|
if(toDescription.Visibility != Visibility.Collapsed && toPlaylist.Visibility != Visibility.Collapsed)
|
||||||
|
toSuggestions.FontWeight = FontWeights.Bold;
|
||||||
|
else if (toDescription.Visibility != Visibility.Collapsed || toPlaylist.Visibility != Visibility.Collapsed)
|
||||||
|
toComments.FontWeight = FontWeights.Bold;
|
||||||
|
}
|
||||||
|
else if (pivot.SelectedIndex == 3)
|
||||||
|
toComments.FontWeight = FontWeights.Bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void dislike_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if(like.Foreground == new SolidColorBrush(Colors.Green))
|
||||||
|
{
|
||||||
|
like.Foreground = new SolidColorBrush(Colors.Gray);
|
||||||
|
likes.Text = (Convert.ToInt32(likes.Text) - 1).ToString();
|
||||||
|
rating.Value = (int)((item.Statistics.DislikeCount) / (item.Statistics.DislikeCount + item.Statistics.LikeCount - 1) * 100);
|
||||||
|
await SecretsVault.NoAuthService.Videos.Rate(videoId, VideosResource.RateRequest.RatingEnum.None).ExecuteAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(dislike.Foreground == new SolidColorBrush(Colors.Red))
|
||||||
|
{
|
||||||
|
dislike.Foreground = new SolidColorBrush(Colors.Gray);
|
||||||
|
rating.Value = (int)((item.Statistics.DislikeCount - 1) / (item.Statistics.DislikeCount + item.Statistics.LikeCount - 1) * 100);
|
||||||
|
await SecretsVault.NoAuthService.Videos.Rate(videoId, VideosResource.RateRequest.RatingEnum.None).ExecuteAsync();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dislike.Foreground = new SolidColorBrush(Colors.Red);
|
||||||
|
dislikes.Text = (Convert.ToInt32(dislikes.Text) + 1).ToString();
|
||||||
|
rating.Value = (int)((item.Statistics.DislikeCount + 1) / (item.Statistics.DislikeCount + item.Statistics.LikeCount + 1) * 100);
|
||||||
|
await SecretsVault.NoAuthService.Videos.Rate(videoId, VideosResource.RateRequest.RatingEnum.Dislike).ExecuteAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void like_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (dislike.Foreground == new SolidColorBrush(Colors.Red))
|
||||||
|
{
|
||||||
|
dislike.Foreground = new SolidColorBrush(Colors.Gray);
|
||||||
|
dislikes.Text = (Convert.ToInt32(likes.Text) - 1).ToString();
|
||||||
|
rating.Value = (int)((item.Statistics.LikeCount) / (item.Statistics.DislikeCount + item.Statistics.LikeCount - 1) * 100);
|
||||||
|
await SecretsVault.NoAuthService.Videos.Rate(videoId, VideosResource.RateRequest.RatingEnum.None).ExecuteAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (like.Foreground == new SolidColorBrush(Colors.Green))
|
||||||
|
{
|
||||||
|
like.Foreground = new SolidColorBrush(Colors.Gray);
|
||||||
|
rating.Value = (int)((item.Statistics.LikeCount - 1) / (item.Statistics.DislikeCount + item.Statistics.LikeCount - 1) * 100);
|
||||||
|
await SecretsVault.NoAuthService.Videos.Rate(videoId, VideosResource.RateRequest.RatingEnum.None).ExecuteAsync();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
like.Foreground = new SolidColorBrush(Colors.Green);
|
||||||
|
likes.Text = (Convert.ToInt32(dislikes.Text) + 1).ToString();
|
||||||
|
rating.Value = (int)((item.Statistics.LikeCount + 1) / (item.Statistics.DislikeCount + item.Statistics.LikeCount + 1) * 100);
|
||||||
|
await SecretsVault.NoAuthService.Videos.Rate(videoId, VideosResource.RateRequest.RatingEnum.Dislike).ExecuteAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void description_LinkClicked(object sender, Microsoft.Toolkit.Uwp.UI.Controls.LinkClickedEventArgs e)
|
||||||
|
{
|
||||||
|
await Launcher.LaunchUriAsync(new Uri(e.Link));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,112 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Google.Apis.Auth.OAuth2;
|
|
||||||
using Google.Apis.Services;
|
|
||||||
using Google.Apis.YouTube.v3;
|
|
||||||
using Google.Apis.Auth.OAuth2.Flows;
|
|
||||||
using Windows.UI.Xaml;
|
|
||||||
using Windows.UI.Xaml.Controls;
|
|
||||||
|
|
||||||
namespace FoxTube
|
|
||||||
{
|
|
||||||
class SecretsVault
|
|
||||||
{
|
|
||||||
public static string Email
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return "youwillneverknowthisadress@gmail.com";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public static string Password
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return "thisisthepassword12345";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public static string YoutubeApi
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return "AIzaSyBgHrCnrlzlVmk0cJKL8RqP9Y8x6XSuk_0";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static YouTubeService YoutubeService
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return new YouTubeService(new BaseClientService.Initializer()
|
|
||||||
{
|
|
||||||
ApiKey = YoutubeApi,
|
|
||||||
ApplicationName = "FoxTube"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ClientSecrets Secrets
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
//new UserCredential(new AuthorizationCodeFlow(new AuthorizationCodeFlow.Initializer("", "")), "userId", new Google.Apis.Auth.OAuth2.Responses.TokenResponse() { } )
|
|
||||||
return new ClientSecrets()
|
|
||||||
{
|
|
||||||
ClientId = "349735264870-2ekqlm0a4mkg3mmrfcv90s3qp3o15dq0.apps.googleusercontent.com",
|
|
||||||
ClientSecret = "BkVZOAaCU2Zclf0Zlicg6y2_"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#region User credentials
|
|
||||||
private List<UserCredential> credentials = new List<UserCredential>(); //Test variable simulating actual credentials storage
|
|
||||||
|
|
||||||
public void AddAccount()
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
credentials.Add(
|
|
||||||
new UserCredential(
|
|
||||||
new AuthorizationCodeFlow(
|
|
||||||
new AuthorizationCodeFlow.Initializer("https://accounts.google.com/o/oauth2/v2/auth", "https://www.googleapis.com/oauth2/v4/token")),
|
|
||||||
"",
|
|
||||||
new Google.Apis.Auth.OAuth2.Responses.TokenResponse()
|
|
||||||
{
|
|
||||||
AccessToken = "done",
|
|
||||||
ExpiresInSeconds = 1,
|
|
||||||
IdToken = "done",
|
|
||||||
TokenType = "done",
|
|
||||||
RefreshToken = "done",
|
|
||||||
Scope = "youtube"
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void DeleteAccount(int index)
|
|
||||||
{
|
|
||||||
credentials.RemoveAt(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
public UserCredential RetrieveAccount(int index)
|
|
||||||
{
|
|
||||||
return credentials[index];
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Authorization service functions
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Simplifying stuff
|
|
||||||
public static SubLayer SubLayer
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return (Window.Current.Content as Frame).Content as SubLayer;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -40,7 +40,7 @@ namespace FoxTube
|
|||||||
if(grid.Children.Contains(element))
|
if(grid.Children.Contains(element))
|
||||||
{
|
{
|
||||||
grid.Children.Remove(element);
|
grid.Children.Remove(element);
|
||||||
initialParent.SetPlayerBack();
|
//initialParent.SetPlayerBack();
|
||||||
initialParent = null;
|
initialParent = null;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -52,7 +52,7 @@ namespace FoxTube
|
|||||||
public void ExitFullScreen()
|
public void ExitFullScreen()
|
||||||
{
|
{
|
||||||
grid.Children.RemoveAt(1);
|
grid.Children.RemoveAt(1);
|
||||||
initialParent.SetPlayerBack();
|
//initialParent.SetPlayerBack();
|
||||||
/*Fullscreen.Content = null;
|
/*Fullscreen.Content = null;
|
||||||
Fullscreen.Visibility = Visibility.Collapsed;*/
|
Fullscreen.Visibility = Visibility.Collapsed;*/
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,60 +0,0 @@
|
|||||||
<Page
|
|
||||||
x:Class="FoxTube.Video"
|
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
||||||
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">
|
|
||||||
|
|
||||||
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition Width="3*"/>
|
|
||||||
<ColumnDefinition Width="*"/>
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<ScrollViewer>
|
|
||||||
<StackPanel Orientation="Vertical">
|
|
||||||
<StackPanel Name="mainContent"/>
|
|
||||||
<!--<local:VideoPlayer Name="player"/>-->
|
|
||||||
<StackPanel Margin="10">
|
|
||||||
<TextBlock Name="title" Text="Video title this is very biiiiig title. It's amazingly big. OLOLOLOLOLO!!!!!!)))))). 1234567890. ABCD" FontSize="25" TextWrapping="WrapWholeWords" HorizontalTextAlignment="Start"/>
|
|
||||||
<Grid>
|
|
||||||
<Button Padding="0" Background="Transparent" Margin="5" Name="gotoChannel" Click="gotoChannel_Click">
|
|
||||||
<StackPanel Orientation="Horizontal">
|
|
||||||
<PersonPicture Name="channelAvatar" Width="90"/>
|
|
||||||
<StackPanel Orientation="Vertical" Grid.Column="1" Padding="5" VerticalAlignment="Center">
|
|
||||||
<StackPanel Orientation="Horizontal">
|
|
||||||
<TextBlock Name="channelName" Text="IGP" FontSize="18"/>
|
|
||||||
</StackPanel>
|
|
||||||
<TextBlock Name="subscribers" Text="120,452 subscribers" Foreground="Gray"/>
|
|
||||||
<StackPanel Name="subscribePanel" Orientation="Horizontal" Margin="0,5,0,0">
|
|
||||||
<ToggleButton Grid.Column="2" Height="30" Width="150" Background="Red" Foreground="White" FontSize="14" FontWeight="SemiBold" Content="Subscirbe"/>
|
|
||||||
<ToggleButton Grid.Column="3" Height="30" Width="30" Padding="0" FontFamily="Segoe MDL2 Assets" FontSize="14" FontWeight="SemiBold" Content="" Foreground="White" Background="Red"/>
|
|
||||||
</StackPanel>
|
|
||||||
</StackPanel>
|
|
||||||
</StackPanel>
|
|
||||||
</Button>
|
|
||||||
<StackPanel HorizontalAlignment="Right">
|
|
||||||
<TextBlock Name="views" Text="10,000,000 views" FontSize="24" Foreground="Gray"/>
|
|
||||||
<RelativePanel>
|
|
||||||
<Line Stroke="Green" StrokeThickness="5" X1="0" X2="250" Y1="0" Y2="0"/>
|
|
||||||
<Line Name="dislikeLine" Stroke="Red" StrokeThickness="5" X1="0" X2="100" Y1="0" Y2="0"/>
|
|
||||||
</RelativePanel>
|
|
||||||
<Grid>
|
|
||||||
<StackPanel>
|
|
||||||
<Button Background="Transparent" Padding="0" Content="" FontFamily="Segoe MDL2 Assets" Foreground="Gray" FontSize="40" Name="dislike"/>
|
|
||||||
<TextBlock Foreground="Gray" Text="10923" Name="dislikes"/>
|
|
||||||
</StackPanel>
|
|
||||||
<StackPanel HorizontalAlignment="Right">
|
|
||||||
<Button Background="Transparent" Padding="0" Content="" FontFamily="Segoe MDL2 Assets" Foreground="Gray" FontSize="40" Name="like"/>
|
|
||||||
<TextBlock Foreground="Gray" Text="10923" Name="likes"/>
|
|
||||||
</StackPanel>
|
|
||||||
</Grid>
|
|
||||||
</StackPanel>
|
|
||||||
</Grid>
|
|
||||||
<TextBlock Name="description" IsTextSelectionEnabled="True" TextWrapping="WrapWholeWords" Text="description"/>
|
|
||||||
</StackPanel>
|
|
||||||
</StackPanel>
|
|
||||||
</ScrollViewer>
|
|
||||||
</Grid>
|
|
||||||
</Page>
|
|
||||||
@@ -1,89 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Runtime.InteropServices.WindowsRuntime;
|
|
||||||
using Windows.Foundation;
|
|
||||||
using Windows.Foundation.Collections;
|
|
||||||
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;
|
|
||||||
|
|
||||||
using Google.Apis.YouTube.v3.Data;
|
|
||||||
using Google.Apis.YouTube.v3;
|
|
||||||
using Windows.UI.Xaml.Media.Imaging;
|
|
||||||
using System.Diagnostics;
|
|
||||||
|
|
||||||
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
|
|
||||||
|
|
||||||
namespace FoxTube
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// An empty page that can be used on its own or navigated to within a Frame.
|
|
||||||
/// </summary>
|
|
||||||
public sealed partial class Video : Page
|
|
||||||
{
|
|
||||||
string videoId;
|
|
||||||
Google.Apis.YouTube.v3.Data.Video item;
|
|
||||||
|
|
||||||
VideoPlayer player;
|
|
||||||
|
|
||||||
public Video()
|
|
||||||
{
|
|
||||||
this.InitializeComponent();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async void Initialize(string id)
|
|
||||||
{
|
|
||||||
videoId = id;
|
|
||||||
VideosResource.ListRequest request = SecretsVault.YoutubeService.Videos.List("snippet,contentDetails,statistics");
|
|
||||||
request.Id = id;
|
|
||||||
|
|
||||||
VideoListResponse response = await request.ExecuteAsync();
|
|
||||||
item = response.Items[0];
|
|
||||||
|
|
||||||
title.Text = item.Snippet.Title;
|
|
||||||
/*views.Text = item.Statistics.ViewCount + " views";
|
|
||||||
dislikes.Text = item.Statistics.DislikeCount.ToString();
|
|
||||||
likes.Text = item.Statistics.LikeCount.ToString();
|
|
||||||
Debug.WriteLine((double)item.Statistics.DislikeCount / (double)(item.Statistics.DislikeCount + item.Statistics.LikeCount) * 250);
|
|
||||||
dislikeLine.X2 = (double)item.Statistics.DislikeCount / (double)(item.Statistics.DislikeCount + item.Statistics.LikeCount) * 250;*/
|
|
||||||
description.Text = item.Snippet.Description;
|
|
||||||
|
|
||||||
ChannelsResource.ListRequest request1 = SecretsVault.YoutubeService.Channels.List("snippet,contentDetails,statistics");
|
|
||||||
request1.Id = item.Snippet.ChannelId;
|
|
||||||
|
|
||||||
ChannelListResponse response1 = await request1.ExecuteAsync();
|
|
||||||
var item1 = response1.Items[0];
|
|
||||||
|
|
||||||
channelAvatar.ProfilePicture = new BitmapImage(new Uri(item1.Snippet.Thumbnails.Medium.Url));
|
|
||||||
channelName.Text = item.Snippet.ChannelTitle;
|
|
||||||
subscribers.Text = item1.Statistics.SubscriberCount + " subscribers";
|
|
||||||
|
|
||||||
player = new VideoPlayer(id, item1.Snippet.Thumbnails.Medium.Url);
|
|
||||||
player.SetFullSize += Player_SetFullSize;
|
|
||||||
|
|
||||||
mainContent.Children.Add(player);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Player_SetFullSize(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
mainContent.Children.Clear();
|
|
||||||
SecretsVault.SubLayer.EnterFullScreen(player, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetPlayerBack()
|
|
||||||
{
|
|
||||||
mainContent.Children.Add(player);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void gotoChannel_Click(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
((Window.Current.Content as Frame).Content as MainPage).GoToChannel(item.Snippet.ChannelId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user