Archived
1
0

Refactored player. Refactored changelog system. Players isn't localized

Related Work Items: #161, #211, #238
This commit is contained in:
Michael Gordeev
2019-01-02 23:44:40 +03:00
parent cb5c3c7c7f
commit 088d85ddb9
69 changed files with 3871 additions and 707 deletions
+10 -24
View File
@@ -5,8 +5,8 @@ using Google.Apis.YouTube.v3;
using Google.Apis.YouTube.v3.Data;
using Windows.UI.Xaml.Media.Imaging;
using Windows.System;
using Windows.UI.Popups;
using Windows.ApplicationModel.DataTransfer;
using Windows.ApplicationModel.Resources;
namespace FoxTube.Controls
{
@@ -15,11 +15,12 @@ namespace FoxTube.Controls
/// </summary>
public sealed partial class VideoCard : UserControl
{
ResourceLoader resources = ResourceLoader.GetForCurrentView("Cards");
public string playlistId;
public string videoId;
Video item;
bool embed = false;
public VideoCard(string id, string playlist = null)
{
InitializeComponent();
@@ -45,7 +46,7 @@ namespace FoxTube.Controls
channelName.Text = item.Snippet.ChannelTitle;
if (item.Snippet.LiveBroadcastContent == "live")
{
views.Text = $"{item.LiveStreamingDetails.ConcurrentViewers:0,0} viewers";
views.Text = $"{item.LiveStreamingDetails.ConcurrentViewers:0,0} {resources.GetString("/Cards/viewers")}";
if (item.LiveStreamingDetails.ScheduledStartTime.HasValue && item.LiveStreamingDetails.ScheduledEndTime.HasValue)
info.Text = $"{item.LiveStreamingDetails.ScheduledEndTime - item.LiveStreamingDetails.ScheduledStartTime} | {Methods.GetAgo(item.LiveStreamingDetails.ActualStartTime.Value)}";
else
@@ -62,14 +63,13 @@ namespace FoxTube.Controls
liveTag.Visibility = Visibility.Visible;
if (item.LiveStreamingDetails.ScheduledStartTime.HasValue && (item.LiveStreamingDetails.ScheduledStartTime - DateTime.Now).Value.TotalMilliseconds > 0)
liveContent.Text = $"Goes live in {item.LiveStreamingDetails.ScheduledStartTime}";
else liveContent.Text = "Upcoming";
liveContent.Text = $"{resources.GetString("/Cards/goesLive")} {item.LiveStreamingDetails.ScheduledStartTime}";
else liveContent.Text = resources.GetString("/Cards/upcoming");
}
else
{
views.Text = $"{item.Statistics.ViewCount:0,0} views";
views.Text = $"{item.Statistics.ViewCount:0,0} {resources.GetString("/Cards/views")}";
info.Text = $"{item.ContentDetails.Duration.GetDuration()} | {Methods.GetAgo(item.Snippet.PublishedAt.Value)}";
embed = false;
}
var request1 = SecretsVault.Service.Channels.List("snippet");
@@ -90,23 +90,9 @@ namespace FoxTube.Controls
}*/
}
public async void Button_Click(object sender, RoutedEventArgs e)
public void Button_Click(object sender, RoutedEventArgs e)
{
if (embed)
{
MessageDialog dialog = new MessageDialog("Unfortunately, at this stage of application development we don't support live steams. This issue will be fixed in the next update. Sorry. Would you like us to open this stream in browser?", "Open in browser");
dialog.Commands.Add(new UICommand("Yes", async (command) =>
{
await Launcher.LaunchUriAsync(new Uri($"https://www.youtube.com/watch?v={videoId}"));
}));
dialog.Commands.Add(new UICommand("No"));
dialog.DefaultCommandIndex = 0;
dialog.CancelCommandIndex = 1;
await dialog.ShowAsync();
}
else
Methods.MainPage.GoToVideo(videoId, playlistId);
Methods.MainPage.GoToVideo(videoId, playlistId);
}
private void ViewChannel_Click(object sender, RoutedEventArgs e)